Skip to main content
The token module fetches the JSON token list at network.tokenListUrl and caches it in memory for one day. Pool-state methods in the CPMM and CLMM modules use it to attach TokenInfo (symbol, decimals, logo) to both pool tokens.
cpmm.getPoolState and clmm.getPoolState throw if either pool token is missing from the token list. To work with unlisted tokens, point networkOverrides.tokenListUrl at a list that includes them, or read pool contracts directly through the contract artifacts.

TokenInfo

From @alephium/token-list:

Methods

getTokens()

Returns the cached list if it is fresh. Otherwise it fetches the list. If the fetch fails and a stale cache exists, the stale copy is returned (logged at info level). With no cache, the error is thrown.

getTokenById(id) / getTokenBySymbol(symbol)

Throw Unknown token, … not found in token list when no match exists. Symbols are matched case-sensitively, and the first match wins.

getTokenInfoBy(predicate)

fetchTokens()

Forces a refresh and replaces the cache. The payload is validated: it must be { tokens: TokenInfo[] } with string id, name, symbol, description, logoURI and an integer decimals in [0, 255]. Anything else is rejected.

Example