1.2.1 • Published 3 months ago

erc20lookup v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

ERC20Lookup

Lookup multiple ERC20 token's metadata and store it in contract.erc20 hash.

import { lookup } from 'erc20lookup';
import { ethers } from 'ethers'; // ethers v6 or v5 supported

const provider = new ethers.JsonRpcProvider('https://cloudflare-eth.com/v1/mainnet');
const usdt = new ethers.Contract('0xdAC17F958D2ee523a2206206994597C13D831ec7', ERC20_ABI, provider);
await lookup(provider, [ usdt ]);

console.log(usdt.erc20.symbol);
console.log(usdt.erc20.name);
console.log(usdt.erc20.decimals);

Usage

See test/erc20lookupTest.mjs

Deployments and networks

Deployment addresses are hardcoded inside index.mjs.

The following networks are currently supported:

chainIdNetworkAddress
0x01Ethereum0x6e7285c3E47c242e3aD62eDD5D0F19886F1e7ef0
0x89Polygon0xFe35BC1Ff694883dE8D31f3a87C5a668BCE765B0
0xa4b1Arbitrum0x2a20c66948373c7F619b32737c0bFa1dDa94E6E4
0x2105Base0x2C923114fC052D93BDda932DAe1a49668C17b0F0
0x38BNB0x9a8D6BB3c45E100c8456a8295C8b90b993bE20D4
43114Avalanche0xCbCB78054731a6FCCa53920959033810Ff0A7D1d
0xfaFantom0xD07b8Ddbb60aA59648F8697A2faCbDa4C8ed4994
0x0aOptimistic0xEF0Bb05F544b8540E538B958257C466dcB7347D0
0x4e454152Aurora0x48cF154a086bAB5492A8D150f4d87a74eCf90743
0xa0c71fdBlast Testnet (Sepolia)0x529dbe909c6461b6fa5cA85A52DCd09087182675
0x61BNB Testnet0x73E068e9c7ffc91F463ca5464E77E6826D84E3A5
0xaa36a7Ethereum Sepolia0x746418DB600352A808709f2048E797ab0918C581
0x05Goerli Testnet0x1a7f041dDC8919D26dB38E186E00e6E36dCCA0E6

Overriding contract address

Need to use your own deployment? Specify the contract address in the ERC20_LOOKUP_CONTRACT_ADDRESS env variable or supply it as a third argument to lookup:

await lookup(provider, [ usdt ], '0x....');

Ethers support

We support both v5 and v6, but none is listed in this module's dependencies. You'll have to install ethers manually to run tests:

npm install --no-save ethers

Tests

Node module tests

npm install --no-save ethers
npm run test

Solidity tests

npm install
hardhat test
1.2.1

3 months ago

1.2.0

4 months ago

1.1.1

9 months ago

1.1.0

10 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago