cryptocurrency-unit-convert
Cryptocurrency unit conversion utility.
Currently supports Bitcoin, Ethereum, Ripple, and Litecoin.
Getting Started
Install with npm
> npm install cryptocurrency-unit-convert --save
Require package into project
require('cryptocurrency-unit-convert')
There are 6 methods:
convertBTC(value, fromUnit, toUnit)
convertETH(value, fromUnit, toUnit)
convertXRP(value, fromUnit, toUnit)
convertLTC(value, fromUnit, toUnit)
convertDASH(value, fromUnit, toUnit)
convertZEC(value, fromUnit, toUnit)
Examples
const Units = require('cryptocurrency-unit-convert')
const convertedBTC = Units.convertBTC('1', 'satoshi', 'btc')
const convertedBTC = Units.convertBTC('1.5', 'btc', 'satoshi')
const convertedETH = Units.convertETH('1', 'wei', 'eth')
const convertedETH = Units.convertETH('1.5', 'eth', 'wei')
const convertedXRP = Units.convertXRP('1', 'drop', 'xrp')
const convertedXRP = Units.convertXRP('1.5', 'xrp', 'drop')
const convertedLTC = Units.convertLTC('1', 'photon', 'ltc')
const convertedLTC = Units.convertLTC('1.5', 'ltc', 'photon')
const convertedDASH = Units.convertDASH('1', 'duff', 'dash')
const convertedDASH = Units.convertDASH('1.5', 'dash', 'duff')
const convertedZEC = Units.convertZEC('1', 'zatoshi', 'zec')
const convertedZEC = Units.convertZEC('1.5', 'zec', 'zatoshi')
Units
Bitcoin
satoshi, bit, ubtc, mbtc, btc
Ethereum
wei, kwei, mwei, gwei, finney, eth
Ripple
drop, xrp
Litecoin
litoshi, photon, lite, ltc
Dash
duff, dash
Zcash
zatoshi, zec
Want more currencies?
Email mark@telx.tech with the currency name, units, and unit names or submit a pull request. Currency list can be found in Units.json
License
MIT (c) 2018 Mark Penovich