Balance Lookups
Two Ways to Query Balances
Flow
Returns
Use when
SDK
Full flow
// Direct balance endpoint β returns full 3D array + approvals
const balanceDoc = await api.getBalanceByAddress('1', 'bb1...');
const balances = balanceDoc.balances;
// Returns: BalanceArray<bigint> β 3D array with amounts, tokenIds, ownershipTimesSimple flow
// Direct single-token endpoint β returns just the amount
const res = await api.getBalanceByAddressSpecificToken('1', '5', 'bb1...');
console.log(res.balance); // e.g. 100n
// With a specific ownership time (milliseconds since epoch)
// Note: this queries the token's ownership time ranges, NOT historical chain state.
// Ownership times define WHEN a balance is valid (e.g., a token valid from JanβMar 2025).
const res = await api.getBalanceByAddressSpecificToken('1', '5', 'bb1...', undefined, { time: 1700000000000n });
// If you already have a balances array, use the helpers directly
import { getBalanceForIdNow, getBalanceForIdAndTime } from 'bitbadgesjs-sdk';
const amount = getBalanceForIdNow(5n, balances);
const historicalAmount = getBalanceForIdAndTime(5n, 1700000000000n, balances);API
Full flow
Simple flow
MCP Tools
Full flow
Simple flow
Chain CLI
Full flow
Simple flow
When to Use Which
Last updated