Skip to main content

useWallet()

Returns

wallet
Wallet | undefined
The current wallet instance, or undefined if no wallet is loaded.
status
WalletStatus
Current wallet status. Options: not-loaded | in-progress | loaded | error.
getOrCreateWallet
(args: WalletArgsFor<Chain>) => Promise<Wallet | undefined>
Creates a new wallet or retrieves an existing one.

Usage

import { useWallet } from "@crossmint/client-sdk-react-ui";

function WalletActions() {
    const { wallet, status } = useWallet();

    if (status === "in-progress") return <p>Loading wallet...</p>;
    if (!wallet) return <p>No wallet</p>;

    const handleSend = async () => {
        const tx = await wallet.send("0x...", "usdc", "10");
        console.log("Transaction:", tx.explorerLink);
    };

    const handleBalances = async () => {
        const balances = await wallet.balances();
        console.log("USDC:", balances.usdc.amount);
        console.log("Native:", balances.nativeToken.amount);
    };

    return (
        <div>
            <p>Wallet: {wallet.address}</p>
            <button onClick={handleBalances}>Check Balances</button>
            <button onClick={handleSend}>Send USDC</button>
        </div>
    );
}

Wallet Methods

The wallet instance returned by useWallet() provides methods for token transfers, balances, signing, and more. Since the React SDK wraps the Wallets SDK, see the Wallets SDK Reference for complete documentation.
MethodDescription
wallet.addDelegatedSigner()Add a delegated signer to the wallet
wallet.balances()Get the wallet balances - always includes USDC and native token (ETH/SOL)
wallet.delegatedSigners()List the delegated signers for this wallet.
wallet.experimental_activity()Get the wallet activity
wallet.experimental_nfts()Get the wallet NFTs
wallet.experimental_transaction()Get a transaction by id
wallet.experimental_transactions()Get the wallet transactions
wallet.send()Send a token to a wallet or user locator
wallet.stagingFund()Funds the wallet with Crossmint’s stablecoin (USDXM). Note: This method is only available in staging environments and exclusively supports USDXM tokens. It cannot be used in production environments.
Chain-specific: