Exports
Functions
getTokens(chainId, cache?)
Fetch all available tokens for a specific chain.| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID to fetch tokens for |
cache | TokenCache | No | Optional cache instance |
TokensResponse
| Property | Type | Description |
|---|---|---|
tokens | Token[] | Array of tokens on the chain |
isStale | boolean | Whether data is from stale cache |
cachedAt | number | null | Timestamp when data was cached |
chainId | number | Chain ID for these tokens |
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.| Parameter | Type | Default | Description |
|---|---|---|---|
chainId | number | - | Source chain ID |
toChainId | number | 999 | Destination chain ID (HyperEVM) |
cache | TokenCache | - | Optional cache instance |
getDestinationTokens()
Get tokens available on HyperEVM destination.getTokenByAddress(chainId, tokenAddress, cache?)
Get a specific token by its address.| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
tokenAddress | string | Yes | Token contract address |
cache | TokenCache | No | Optional cache instance |
invalidateTokenCache(chainId?, cache?)
Manually invalidate the token cache.| Parameter | Type | Description |
|---|---|---|
chainId | number | Optional chain ID to invalidate (invalidates all if not provided) |
cache | TokenCache | Optional cache instance |
createTokenCache()
Factory function to create a new cache instance.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
TheTokenCache class manages caching for token data with a 30-minute TTL.
