Biconomy SDK
Search…
⌃K

Get Account Balances

Biconomy SDK provides indexer node out of the box as part of it's backend.
Once you spin up instance of the Smart Account, reading asset balances and their USD value across networks is as easy as below.
SDK supports balances of following tokens mentioned in repository specified below.
### we assume you already have instantiated smart wallet instance
import {BalancesDto } from '@biconomy/node-client'
import { ChainId } from '@biconomy/core-types'
const balanceParams: BalancesDto =
{
// if no chainId is supplied, SDK will automatically pick active one that
// is being supplied for initialization
chainId: ChainId.MAINNET, // chainId of your choice
eoaAddress: smartAccount.address,
// If empty string you receive balances of all tokens watched by Indexer
// you can only whitelist token addresses that are listed in token respostory
// specified above ^
tokenAddresses: [],
};
const balFromSdk = await smartAccount.getAlltokenBalances(balanceParams);
console.info("getAlltokenBalances", balFromSdk);
const usdBalFromSdk = await smartAccount.getTotalBalanceInUsd(balanceParams);
console.info("getTotalBalanceInUsd", usdBalFromSdk);