moar coinUtils fixes
This commit is contained in:
parent
5a26f718c5
commit
5987f288a7
3 changed files with 18 additions and 13 deletions
|
|
@ -40,13 +40,15 @@ function fetchMachines () {
|
|||
}
|
||||
|
||||
function computeCrypto (cryptoCode, _balance) {
|
||||
const unitScale = coinUtils.coins[cryptoCode].unitScale
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
const unitScale = cryptoRec.unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).round(5)
|
||||
}
|
||||
|
||||
function computeFiat (rate, cryptoCode, _balance) {
|
||||
const unitScale = coinUtils.coins[cryptoCode].unitScale
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
const unitScale = cryptoRec.unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).mul(rate).round(5)
|
||||
}
|
||||
|
|
@ -59,9 +61,11 @@ function getFunding (_cryptoCode) {
|
|||
const cryptoCode = _cryptoCode || cryptoCodes[0]
|
||||
const fiatCode = config.fiatCurrency
|
||||
const pareCoins = c => _.includes(c.cryptoCode, cryptoCodes)
|
||||
const cryptoDisplays = _.filter(pareCoins, coinUtils.cryptoDisplays)
|
||||
const cryptoCurrencies = coinUtils.cryptoCurrencies()
|
||||
const cryptoDisplays = _.filter(pareCoins, cryptoCurrencies)
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
|
||||
if (!coinUtils.coins[cryptoCode]) throw new Error(`Unsupported coin: ${cryptoCode}`)
|
||||
if (!cryptoRec) throw new Error(`Unsupported coin: ${cryptoCode}`)
|
||||
|
||||
const promises = [
|
||||
wallet.newFunding(settings, cryptoCode),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue