Skip to content

This library is a list of tokens that exist on the ethereum mainnet, L2, and sidechain.

License

Notifications You must be signed in to change notification settings

asset-projects/token-list

Repository files navigation

@asset-projects/token-list

npmPackage size!License

Check Markdown links Tests release-please

This library maintains a list of ERC20 tokens that exist on the ethereum mainnet, L2 and sidechain.

It manages the main tokens and the top 100 or so tokens.

Support for Ethereum mainnet, optimistic-ethereum, arbitrum, polygon, and Other chains will be supported in the future.

Install on your project

  # npm
  npm i @asset-projects/token-list

  # yarn
  yarn add @asset-projects/token-list

How to Use

import { getTokenList } from '@asset-projects/token-list';

console.log(getTokenList(1).ERC20);
// [{"chainId": 1, "type": "ERC20", "address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "name": "Wrapped BTC", ...}]

console.log(getTokenList(1).ERC721);
// [{"chainId": 1, "type": "ERC721", "address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", "name": "Ethereum Name Service", ...}]

Other imports

import { tokens } from '@asset-projects/token-list';

console.log(tokens().filter((token) => token.chainId === 1 && token.symbol === 'DAI'));
// [
//   {
//     chainId: 1,
//     type: 'ERC20',
//     address: '0x6b175474e89094c44da98b954eedeac495271d0f',
//     name: 'Dai Stablecoin',
//     symbol: 'DAI',
//     decimals: 18,
//     logoURI: 'https://raw.githubusercontent.com/asset-projects/token-list/main/public/dai.png'
//   }
// ]

console.log(
  tokens().filter(
    (token) =>
      token.chainId === 1 && token.address === '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85', // ENS
  ),
);
// [
//   {
//     chainId: 1,
//     type: 'ERC721',
//     address: '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
//     name: 'Ethereum Name Service',
//     symbol: 'ENS',
//     logoURI: ''
//   }
// ]

License

MIT