Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

erc20lookup

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erc20lookup

Lookup multiple ERC20 tokens' metadata

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 08 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc