Readonly
premiaFetches the current spot price of a given token in USD.
This function retrieves the spot price for a given token from the underlying data source. If the token's USD price is not available, an error is thrown. This function is cached for a minute to prevent frequent API calls.
An error if the USD price for the token is not found.
The address of the token for which to fetch the spot price.
A promise that resolves to the spot price of the token in USD.
Fetches information of a given token from subgraph, coingecko, or token contract.
Will throw an error if the token information cannot be fetched from either the subgraph, coingecko, or token contract.
The address of the token for which to fetch the detailed information.
A promise that resolves to an object containing the token's name, symbol, decimals, whether it's native or wrapped native, price in ETH and USD, address, and chain ID.
Fetches extended information of a given token from the subgraph.
The address of the token for which to fetch the extended information.
A promise that resolves to an object containing the extended information of the token.
Retrieves the information for a list of tokens given their details.
This function fetches information for multiple tokens specified by an array of token information objects. If subgraph querying is not skipped and fails, the function resorts to fetching token details directly.
Will throw an error if the subgraph fails to load.
An array of token information objects for which to fetch the token data.
A promise that resolves to an array containing the information of the specified tokens.
Retrieves the extended information for a list of tokens given their details.
This function fetches extended information for multiple tokens specified by an array of token information objects.
An array of token information objects for which to fetch the token data.
A promise that resolves to an array containing the extended information of the specified tokens.
Fetches minimal information of a given token including its symbol and decimals.
The address of the token for which to fetch the minimal information.
A promise that resolves to an object containing the token's address, symbol, and decimals.
Fetches information for multiple tokens given their addresses.
This function retrieves information for multiple tokens specified by an array of addresses. It uses caching with an hourly time to live to prevent frequent calls to the subgraph. If subgraph call fails, it switches to skip the subgraph and fetches the tokens' information directly.
An array of token addresses for which to fetch the information.
A promise that resolves to an array containing the information of the tokens.
Retrieves extended information of multiple tokens given their addresses.
An array of token addresses for which to fetch the extended information.
A promise that resolves to an array containing the extended information of the specified tokens.
Generated using TypeDoc
Represents a class for handling Token operations related to the subgraph.