Prerequisites

  • API Key: Ensure you have an API key with the scopes: wallets.create.

Create a Wallet

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

const { getOrCreateWallet } = useWallet();

const wallet = await getOrCreateWallet({
    chain: "<your-chain>",
    signer: {
        type: "<signer-type>",
    },
});

Parameters

chain
string
required
The chain to use the wallet on.See all supported chains for more details. On staging only testnet chains are supported.Note: For EVM-compatible chains, wallets are created for all chains as part of the shared address space derived from the same private key. However, to interact with a specific chain using the SDK, you must instantiate a wallet object per chain. This allows the SDK to correctly route interactions to the appropriate network configuration.
signer
Signer
required
The signer to use the wallet with.
owner
string
An identifier for the user this wallet is associated with. You can fetch wallets later by this user.
  • email:<email>
  • userId:<userId>
  • phoneNumber:<phoneNumber>
  • twitter:<handle>
  • x:<handle> (alias for twitter:<handle>)
options
WalletOptions
The options to use the wallet with.

Returns

wallet
Wallet
The created wallet.