Skip to main content
This guide walks through a full Aurum integration in a client-side React app (Vite, Create React App, or any non-SSR React setup). For frameworks with server rendering, see the Next.js or TanStack Start guides.

Install

Requires React 18 or 19.

1. Create the Aurum instance

Put the instance in its own module so the entire app imports the same singleton.
src/lib/aurum.ts
new Aurum() is a singleton — calling it again returns the existing instance and warns if the config differs. Keep this file as the only place you construct it.

2. Wrap the app in AurumProvider

src/main.tsx

3. Build a connect button

useAccount exposes connection state (and rerenders on accountsChanged automatically). useConnect and useDisconnect trigger the modal flows.
src/components/ConnectButton.tsx
isInitializing is true while Aurum restores any persisted connection from the previous session. Always render a placeholder to avoid a flash of “disconnected” state on reload.

4. Sign a message

aurum.rpcProvider is EIP-1193 compatible — wire it into viem or ethers.
src/components/SignMessageButton.tsx
See the Viem, Ethers v5, or Ethers v6 integration pages for the full surface (transactions, contract reads/writes).

5. Switch chains

src/components/SwitchChainButton.tsx
Pass the full Chain object so wallets that haven’t added it yet can prompt the user to do so.

Common patterns

Gate content behind a connection

Handle user-rejected and wallet-not-installed errors

See Errors for the full error class table.

Next steps

Customization

Theme the modal

Headless mode

Build a fully custom UI

React Hooks

Hooks API reference