Load Wallet Balances
To provide a better UX, you might want to work with the wallet's balances.
The LI.FI SDK also can query the balances of various tokens a wallet holds.

getTokenBalance

getTokenBalance = async (
walletAddress: string,
token: Token
): Promise<TokenAmount | null> => {}
This method returns the balances of a specific token a wallet holds across all chains we have aggregated.

getTokenBalances

getTokenBalances = async (
walletAddress: string,
tokens: Token[]
): Promise<TokenAmount[]> => {}
This method returns the balances for a list of tokens a wallet holds across all chains we have aggregated.
getTokenBalancesForChains
getTokenBalancesForChains = async (
walletAddress: string,
tokensByChain: { [chainId: number]: Token[] }
): Promise<{ [chainId: number]: TokenAmount[] }> => {}
This method queries the balances of tokens for a specific list of chains for a given wallet.
​
Copy link
Outline