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
| Parameter | Type | Description |
|---|---|---|
ctx | SDKContext | The SDK context. |
params | GetAccountTokenBalancesParams | The request-specific parameters. |
alchemyApiKey | string | The Alchemy API key. Required; throws ConfigError when empty. |
options | ReadExecutionOptions | Cancellation controls kept separate from collection filters. |
Returns
Promise<CollectionPage<TokenAmount>>
The token balances for the account in question.