Skip to main content
1

Install the SDK

Run the following command to install the SDK:
npm i @crossmint/wallets-sdk
2

Create a treasury wallet

See all supported chains here.
index.ts
import { CrossmintWallets, createCrossmint } from "@crossmint/wallets-sdk";

const crossmint = createCrossmint({
    apiKey: "<your-server-api-key>",
});

const crossmintWallets = CrossmintWallets.from(crossmint);

const wallet = await crossmintWallets.createWallet({
    chain: "<your-chain>",
    signer: {
        type: "api-key",
    },
    alias: "treasury",
});

console.log(wallet.address);
Key Points:
  • The alias field is set to "treasury" to identify this as your treasury wallet
  • The owner field is omitted (left empty) since this wallet is not tied to a specific user
  • Use the wallet address to receive stablecoins and manage your treasury
3

Check treasury wallet balance

Retrieve the stablecoin balance of your treasury wallet:
index.ts
const treasuryWallet = await crossmintWallets.getWallet(wallet.address, {
    chain: "base-sepolia",
    signer: {
        type: "api-key",
    },
});

const balances = await treasuryWallet.balances(["usdc"]);

Launching in Production

Enterprise feature. Contact us for access.
For production, the steps are almost identical, but some changes are required:
  1. Create a developer account on the production console
  2. Create a production client API key on the API Keys page with the API scopes wallets.read, wallets.create, wallets:transactions.create, wallets:transactions.sign, wallets:balance.read, wallets.fund
  3. Replace your test API key with the production key
  4. Discuss with your Crossmint Customer Success Engineering (CSE) team the best signer configuration for your expected usage, and recovery mechanisms

Learn More