A Typescript SDK to interact with Crossmint Wallets. This SDK enables developers to easily create and manage wallets on Solana and EVM chains.
Set up your project and get an API key.
Install the SDK
Run the following command to install the SDK:
npm i @crossmint/wallets-sdk
Create a wallet
import { CrossmintWallets, createCrossmint } from "@crossmint/wallets-sdk"; const crossmint = createCrossmint({ apiKey: "<your-client-OR-server-api-key>", jwt: "<your-jwt>", // required for client-side calls, optional for server-side calls }); const crossmintWallets = CrossmintWallets.from(crossmint); const wallet = await crossmintWallets.getOrCreateWallet({ chain: "<your-chain>", signer: { type: "email", email: "<your-email>", }, }); console.log(wallet.address);
const balances = await wallet.balances(); console.log(balances.nativeToken.amount); console.log(balances.usdc.amount);
const transaction = await wallet.send(recipient, "usdc", "100"); console.log(transaction.explorerLink);
const activity = await wallet.experimental_activity(); console.log(activity.events);
// Add a delegated signer await wallet.addDelegatedSigner({ signer: "<signer-address>" }); const signers = await wallet.delegatedSigners(); console.log(signers);
import { SolanaWallet, EVMWallet } from "@crossmint/wallets-sdk"; // Solana const solanaWallet = SolanaWallet.from(wallet); const solTx = await solanaWallet.sendTransaction({ transaction: "<serialized-or-non-serialized-transaction>" }); console.log(solTx.explorerLink); // EVM const evmWallet = EVMWallet.from(wallet); const evmTx = await evmWallet.sendTransaction({ transaction: "<serialized-or-non-serialized-transaction>" }); console.log(evmTx.explorerLink);
Learn about signers and custody.
Was this page helpful?