Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aurumsdk.com/llms.txt

Use this file to discover all available pages before exploring further.

The React Hooks package provides hooks for accessing user state, connecting to and disconnecting from wallets.

Installation

pnpm add @aurum-sdk/core @aurum-sdk/hooks

Provider Setup

Wrap your application root in AurumProvider with an initialized Aurum instance:
import { Aurum } from '@aurum-sdk/core';
import { AurumProvider } from '@aurum-sdk/hooks';

const aurum = new Aurum({
  brand: { appName: 'Your App Name' },
  wallets: {
    embedded: { projectId: 'cdp-project-id' },
    walletConnect: { projectId: 'reown-project-id' },
  },
});

function App() {
  return (
    <AurumProvider aurum={aurum}>
      <YourApp />
    </AurumProvider>
  );
}
See Core SDK Configuration for all available Aurum options.

Available Hooks

useAurum()

Access the raw Aurum SDK instance for advanced use cases.
const { aurum, isReady } = useAurum();

useAccount()

Access connected user information. Updates automatically when the connection state changes.
const {
  publicAddress,
  walletName,
  walletId,
  email,
  isConnected,
  isInitializing,
} = useAccount();

useConnect()

Connect to a wallet via the modal or directly by wallet ID.
const {
  connect,
  emailAuthStart,
  emailAuthVerify,
  getWalletConnectSession,
  isPending,
  error,
} = useConnect();

// Open wallet selection modal
await connect();

// Or connect directly to a specific wallet (skips modal)
import { WalletId } from '@aurum-sdk/types';

await connect(WalletId.MetaMask);
WalletId.Email cannot be used with connect(walletId) — use emailAuthStart / emailAuthVerify instead. See the Headless API for full examples.
Do not use useConnect() with <ConnectWidget>. Instead use useAccount() to react to connection state changes when using the widget.

useDisconnect()

Disconnect the current wallet.
const { disconnect } = useDisconnect();

await disconnect();

useChain()

Access current chain information and switch networks.
import { sepolia } from 'viem/chains';

const { chainId, switchChain, error } = useChain();

await switchChain(sepolia.id, sepolia);

Core SDK

Framework-agnostic API

Headless Mode

Build custom connection UIs