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

getTokenBalance

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

getTokenBalances

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