Create Smart Wallets
Create smart wallets with Crossmint
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:
- Create a Crossmint account if you haven’t yet.
- 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
, andwallets:nfts.read
. - 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.
- 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:
An object identifying the user and containing the following properties:
jwt
- JSON web token from your auth provider
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
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.
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);
}