diff --git a/README.md b/README.md index 18ebe2c..7a2fd71 100644 --- a/README.md +++ b/README.md @@ -1,162 +1,47 @@ -## TokenList +# TokenList -## Aim +Get a list of top 50 ERC20 tokens of Homestead and Polygon Mainnet Chains. -- To make an npm package which would be published to `npmjs.com`. -- The entire package has to be written in typescript. -- Use the tool [tsdx](https://tsdx.io/) to get an initial setup. -(Sample npm packages written in typescript: Link1 | Link2) -- This package would point to the erc20 Contracts in different chains. -- Example usage - - ```ts - import { tokens } from "your-package"; +## Installation + +tokenlist is available on the npm registry. You can install it using the following command + +### Install using npm + +```bash + npm install @salik/tokenlist +``` +### Install using yarn + +```bash + yarn add @salik/tokenlist +``` +## Usage + +```ts + import { tokens } from "@salik/tokenlist"; const usdc = tokens.homestead.USDC; // This is a JS object - - console.log(usdc); // should return the following + + console.log(usdc); // will return the following // { // name: "USD Coin", // symbol: "USDC", - // address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + // address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" // } - - const wmatic = tokens[137].WMATIC; // Also chainId(s) are accepted and not just the name - - console.log(wmatic); // should return the following + + const wmatic = tokens[137].WMATIC; // Also chainId(s) are accepted + + console.log(wmatic); // will return the following // { // name: "Wrapped Matic", // symbol: "WMATIC", - // address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" + // address: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" // } - - // The format is tokens.name.symbol - // where the name is homestead or polygon - // Can also accept chainId - // And the token is symbol - - ``` - -- This package would exist to give users easy access to the tokens present in the blockchain while writing scripts. -- Network homestead and polygon required. Others optional. **Only mainnet chains required.** -- Top ten popular tokens required per network. Others optional. -- Avoid reduplication of code for each network. -- Code should be properly commented and maintainable - -## Submission - -- Go to [github.com/BuildBearLabs/TokenList](https://github.com/BuildBearLabs/TokenList). -- Star the repo. -- Fork the repo. -- Start from that code as a base and build up the project. -- Submit a PR. -- Fill this [form](https://forms.gle/SNUKga7Myk6rATpr7) - -## Takeaways - -- How to create a package in `npmjs.com`. -- How to write libraries in Typescript. -- Learning of good coding style and practices - -## TSDX User Guide - -Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it. - -> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`. - -> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript) - -### Commands - -TSDX scaffolds your new library inside `/src`. - -To run TSDX, use: - -```bash -npm start # or yarn start ``` -This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`. - -To do a one-off build, use `npm run build` or `yarn build`. - -To run tests, use `npm test` or `yarn test`. - -### Configuration - -Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly. - -#### Jest - -Jest tests are set up to run with `npm test` or `yarn test`. - -#### Bundle Analysis - -[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`. - -##### Setup Files - -This is the folder structure we set up for you: - -```txt -/src - index.tsx # EDIT THIS -/test - blah.test.tsx # EDIT THIS -.gitignore -package.json -README.md # EDIT THIS -tsconfig.json -``` - -#### Rollup - -TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details. - -#### TypeScript - -`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs. - -### Continuous Integration - -#### GitHub Actions - -Two actions are added by default: - -- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix -- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit) - -### Optimizations - -Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations: - -```js -// ./types/index.d.ts -declare var __DEV__: boolean; - -// inside your code... -if (__DEV__) { - console.log('foo'); -} -``` - -You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions. - -### Module Formats - -CJS, ESModules, and UMD module formats are supported. - -The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found. - -### Named Exports - -Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library. - -### Including Styles - -There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like. - -For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader. +## Demo -### Publishing to NPM +https://user-images.githubusercontent.com/51821965/197404721-b33571cd-81fa-418a-b7a0-ee6c632e73bf.mp4 -We recommend using [np](https://github.com/sindresorhus/np). +## Future Scope +- Will add more tokens and also a frontend dashboard to view all the tokens diff --git a/package.json b/package.json index 4dcbf2f..9095b36 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.0", + "version": "0.1.2", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -31,17 +31,17 @@ "singleQuote": true, "trailingComma": "es5" }, - "name": "tokenlist", - "author": "Emmanuel Antony", + "name": "@salik/tokenlist", + "author": "Mohammed Salik Mulla", "module": "dist/tokenlist.esm.js", "size-limit": [ { "path": "dist/tokenlist.cjs.production.min.js", - "limit": "10 KB" + "limit": "60 KB" }, { "path": "dist/tokenlist.esm.js", - "limit": "10 KB" + "limit": "60 KB" } ], "devDependencies": { diff --git a/src/index.ts b/src/index.ts index b6e9b85..e7d0aec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,14 @@ -export const sum = (a: number, b: number) => { - if ('development' === process.env.NODE_ENV) { - console.log('boop'); - } - return a + b; +/** + * @desc Entry point for accessing tokens of polygon and homestead mainnet chains +*/ + +import homestead from './mainnet-chains/homestead'; +import polygon from './mainnet-chains/polygon'; +import { Chain } from './utils/types'; + +const tokens: Chain = { + ...homestead, + ...polygon, }; + +export { tokens }; diff --git a/src/mainnet-chains/homestead.ts b/src/mainnet-chains/homestead.ts new file mode 100644 index 0000000..77c1b77 --- /dev/null +++ b/src/mainnet-chains/homestead.ts @@ -0,0 +1,264 @@ +import { Chain, Token } from '../utils/types'; + +const homesteadTokens: Token = { + ETH: { + name: 'Ethereum', + symbol: 'ETH', + address: '0x0000000000000000000000000000000000000000', + }, + USDT: { + name: 'Tether USD', + symbol: 'USDT', + address: '0xdac17f958d2ee523a2206206994597c13d831ec7', + }, + USDC: { + name: 'USD Coin', + symbol: 'USDC', + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + }, + BNB: { + name: 'Binance Coin', + symbol: 'BNB', + address: '0xb8c77482e45f1f44de1745f52c74426c631bdd52', + }, + BUSD: { + name: 'Binance USD', + symbol: 'BUSD', + address: '0x4fabb145d64652a948d72533023f6e7a623c7c53', + }, + MATIC: { + name: 'Matic Network', + symbol: 'MATIC', + address: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', + }, + DAI: { + name: 'Dai', + symbol: 'DAI', + address: '0x6b175474e89094c44da98b954eedeac495271d0f', + }, + HEX: { + name: 'HEX', + symbol: 'HEX', + address: '0x2b591e99afe9f32eaa6214f7b7629768c40eeb39', + }, + SHIB: { + name: 'Shiba Inu', + symbol: 'SHIB', + address: '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce', + }, + WBTC: { + name: 'Wrapped Bitcoin', + symbol: 'WBTC', + address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', + }, + UNI: { + name: 'Uniswap', + symbol: 'UNI', + address: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', + }, + STETH: { + name: 'Lido Staked Ether', + symbol: 'STETH', + address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', + }, + LEO: { + name: 'LEO Token', + symbol: 'LEO', + address: '0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3', + }, + LINK: { + name: 'Chainlink', + symbol: 'LINK', + address: '0x514910771af9ca656af840dff83e8264ecf986ca', + }, + FTT: { + name: 'FTX Token', + symbol: 'FTT', + address: '0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9', + }, + CRO: { + name: 'Crypto.com Coin', + symbol: 'CRO', + address: '0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b', + }, + QNT: { + name: 'Quant', + symbol: 'QNT', + address: '0x4a220e6096b25eadb88358cb44068a3248254675', + }, + APE: { + name: 'ApeCoin', + symbol: 'APE', + address: '0x4d224452801aced8b2f0aebe155379bb5d594381', + }, + HT: { + name: 'Huobi Token', + symbol: 'HT', + address: '0x6f259637dcd74c767781e37bc6133cd6a68aa161', + }, + FRAX: { + name: 'Frax', + symbol: 'FRAX', + address: '0x853d955acef822db058eb8505911ed77f175b99e', + }, + XCN: { + name: 'Chain', + symbol: 'XCN', + address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18', + }, + AAVE: { + name: 'Aave', + symbol: 'AAVE', + address: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', + }, + MANA: { + name: 'Decentraland', + symbol: 'MANA', + address: '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', + }, + SAND: { + name: 'The Sandbox', + symbol: 'SAND', + address: '0x3845badade8e6dff049820680d1f14bd3903a5d0', + }, + CHZ: { + name: 'Chiliz', + symbol: 'CHZ', + address: '0x3506424f91fd33084466f402d5d97f05f8e3b4af', + }, + MKR: { + name: 'Maker', + symbol: 'MKR', + address: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', + }, + TKX: { + name: 'Tokenize Xchange', + symbol: 'TKX', + address: '0x667102bd3413bfeaa3dffb48fa8288819e480a88', + }, + USDP: { + name: 'Pax Dollar', + symbol: 'USDP', + address: '0x8e870d67f660d95d5be530380d0ec0bd388289e1', + }, + OKB: { + name: 'OKB', + symbol: 'OKB', + address: '0x75231f58b43240c9718dd58b4967c5114342a86c', + }, + TUSD: { + name: 'TrueUSD', + symbol: 'TUSD', + address: '0x0000000000085d4780b73119b644ae5ecd22b376', + }, + BIT: { + name: 'BitDAO', + symbol: 'BIT', + address: '0x1a4b46696b2bb4794eb3d4c26f1c55f9170fa4c5', + }, + AXS: { + name: 'Axie Infinity', + symbol: 'AXS', + address: '0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', + }, + USDD: { + name: 'Decentralized USD', + symbol: 'USDD', + address: '0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6', + }, + SNX: { + name: 'Synthetix Network Token', + symbol: 'SNX', + address: '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', + }, + GRT: { + name: 'The Graph', + symbol: 'GRT', + address: '0xc944e90c64b2c07662a292be6244bdf05cda44a7', + }, + PAXG: { + name: 'PAX Gold', + symbol: 'PAXG', + address: '0x45804880de22913dafe09f4980848ece6ecbaf78', + }, + NEXO: { + name: 'NEXO', + symbol: 'NEXO', + address: '0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206', + }, + LDO: { + name: 'Lido DAO', + symbol: 'LDO', + address: '0x5a98fcbea516cf06857215779fd812ca3bef1b32', + }, + GT: { + name: 'Gatechain Token', + symbol: 'GT', + address: '0xe66747a101bff2dba3697199dcce5b743b454759', + }, + CRV: { + name: 'Curve DAO', + symbol: 'CRV', + address: '0xd533a949740bb3306d119cc777fa900ba034cd52', + }, + KAVA: { + name: 'Kava.io', + symbol: 'KAVA', + address: '0x0c356b7fd36a5357e5a017ef11887ba100c9ab76', + }, + ENJ: { + name: 'Enjin Coin', + symbol: 'ENJ', + address: '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c', + }, + BAT: { + name: 'Basic Attention', + symbol: 'BAT', + address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef', + }, + COMP: { + name: 'Compound', + symbol: 'COMP', + address: '0xc00e94cb662c3520282e6f5717214004a7f26888', + }, + CUSDT: { + name: 'cUSDT', + symbol: 'CUSDT', + address: '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9', + }, + '1INCH': { + name: '1inch', + symbol: '1INCH', + address: '0x111111111117dc0aa78b770fa6a738034120c302', + }, + CVX: { + name: 'Convex Finance', + symbol: 'CVX', + address: '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b', + }, + UST: { + name: 'Wrapped UST Token', + symbol: 'UST', + address: '0xa47c8bf37f92abed4a126bda807a7b7498661acd', + }, + ENS: { + name: 'Ethereum Name Service', + symbol: 'ENS', + address: '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', + }, + LRC: { + name: 'Loopring', + symbol: 'LRC', + address: '0xbbbbca6a901c926f240b89eacb641d8aec7aeafd', + }, +}; + +/** + * @desc Creates a mapping with chainIds with mainnet object, also name with mainnet object + */ +const homestead: Chain = { + homestead: homesteadTokens, + 1: homesteadTokens, +}; + +export default homestead; diff --git a/src/mainnet-chains/polygon.ts b/src/mainnet-chains/polygon.ts new file mode 100644 index 0000000..d92ebe6 --- /dev/null +++ b/src/mainnet-chains/polygon.ts @@ -0,0 +1,254 @@ +import { Chain, Token } from '../utils/types'; + +const polygonTokens: Token = { + WETH: { + name: 'Wrapped Ether', + symbol: 'WETH', + address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', + }, + USDT: { + name: '(PoS) Tether USD', + symbol: 'USDT', + address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', + }, + pUSDt: { + name: 'TetherToken', + symbol: 'pUSDt', + address: '0x170a18b9190669cda08965562745a323c907e5ec', + }, + BNB: { + name: 'BNB', + symbol: 'BNB', + address: '0x3BA4c387f786bFEE076A58914F5Bd38d668B42c3', + }, + USDC: { + name: 'USD Coin (PoS)', + symbol: 'USDC', + address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', + }, + BUSD: { + name: 'BUSD Token', + symbol: 'BUSD', + address: '0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39', + }, + MATIC: { + name: 'Matic Token', + symbol: 'MATIC', + address: '0x0000000000000000000000000000000000001010', + }, + DAI: { + name: '(PoS) Dai Stablecoin', + symbol: 'DAI', + address: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', + }, + WBTC: { + name: '(PoS) Wrapped BTC', + symbol: 'WBTC', + address: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', + }, + AVAX: { + name: 'Avalanche Token', + symbol: 'AVAX', + address: '0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b', + }, + UNI: { + name: 'Uniswap (PoS)', + symbol: 'UNI', + address: '0xb33eaad8d922b1083446dc23f610c2567fb5180f', + }, + LEO: { + name: 'Bitfinex LEO Token', + symbol: 'LEO', + address: '0x06d02e9d62a13fc76bb229373fb3bbbd1101d2fc', + }, + LINK: { + name: 'ChainLink Token', + symbol: 'LINK', + address: '0xb0897686c545045afc77cf20ec7a532e3120e0f1', + }, + CRO: { + name: 'Cronos Coin', + symbol: 'CRO', + address: '0xada58df0f643d959c2a47c9d4d4c1a4defe3f11c', + }, + APE: { + name: 'ApeCoin (PoS)', + symbol: 'APE', + address: '0xB7b31a6BC18e48888545CE79e83E06003bE70930', + }, + FRAX: { + name: 'Frax', + symbol: 'FRAX', + address: '0x45c32fa6df82ead1e2ef74d17b76547eddfaff89', + }, + AAVE: { + name: 'Aave (PoS)', + symbol: 'AAVE', + address: '0xd6df932a45c0f255f85145f286ea0b292b21c90b', + }, + HT: { + name: 'HuobiToken', + symbol: 'HT', + address: '0xfad65eb62a97ff5ed91b23afd039956aaca6e93b', + }, + SAND: { + name: 'SAND', + symbol: 'SAND', + address: '0xBbba073C31bF03b8ACf7c28EF0738DeCF3695683', + }, + MANA: { + name: 'Decentraland', + symbol: 'MANA', + address: '0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4', + }, + LDO: { + name: 'Lido DAO Token (PoS)', + symbol: 'LDO', + address: '0xc3c7d422809852031b44ab29eec9f1eff2a58756', + }, + THETA: { + name: 'Theta Token (PoS)', + symbol: 'THETA', + address: '0xb46e0ae620efd98516f49bb00263317096c114b2', + }, + CHZ: { + name: 'chiliZ', + symbol: 'CHZ', + address: '0xf1938ce12400f9a761084e7a80d37e732a4da056', + }, + MKR: { + name: 'Maker', + symbol: 'MKR', + address: '0x6f7C932e7684666C9fd1d44527765433e01fF61d', + }, + PAX: { + name: 'Paxos Standard', + symbol: 'PAX', + address: '0x6f3b3286fd86d8b47ec737ceb3d0d354cc657b3e', + }, + TUSD: { + name: 'TrueUSD', + symbol: 'TUSD', + address: '0x2e1ad108ff1d8c782fcbbb89aad783ac49586756', + }, + USDD: { + name: 'Decentralized USD (PoS)', + symbol: 'USDD', + address: '0xffa4d863c96e743a2e1513824ea006b8d0353c57', + }, + GRT: { + name: 'Graph Token', + symbol: 'GRT', + address: '0x5fe2b58c013d7601147dcdd68c143a77499f5531', + }, + SNX: { + name: 'Synthetix Network Token (PoS)', + symbol: 'SNX', + address: '0x50b728d8d964fd00c2d0aad81718b71311fef68a', + }, + FTM: { + name: 'Fantom Token', + symbol: 'FTM', + address: '0xc9c1c1c20b3658f8787cc2fd702267791f224ce1', + }, + NEXO: { + name: 'Nexo', + symbol: 'NEXO', + address: '0x41b3966b4ff7b427969ddf5da3627d6aeae9a48e', + }, + PAXG: { + name: 'Paxos Gold', + symbol: 'PAXG', + address: '0x553d3d295e0f695b9228246232edf400ed3560b5', + }, + CRV: { + name: 'CRV (PoS)', + symbol: 'CRV', + address: '0x172370d5cd63279efa6d502dab29171933a610af', + }, + ENJ: { + name: 'EnjinCoin', + symbol: 'ENJ', + address: '0x7ec26842f195c852fa843bb9f6d8b583a274a157', + }, + BAT: { + name: 'BAT', + symbol: 'BAT', + address: '0x3cef98bb43d732e2f285ee605a8158cde967d219', + }, + RPL: { + name: 'Rocket Pool', + symbol: 'RPL', + address: '0x7205705771547cf79201111b4bd8aaf29467b9ec', + }, + FXS: { + name: 'Frax Share', + symbol: 'FXS', + address: '0x1a3acf6d19267e2d3e7f898f42803e90c9219062', + }, + CEL: { + name: 'Celsius', + symbol: 'CEL', + address: '0xd85d1e945766fea5eda9103f918bd915fbca63e6', + }, + WOO: { + name: 'Wootrade Network', + symbol: 'WOO', + address: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603', + }, + AMP: { + name: 'Amp', + symbol: 'AMP', + address: '0x0621d647cecbfb64b79e44302c1933cb4f27054d', + }, + '1INCH': { + name: '1INCH Token', + symbol: '1INCH', + address: '0x9c2c5fd7b07e95ee044ddeba0e97a665f142394f', + }, + COMP: { + name: '(PoS) Compound', + symbol: 'COMP', + address: '0x8505b9d2254a7ae468c0e9dd10ccea3a837aef5c', + }, + UST: { + name: 'Wrapped UST Token', + symbol: 'UST', + address: '0x692597b009d13c4049a947cab2239b7d6517875f', + }, + HOT: { + name: 'HoloToken', + symbol: 'HOT', + address: '0x0c51f415cf478f8d08c246a6c6ee180c5dc3a012', + }, + GUSD: { + name: 'Gemini dollar', + symbol: 'GUSD', + address: '0xc8a94a3d3d2dabc3c1caffffdca6a7543c3e3e65', + }, + LRC: { + name: 'LoopringCoin V2', + symbol: 'LRC', + address: '0x84e1670f61347cdaed56dcc736fb990fbb47ddc1', + }, + GNO: { + name: 'Gnosis', + symbol: 'GNO', + address: '0x5ffd62d3c3ee2e81c00a7b9079fb248e7df024a8', + }, + POLY: { + name: 'Polymath', + symbol: 'POLY', + address: '0xcb059c5573646047d6d88dddb87b745c18161d3b', + }, +}; + +/** + * @desc Creates a mapping with chainIds with mainnet object, also name with mainnet object + */ +const polygon: Chain = { + homestead: polygonTokens, + 137: polygonTokens, +}; + +export default polygon; diff --git a/src/utils/types.d.ts b/src/utils/types.d.ts new file mode 100644 index 0000000..fac891b --- /dev/null +++ b/src/utils/types.d.ts @@ -0,0 +1,14 @@ +// Interface for Token +export interface Token { + [key: string]: { + name: string; + symbol: string; + address: string; + }; +} + +// Type Alias for Chain +export type Chain = { + [key: string]: Token; + [key: number]: Token; +}; diff --git a/test/blah.test.ts b/test/blah.test.ts deleted file mode 100644 index 33c7ef5..0000000 --- a/test/blah.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { sum } from '../src'; - -describe('blah', () => { - it('works', () => { - expect(sum(1, 1)).toEqual(2); - }); -}); diff --git a/test/tokens.test.ts b/test/tokens.test.ts new file mode 100644 index 0000000..8c80ad2 --- /dev/null +++ b/test/tokens.test.ts @@ -0,0 +1,41 @@ +import { tokens } from '../src/index'; + +describe('tokens.Homestead.USDC ', () => { + it('Can access Homestead tokens by dot accessor', () => { + expect(tokens.homestead.USDC).toEqual({ + name: 'USD Coin ', + symbol: 'USDC', + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + }); + }); +}); + +describe('tokens[1].USDC ', () => { + it('Can access Homestead tokens by chainID', () => { + expect(tokens[1].USDC).toEqual({ + name: 'USD Coin ', + symbol: 'USDC', + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + }); + }); +}); + +describe('tokens.polygon.WMATIC ', () => { + it('Can access Polygin tokens by dot accessor', () => { + expect(tokens.polygon.WMATIC).toEqual({ + name: 'Wrapped Matic ', + symbol: 'WMATIC', + address: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', + }); + }); +}); + +describe('tokens[137].WMATIC ', () => { + it('Can access Polygin tokens by chainID', () => { + expect(tokens[137].WMATIC).toEqual({ + name: 'Wrapped Matic ', + symbol: 'WMATIC', + address: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', + }); + }); +});