coingecko-tokens
Version:
Aggregated list of Token Lists from CoinGecko
34 lines (28 loc) • 987 B
text/typescript
import { getTokenList } from './getTokenList';
import type { TokenList } from './types';
export const UNISWAP_TOKEN_LIST = 'https://tokens-uniswap-org.ipns.dweb.link';
export const COINGECKO_TOKEN_API = 'https://tokens.coingecko.com';
export const COINGECKO_CHAINS: string[] = [
'uniswap',
'binance-smart-chain',
'arbitrum-one',
'optimistic-ethereum',
'polygon-pos',
'avalanche',
'xdai',
'base',
'unichain',
'ethereum-classic',
];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getCoingekoLists(fetchParams?: any): Promise<TokenList[]> {
return Promise.all(
COINGECKO_CHAINS.map((chain) => {
return getTokenList(`${COINGECKO_TOKEN_API}/${chain}/all.json`, fetchParams);
}),
);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getUniswapList(fetchParams?: any): Promise<TokenList> {
return getTokenList(UNISWAP_TOKEN_LIST, fetchParams);
}