Skip to main content
You can get the token balances for a wallet account by calling the getBalances function. This returns native and token balances for a single network, unlike getMultichainBalances which queries across multiple chains. If you only need the native token balance, use getBalance instead.

Usage

import { getBalances } from '@dynamic-labs-sdk/client';

const balances = await getBalances({ walletAccount });

With options

import { getBalances } from '@dynamic-labs-sdk/client';

const balances = await getBalances({
  walletAccount,
  networkId: 137,
  includePrices: true,
  includeNative: true,
  filterSpamTokens: true,
  forceRefresh: true,
  whitelistedContracts: ['0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'],
});

Parameters

ParameterTypeRequiredDescription
walletAccountWalletAccountYesThe wallet account to get the balances for
networkIdnumberNoThe network ID to query. Defaults to the active network
includePricesbooleanNoInclude token prices in the response
includeNativebooleanNoInclude the native token balance
filterSpamTokensbooleanNoFilter out spam tokens (default: true)
forceRefreshbooleanNoForce a refresh instead of using cached values
whitelistedContractsstring[]NoOnly return balances for these contract addresses

Response

Returns a Promise<TokenBalance[]> — an array of token balance objects.