chore: update big number package
This commit is contained in:
parent
8aa18dd21c
commit
ea44478b48
30 changed files with 186 additions and 144 deletions
|
|
@ -43,14 +43,14 @@ function computeCrypto (cryptoCode, _balance) {
|
|||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
const unitScale = cryptoRec.unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).round(5)
|
||||
return new BN(_balance).shiftedBy(-unitScale).decimalPlaces(5)
|
||||
}
|
||||
|
||||
function computeFiat (rate, cryptoCode, _balance) {
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
const unitScale = cryptoRec.unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).mul(rate).round(5)
|
||||
return new BN(_balance).shiftedBy(-unitScale).times(rate).decimalPlaces(5)
|
||||
}
|
||||
|
||||
function getFunding (_cryptoCode) {
|
||||
|
|
@ -75,7 +75,7 @@ function getFunding (_cryptoCode) {
|
|||
return Promise.all(promises)
|
||||
.then(([fundingRec, ratesRec]) => {
|
||||
const rates = ratesRec.rates
|
||||
const rate = (rates.ask.add(rates.bid)).div(2)
|
||||
const rate = (rates.ask.plus(rates.bid)).div(2)
|
||||
const fundingConfirmedBalance = fundingRec.fundingConfirmedBalance
|
||||
const fiatConfirmedBalance = computeFiat(rate, cryptoCode, fundingConfirmedBalance)
|
||||
const pending = fundingRec.fundingPendingBalance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue