getWalletBalance is the fastest sanity check before createTransferOffer or createTokenStandardTransfer—confirm spendable headroom prior initiating outbound transfers.
Setup
import { Canton } from '@fairmint/canton-node-sdk';
const canton = new Canton({
network: 'devnet',
provider: '5n',
partyId: 'OWN_PARTY_ID',
});
Import and receiver
import { Canton } from '@fairmint/canton-node-sdk';
Receiver: canton.validator.getWalletBalance.
Minimal example
const balance = await canton.validator.getWalletBalance();
console.log(balance);
Parameters
None.
Returns
Wallet-internal JSON describing unlocked versus locked balances—exact numeric fields mirror Canton wallet OpenAPI snapshot bundled release-to-release (decimal strings for currency quantities).
Errors and pitfalls
- Premature calls before wallet provisioning finishes yield confusing zeros—always gate UX via
getUserStatus.
Auth and party
Bearer token authorizing wallet endpoints for configured Canton party context.
See also
Source
src/clients/validator-api/operations/v0/wallet/get-balance.ts on GitHub.