Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more

balance-crypto

Vulnerabilities Version Last commit Minified size Downloads GitHub Workflow Status Codecov

Get wallet balance for 2000+ cryptos with a unified interface.

Comparison to crypto-balances-2:

  • πŸ” API keys support (for EtherScan and BlockCypher)
  • πŸ’™ written in TypeScript
  • ⚑ uses node-fetch instead of deprecated request
  • πŸ“¦ smaller library size

Install

# pnpm
pnpm i balance-crypto
# yarn
yarn add balance-crypto
# npm
npm i balance-crypto

Example

import { balance } from 'balance-crypto'
import fetch from 'node-fetch'

// Fetch polyfill
globalThis.fetch = fetch

balance('3PxedDftWBXujWtr7TbWQSiYTsZJoMD8K5', 'BTC', {
  keys: {
    etherscan: process.env.ETHERSCAN_KEY,
    blockcypher: process.env.BLOCKYCPHER_KEY
  },
  verbose: true
}).then((res) => console.log(res))

Result:

{ "balance": 0, "asset": "BTC" }

Supported cryptos

Asset Service API key
ETH, ERC-20 tokens https://etherscan.io βœ”οΈ
BTC, DASH, LTC, DOGE https://blockcypher.com βœ”οΈ (optional)
BTC-based tokens https://chainz.cryptoid.info
ADA https://explorer.cardano.org