import { ChainId, Token } from "@onyxcoindev/sdk-core-test"; import { ICache } from "./cache"; import { ITokenProvider, TokenAccessor, TokenList } from "./token-provider"; /** * Provider for getting token data from a Token List. * * @export * @interface ITokenListProvider */ export interface ITokenListProvider { hasTokenBySymbol(_symbol: string): Promise; getTokenBySymbol(_symbol: string): Promise; hasTokenByAddress(address: string): Promise; getTokenByAddress(address: string): Promise; } export declare class CachingTokenListProvider implements ITokenProvider, ITokenListProvider { private tokenCache; private CACHE_KEY; private chainId; private tokenList; /** * Creates an instance of CachingTokenListProvider. * Token metadata (e.g. symbol and decimals) generally don't change so can be cached indefinitely. * * @param tokenList The token list to get the tokens from. * @param tokenCache Cache instance to hold cached tokens. */ constructor(chainId: ChainId, tokenList: TokenList, tokenCache: ICache); static fromTokenListURI(chainId: ChainId, tokenListURI: string, tokenCache: ICache): Promise; private static buildTokenList; static fromTokenList(chainId: ChainId, tokenList: TokenList, tokenCache: ICache): CachingTokenListProvider; /** * If no addresses array is specified, all tokens in the token list are * returned. * * @param _addresses (optional) The token addresses to get. * @returns Promise A token accessor with methods for accessing the tokens. */ getTokens(_addresses?: string[]): Promise; hasTokenBySymbol(_symbol: string): Promise; getTokenBySymbol(_symbol: string): Promise; hasTokenByAddress(address: string): Promise; getTokenByAddress(address: string): Promise; private buildToken; }