Support ZEC
This commit is contained in:
parent
9b51565303
commit
45e6e2b82d
10 changed files with 105 additions and 47 deletions
|
|
@ -1,17 +1,27 @@
|
|||
var BigNumber = require('bignumber.js')
|
||||
const BigNumber = require('bignumber.js')
|
||||
|
||||
var TEN = new BigNumber(10)
|
||||
const coinUtils = require('../../coin-utils')
|
||||
|
||||
var UNIT_SCALES = {
|
||||
BTC: 8,
|
||||
ETH: 18
|
||||
const TEN = new BigNumber(10)
|
||||
|
||||
const PAIRS = {
|
||||
BTC: {
|
||||
USD: 'XXBTZUSD',
|
||||
EUR: 'XXBTZEUR'
|
||||
},
|
||||
ETH: {
|
||||
USD: 'XETHZUSD',
|
||||
EUR: 'XETHZEUR'
|
||||
},
|
||||
ZEC: {
|
||||
USD: 'XZECZUSD',
|
||||
EUR: 'XZECZEUR'
|
||||
}
|
||||
}
|
||||
|
||||
function unitScale (cryptoCoin) {
|
||||
return UNIT_SCALES[cryptoCoin]
|
||||
}
|
||||
module.exports = {PAIRS, toUnit}
|
||||
|
||||
exports.toUnit = function toUnit (cryptoAtoms, cryptoCoin) {
|
||||
var scale = TEN.pow(unitScale(cryptoCoin))
|
||||
function toUnit (cryptoAtoms, cryptoCoin) {
|
||||
var scale = TEN.pow(coinUtils.unitScale(cryptoCoin))
|
||||
return cryptoAtoms.div(scale)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue