Create wallets on-demand with an email address, phone number, or any user identifier. Bring your own signer or use Crossmint’s managed Passkey signer. Compatible with any Viem account or EIP1193 compatible . Available on Polygon, Optimism, Base, Arbitrum, and their corresponding testnets. If you are looking for a different chain, reach out to us at support@crossmint.com

Prerequisites:

  1. Create a Crossmint account if you haven’t yet.
  2. Go to the API key section of the developer console and create a new client-side API key with the following scopes: wallets.read, wallets.create, and wallets:nfts.read.
  3. Whitelist your project domain by adding it to the ‘Authorized Origins’ section when creating an API key. If testing locally, whitelist localhost and your port for development.
  4. Make a note of your API key, as you will need this to create wallets.

Creating a Wallet

To create a wallet, you will use the getOrCreateWallet function of the SmartWalletSDK, which takes the following parameters:

userParams
object
required

An object identifying the user and containing the following properties:

  • jwt - JSON web token from your auth provider
chain
string
required

The blockchain you intend to create the smart contract wallet on. Available options:

  • polygon
  • polygon-amoy
  • base
  • base-sepolia
  • arbitrum
  • arbitrum-sepolia
  • optimism
  • optimism-sepolia
walletParams
object

An object containing a signer property. Read on to learn what is a signer and the different types available.

The way that you call the getOrCreateWallet function will depend on the type of signer your application is utilizing.

Refer to the Quickstart for an example of setting this up.
import { SmartWalletChain, SmartWalletSDK } from "@crossmint/client-sdk-smart-wallet";
import { getJWTFromAuth } from "./FirebaseAuthManager";

export const createSmartWalletPasskey = async () => {
    const xm = SmartWalletSDK.init({
        clientApiKey: process.env.REACT_APP_CROSSMINT_API_KEY_STG,
    });
    const jwt = await getJWTFromAuth();

    return await xm.getOrCreateWallet({ jwt }, SmartWalletChain.POLYGON_AMOY);
}