Skip to main content
Version: 11.x

Function: strk20Balances()

strk20Balances(walletWSF, tokens, valid_until?): Promise<STRK20_BALANCE_ENTRY[]>

Defined in: src/wallet/connectV6.ts:165

Get the private balances held by the user inside the STRK20 privacy pool.

Reading a shielded balance requires the user approval, and this approval is time limited: valid_until requests when it expires. When it is omitted, the wallet applies its own default window.

Parameters​

walletWSF​

WalletWithStarknetFeatures

The get-starknet V6 wallet object to use.

tokens​

string[]

The tokens to get the private balance of. An empty array returns every shielded token.

valid_until?​

number

Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.

Returns​

Promise<STRK20_BALANCE_ENTRY[]>

One entry per token.

Example​

const balances = await strk20Balances(walletWSF, [strkAddress]);
// balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]