Get available tokens
getTokens
Retrieves a list of all available tokens on specified chains.
Parameters
client(SDKClient): The SDK client instance.params(TokensRequest, optional): Configuration for the requested tokens.chains((ChainId | ChainKey)[], optional): List of chain IDs or keys. If not specified, returns tokens on all available chains.chainTypes(ChainType[], optional): List of chain types.extended(boolean, optional): Whentrue, returnsTokensExtendedResponsewith additional token data. Default:false.minPriceUSD(number, optional): Minimum USD price filter for returned tokens.orderBy(TokensSortOrder, optional): Sort order for the token list.limit(number, optional): Maximum number of tokens to return.search(string, optional): Search query to filter tokens by name or symbol.tags(TokenTag[], optional): Filter tokens by tags.
options(RequestOptions, optional): Additional request options.
TokensResponse, or TokensExtendedResponse when extended: true is set.
Example
getToken
Fetches details about a specific token on a specified chain.
Parameters
client(SDKClient): The SDK client instance.chain(ChainKey | ChainId): ID or key of the chain that contains the token.token(string): Address or symbol of the token on the requested chain.options(RequestOptions, optional): Additional request options.
TokenExtended object.
Example
Get token balance
Please ensure that you configure the SDK with EVM/Solana providers first. They are required to use this functionality. Additionally, it is recommended to provide your private RPC URLs, as public ones are used by default and may rate limit you for multiple requests, such as getting the balance of multiple tokens at once. Read more Configure SDK Providers.getTokenBalance
Returns the balance of a specific token a wallet holds.
Parameters
client(SDKClient): The SDK client instance.walletAddress(string): A wallet address.token(Token): A Token object.
TokenAmount or null.
Example
getTokenBalances
Returns the balances for a list of tokens a wallet holds.
Parameters
client(SDKClient): The SDK client instance.walletAddress(string): A wallet address.tokens(Token[]): A list of Token objects.
TokenAmount objects.
Example
getTokenBalancesByChain
Queries the balances of tokens for a specific list of chains for a given wallet.
Parameters
client(SDKClient): The SDK client instance.walletAddress(string): A wallet address.tokensByChain([chainId: number]: Token[]): A list of Token objects organized by chain IDs.
Example
getWalletBalances
Returns the balances of tokens a wallet holds across EVM chains using the LI.FI API.
Parameters
client(SDKClient): The SDK client instance.walletAddress(string): A wallet address.options(RequestOptions, optional): Additional request options.
Record<number, WalletTokenExtended[]> — token balances organized by chain ID.
Example
Managing token allowance
Token allowance and approval functionalities are specific to EVM (Ethereum Virtual Machine) chains. It allows smart contracts to interact with ERC-20 tokens by approving a certain amount of tokens that a contract can spend from the user’s wallet. Please ensure that you configure the SDK with the EVM provider. It is required to use this functionality. Read more Configure SDK Providers.Token allowance functions are exported from
@lifi/sdk-provider-ethereum package. Make sure to install and import from the correct package.getTokenAllowance
Fetches the current allowance for a specific token.
Parameters
client(SDKClient): The SDK client instance.token(BaseToken): The token for which to check the allowance.ownerAddress(string): The owner of the token.spenderAddress(string): The spender address that was approved.
bigint representing the allowance or undefined if the token is a native token.
Example
getTokenAllowanceMulticall
Fetches the current allowance for a list of token/spender address pairs.
Parameters
client(SDKClient): The SDK client instance.ownerAddress(string): The owner of the tokens.tokens(TokenSpender[]): A list of token and spender address pairs.
TokenAllowance objects.
Example
setTokenAllowance
Sets the token allowance for a specific token and spender address.
Parameters
client(SDKClient): The SDK client instance.request(ApproveTokenRequest): The approval request.walletClient(Client): The Viem client used to send the transaction.token(BaseToken): The token for which to set the allowance.spenderAddress(string): The address of the spender.amount(bigint): The amount of tokens to approve.
Hash representing the transaction hash or void if no transaction is needed (e.g., for native tokens).
Example
revokeTokenApproval
Revokes the token approval for a specific token and spender address.
Parameters
client(SDKClient): The SDK client instance.request(RevokeApprovalRequest): The revoke request.walletClient(Client): The Viem client used to send the transaction.token(BaseToken): The token for which to revoke the allowance.spenderAddress(string): The address of the spender.
Hash representing the transaction hash or void if no transaction is needed (e.g., for native tokens).
Example

