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

balence

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

balence

Simple way to check ether balance of an account address.

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
0
Weekly downloads
 
Created
Source

eth-balance

Simple way to check ether balance of an account address.

License NPM version

Install

npm install eth-balance

Getting started

Check ether balance on mainnet:

const getBalance = require('eth-balance')

const balance = await getBalance('0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1')

console.log(balance) // 0.1

Check ether balance on different network:

const getBalance = require('eth-balance')

const balance = await getBalance('0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1', 'rinkeby')

console.log(balance) // 0.297098768

Check balance in wei output:

const getBalance = require('eth-balance')

const balance = await getBalance({
  address: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1',
  network: 'rinkeby',
  convert: 'wei'
})

console.log(balance) // 297098768000000000

example

CLI

Install:

npm install -g eth-balance

Check ether balance on mainnet:

$ eth_balance 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1

0.1

Check ether balance on different network:

$ eth_balance 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --network rinkeby

0.297098768

Check balance in wei output:

$ eth_balance 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --network rinkeby --convert wei

297098768000000000

Piping address example:

$ echo 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 | eth_balance -n rinkeby -c wei

297098768000000000

Show help:

$ eth_balance --help

  Simple way to check ether balance.

  Usage
  $ eth_balance [address] --network <network>

  Options
    --address, -a Address to check balance
    --network, -n Network name or network provider URI (default "mainnet")
    --convert, -c Unit to convert to (default "ether")

  Examples
  $ eth_balance 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --network rinkeby

  0.297098768

  $ eth_balance 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --network rinkeby --convert wei

  297098768000000000

Test

npm test

License

MIT

Keywords

FAQs

Package last updated on 31 Oct 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