Skip to main content
The Token Service provides functions for fetching and caching token information across supported chains. It uses the LI.FI API with built-in caching (30 minute TTL).

Exports


Functions

getTokens(chainId, cache?)

Fetch all available tokens for a specific chain.
Returns: TokensResponse Throws: TokenFetchError if API fails and no cache available. Example:

getBridgeableTokens(chainId, toChainId?, cache?)

Get tokens that can be bridged from a specific chain to HyperEVM.
Example:

getDestinationTokens()

Get tokens available on HyperEVM destination.
Returns: Array containing USDC and HYPE tokens on HyperEVM. Example:

getTokenByAddress(chainId, tokenAddress, cache?)

Get a specific token by its address.
Example:

invalidateTokenCache(chainId?, cache?)

Manually invalidate the token cache.
Example:

createTokenCache()

Factory function to create a new cache instance.
Example:

Types

TokensResponse

Token

TokenFetchError


Constants

NATIVE_TOKEN_ADDRESS

Address used to represent native tokens (ETH, MATIC, etc.).

HYPEREVM_USDC

Pre-defined USDC token on HyperEVM.

HYPEREVM_HYPE

Pre-defined HYPE native token on HyperEVM.

TokenCache Class

The TokenCache class manages caching for token data with a 30-minute TTL.

Methods

Example Usage


Common Patterns

Find Token by Symbol

Get Stablecoins