Migrate plugins to lib directory

This commit is contained in:
Josh Harvey 2017-04-15 19:12:29 +03:00
parent 09b29bba56
commit e7ab8223c2
27 changed files with 869 additions and 858 deletions

View file

@ -0,0 +1,17 @@
var BigNumber = require('bignumber.js')
var TEN = new BigNumber(10)
var UNIT_SCALES = {
BTC: 8,
ETH: 18
}
function unitScale (cryptoCoin) {
return UNIT_SCALES[cryptoCoin]
}
exports.toUnit = function toUnit (cryptoAtoms, cryptoCoin) {
var scale = TEN.pow(unitScale(cryptoCoin))
return cryptoAtoms.div(scale)
}