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-native-ui";
import { View, Text, TouchableOpacity } from "react-native";

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

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

    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 (
        <View>
            <Text>Wallet: {wallet.address}</Text>
            <TouchableOpacity onPress={handleBalances}>
                <Text>Check Balances</Text>
            </TouchableOpacity>
            <TouchableOpacity onPress={handleSend}>
                <Text>Send USDC</Text>
            </TouchableOpacity>
        </View>
    );
}

useWalletEmailSigner()

Hook for managing email-based signer authentication flows. Provides OTP send/verify functions for wallets using an email signer. Must be used within a CrossmintWalletProvider.

Returns

needsAuth
boolean
Whether the email signer currently requires authentication (OTP verification).
sendEmailWithOtp
() => Promise<void>
Sends a one-time password to the user’s email address.
verifyOtp
(otp: string) => Promise<void>
Verifies the one-time password entered by the user.
reject
(error: Error) => void
Rejects the current authentication request with an error.

Usage

import { useWalletEmailSigner } from "@crossmint/client-sdk-react-native-ui";
import { View, Text, TextInput, TouchableOpacity } from "react-native";
import { useState } from "react";

function EmailSignerFlow() {
    const { needsAuth, sendEmailWithOtp, verifyOtp, reject } = useWalletEmailSigner();
    const [otp, setOtp] = useState("");

    if (!needsAuth) return null;

    return (
        <View>
            <Text>Email verification required</Text>
            <TouchableOpacity onPress={sendEmailWithOtp}>
                <Text>Send OTP</Text>
            </TouchableOpacity>
            <TextInput value={otp} onChangeText={setOtp} placeholder="Enter OTP" />
            <TouchableOpacity onPress={() => verifyOtp(otp)}>
                <Text>Verify</Text>
            </TouchableOpacity>
            <TouchableOpacity onPress={() => reject(new Error("User cancelled"))}>
                <Text>Cancel</Text>
            </TouchableOpacity>
        </View>
    );
}

Wallet Methods

The wallet instance returned by useWallet() provides methods for token transfers, balances, signing, and more. Since the React Native 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: