Skip to main content




Vulnerabilities Version Last commit Minified size Downloads GitHub Workflow Status Codecov

Get 2000+ ERC-20 token balances with JavaScript. Supports Node.js and Deno.

JSON file is generated using TokenLists endpoitns

Usage

Node.js

import { ERC20Balance } from 'erc20-balance'
import * as dotenv from '@tinyhttp/dotenv'
import fetch from 'node-fetch'

globalThis.fetch = fetch

dotenv.config()

ERC20Balance({
  addr: '0xD3B282e9880cDcB1142830731cD83f7ac0e1043f',
  coin: 'LINK',
  apiKey: process.env.ETHERSCAN_KEY
}).then((res) => console.log(res))

Deno

import { ERC20Balance } from 'https://deno.land/x/erc20_balance/mod.ts'

ERC20Balance({
  addr: '0xD3B282e9880cDcB1142830731cD83f7ac0e1043f',
  coin: 'LINK',
  apiKey: Deno.env.get('ETHERSCAN_KEY')
}).then((res) => console.log(res))