
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Formatting and value conversion for ethereum currencies.
This package is an alternative of https://github.com/ethereum/meteor-package-tools for node and the browser. The API is therefore as close as possible.
$ npm install --save ethtools
formatWei)Format a number of wei to another ether unit.
number : (String|Number|BN) - the number of wei to formatformat : (String) - the format see numeral.js for more examples (0,0.[00000000] $ by default)unit : (String) - any ethereum units see ethjs-unit supported units (ether by default)options : (Object) - a list of options. Currently supported options are:
etherSymbol : (String) - if unit is ether will use this symbol for the unit instead (Ξ by default)locale : (String) - a custom locale (en by default)import { formatBalance } from 'ethtools';
formatBalance('1000000000000000000');
// => 1.0 Ξ
Format a number using numeral.js formats.
this function is used internally by
formatBalance
number (String|Number|BN) - the number to formatformat (String) - the format see numeral.js for more examples| Number | Format | String |
|---|---|---|
| 1000.234 | $0,0.00 | Ξ1,000.23 |
| 1000.2 | 0,0[.]00 $ | 1,000.20 Ξ |
| 1001 | $ 0,0[.]00 | Ξ 1,001 |
| -1000.234 | ($0,0) | (Ξ1,000) |
| -1000.234 | $0.00 | -Ξ1000.23 |
| 1230974 | ($ 0.00 a) | Ξ 1.23 m |
unit (String) - any custom unit/currencies, will replace the $ signoptions : (Object) - a list of options. Currently supported options are:
etherSymbol : (String) - if unit is ether will use this symbol for the unit instead (Ξ by default)locale : (String) - a custom locale (en by default)import { formatNumber } from 'ethtools';
formatNumber('1000000000000000000', '0,0.0[00]');
// => 1,000,000,000,000,000,000.0
A proxy method to
toWeimethod of ethjs-unit
Promise-based helper to fetch current ether price information via cryptocompare.com public API
import { fetchPrices } from 'ethtools';
fetchPrices().then(({response, json }) => console.log(json));
// { BTC: 0.07353, USD: 297.5, EUR: 250.78 }
Simply clone the repo, npm install, and run npm test.
FAQs
Formatting and value conversion for ethereum currencies.
We found that ethtools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.