> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spark.money/llms.txt
> Use this file to discover all available pages before exploring further.

# getBalance

> Get wallet balance in sats and token balances with metadata.

Gets the current balance of the `SparkWallet`, including Bitcoin balance and token balances.

## Method Signature

```typescript theme={null}
async getBalance(): Promise<{
  /** @deprecated Use satsBalance.available instead */
  balance: bigint;
  satsBalance: {
    available: bigint;
    owned: bigint;
    incoming: bigint;
  };
  tokenBalances: TokenBalanceMap;
}>

// TokenBalanceMap = Map<Bech32mTokenIdentifier, { ownedBalance: bigint, availableToSendBalance: bigint, tokenMetadata: UserTokenMetadata }>

interface UserTokenMetadata {
  rawTokenIdentifier: Uint8Array; // Binary token identifier used to encode the bech32m identifier
  tokenPublicKey: string;         // Issuer's public key
  tokenName: string;
  tokenTicker: string;
  decimals: number;               // Number of decimal places
  maxSupply: bigint;
  extraMetadata?: Uint8Array;     // Arbitrary bytes set by the issuer
}
```

## Returns

<ResponseField name="balance" type="bigint" required>
  <Warning>**Deprecated** — Use `satsBalance.available` instead.</Warning>
  The wallet's immediately spendable balance in satoshis. Kept for backwards compatibility.
</ResponseField>

<ResponseField name="satsBalance" type="object" required>
  Breakdown of the sats balance by status:

  * `available`: Immediately spendable satoshis
  * `owned`: All satoshis owned (available + locked in outgoing transfers/swaps)
  * `incoming`: Pending inbound transfers not yet claimed
</ResponseField>

<ResponseField name="tokenBalances" type="TokenBalanceMap" required>
  Map of Bech32m token identifiers to token balance and metadata objects. Each token balance contains:

  * `ownedBalance`: Total tokens owned (including those pending in outbound transfers)
  * `availableToSendBalance`: Tokens available to send (excludes pending outbound transfers)
  * `tokenMetadata`: Token metadata including name, ticker, decimals, etc.
</ResponseField>

<Note>
  The `ownedBalance` represents all tokens you own, while `availableToSendBalance` excludes tokens that are locked in pending outbound transfers. Use `availableToSendBalance` to determine how many tokens can be sent.
</Note>

## Example

```typescript theme={null}
const { satsBalance, tokenBalances } = await wallet.getBalance();
console.log("Available:", satsBalance.available);
console.log("Owned:", satsBalance.owned);
console.log("Incoming:", satsBalance.incoming);

// Iterate over token balances
for (const [tokenId, info] of tokenBalances) {
  console.log(`Token ${tokenId}:`);
  console.log(`  Owned: ${info.ownedBalance}`);
  console.log(`  Available to send: ${info.availableToSendBalance}`);
  console.log(`  Name: ${info.tokenMetadata.tokenName}`);
  console.log(`  Ticker: ${info.tokenMetadata.tokenTicker}`);
  console.log(`  Decimals: ${info.tokenMetadata.decimals}`);

  // Check for extra metadata
  if (info.tokenMetadata.extraMetadata) {
    console.log(`  Extra metadata: ${info.tokenMetadata.extraMetadata.length} bytes`);
  }
}
```
