getMultichainTokenBalances: it batches every chain, every network, and every address into a single API call, so you avoid the N×M round-trip explosion of looping getTokenBalances (or getNativeBalance) over each wallet.
Why getMultichainTokenBalances
getMultichainTokenBalances accepts a list of balanceRequests. Each entry says: for this address on this chain, get the balances on these networks. The API fans out, dedups, and returns a single grouped result.
isNative, symbol, price, decimals, rawBalance, etc. — so a portfolio view never needs a second call for token metadata or prices. Use filterSpamTokens: true to drop airdrop spam server-side, and whitelistedContracts per request entry to pin specific tokens you care about.
Building the request from connected wallets
Group the user’s connectedwalletAccounts by chain, then collect the network IDs each address should query. getWalletAccounts is the source of truth — it includes both verified and unverified accounts, so filter on walletAccount.verifiedCredentialId if you only want verified ones.
- JavaScript
- React
Reading the response
The response is grouped by chain → network → balance rows. Each row carries the metadata you need to render a portfolio cell without a second fetch.Patterns
Pin specific tokens per chain
When you only care about a stablecoin or a handful of governance tokens, passwhitelistedContracts per request entry. The API skips the rest, response stays small.
Disable spam filtering for power-user views
filterSpamTokens: false returns the raw set, including airdrop spam. Use this on a “see all tokens” toggle, not in the default view.
Refresh on walletAccountsChanged
useWalletAccounts already covers this in React. For vanilla apps, subscribe via onEvent:
When NOT to use it
- You only need the native gas balance — use
getNativeBalancefor an RPC-direct read. - You have a single wallet on a single chain (one or more networks of that chain) and prefer the simpler call shape — use
getTokenBalances.
Related functions
- Getting Multichain Token Balances — full parameter reference
- Getting Wallet Accounts
- Getting Token Balances — token balances for a single chain (one or more networks)
- Getting Native Balance — native gas balance only