Skip to main content
Gets the current balance of the SparkWallet. You can use the forceRefetch option to synchronize your wallet and claim any pending incoming lightning payment, spark transfer, or bitcoin deposit before returning the balance.

Method Signature

async getBalance(): Promise<{
  balance: bigint;
  tokenBalances: Map<string, { balance: bigint, bech32mTokenIdentifier: string }>;
}>

Returns

balance
bigint
required
The wallet’s current balance in satoshis
tokenBalances
Map
required
Map of token public keys to token balances with Bech32m token identifiers

Example

const balance = await wallet.getBalance();
console.log("Balance:", balance.balance);
console.log("Token Balances:", balance.tokenBalances);