Skip to content

@armada/sdk / index / TokenBalance

Interface: TokenBalance ​

Defined in: src/sync/balances.ts:71

Per-token aggregated balance. tokenHash is the canonical 32-byte hash (no 0x); tokenAddress is its registered ERC-20 address, present for every registered token and undefined only for a hash absent from the SDK's token registry (see withTokenAddresses). computeBalances leaves tokenAddress unset — the aggregation is pure over hashes; the address is attached at a layer that holds the registry.

Properties ​

tokenHash ​

readonly tokenHash: string

Defined in: src/sync/balances.ts:72


tokenAddress? ​

readonly optional tokenAddress?: `0x${string}`

Defined in: src/sync/balances.ts:73


spendable ​

readonly spendable: bigint

Defined in: src/sync/balances.ts:74


spendableNotes ​

readonly spendableNotes: number

Defined in: src/sync/balances.ts:79

How many notes make up spendable. A spend's circuit shape depends on how many notes it spends, so a high count (a fragmented balance) is the cue to consolidate (wallet.consolidate).


pending ​

readonly pending: bigint

Defined in: src/sync/balances.ts:80


pendingSpent? ​

readonly optional pendingSpent?: bigint

Defined in: src/sync/balances.ts:87

Value of otherwise-spendable notes with an optimistic in-flight spend (a submitted, unconfirmed transaction). Kept OUT of spendable so a note is never offered for selection while a spend of it is already in flight, and surfaced here until the spend's Nullified event confirms (or the mark is cleared/expires). Present only when non-zero; treat absent as 0n.