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: "<signer-type>",
    },
    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 balance of your treasury wallet:
index.ts
const wallet = await crossmintWallets.getWallet({
    chain: "<your-chain>",
    alias: "treasury",
});

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

console.log("Native token:", balances.nativeToken);
console.log("USDC:", balances.usdc);
console.log("All tokens:", balances.tokens);
The getWallet method uses the alias to locate your treasury wallet. You can query balances for specific tokens or all tokens in the wallet.

Launching in Production

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

Learn More