Skip to content

API ReferenceTokens and balancesFunction

getAccountTokenBalances()

function getAccountTokenBalances(
ctx,
params,
alchemyApiKey,
options?
): Promise<CollectionPage<TokenAmount>>;

Fetches the current token balances for the configured account via the Alchemy token balances API.

Unlike the rest of the SDK’s core actions, this one requires an Alchemy API key the caller supplies directly — AnvilDependencies has no Alchemy configuration seam, so there is no sdk.tokens module method for this; call it standalone. TokenModule.getAccountBalance (sdk.tokens.getAccountBalance) reads one token’s balance without Alchemy, for callers that don’t need every token an account holds.

Parameters

ParameterTypeDescription
ctxSDKContextThe SDK context.
paramsGetAccountTokenBalancesParamsThe request-specific parameters.
alchemyApiKeystringThe Alchemy API key. Required; throws ConfigError when empty.
optionsReadExecutionOptionsCancellation controls kept separate from collection filters.

Returns

Promise<CollectionPage<TokenAmount>>

The token balances for the account in question.