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: "base-sepolia",
    signer: {
        type: "external-wallet",
        address: "<your-eoa-address>",
    },
    owner: "COMPANY",
    alias: "treasury",
});

console.log(wallet.address);
Key Points:
  • The owner field must be set to "COMPANY" for treasury wallets to ensure the wallet appears under Company in the console
  • The signer must be a non-custodial type (external-wallet or passkey)
  • The alias field is set to "treasury" to identify this as your treasury wallet
3

Check treasury wallet balance

For newly created or unfunded wallets, the balance will be "0". This is expected behavior - you will need to fund the wallet before seeing a non-zero balance.
Retrieve the stablecoin balance of your treasury wallet:
index.ts

import { CrossmintWallets, createCrossmint } from "@crossmint/wallets-sdk";

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

const crossmintWallets = CrossmintWallets.from(crossmint);

const treasuryWallet = await crossmintWallets.getWallet("<your-wallet-address>", {
    chain: "base-sepolia",
    signer: {
        type: "external-wallet",
        address: "<your-eoa-address>",
    },
});

const balances = await treasuryWallet.balances(["usdc"]);
console.log(balances.usdc.amount);
4

Run the code

Execute your index.ts file using one of the following methods:Using ts-node:
npx ts-node index.ts
Or compile and run with Node.js:
npx tsc index.ts && node index.js
You should see the wallet address printed to the console after successful execution.
5

Verify in the console

After creating your treasury wallet, you can verify it was created correctly in the Crossmint Console:
  1. Navigate to Wallets in the left sidebar
  2. Click on the Company tab
  3. Your treasury wallet should appear in the list with the alias “treasury”

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