chore: update big number package
This commit is contained in:
parent
8aa18dd21c
commit
ea44478b48
30 changed files with 186 additions and 144 deletions
|
|
@ -70,7 +70,7 @@ function sendCoins (account, tx, settings, operatorId) {
|
|||
let fee = parseFloat(result.transfer.feeString)
|
||||
let txid = result.transfer.txid
|
||||
|
||||
return { txid: txid, fee: BN(fee).round() }
|
||||
return { txid: txid, fee: new BN(fee).decimalPlaces(0) }
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.message === 'insufficient funds') throw new E.InsufficientFundsError()
|
||||
|
|
@ -81,7 +81,7 @@ function sendCoins (account, tx, settings, operatorId) {
|
|||
function balance (account, cryptoCode, settings, operatorId) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => getWallet(account, cryptoCode))
|
||||
.then(wallet => BN(wallet._wallet.spendableBalanceString))
|
||||
.then(wallet => new BN(wallet._wallet.spendableBalanceString))
|
||||
}
|
||||
|
||||
function newAddress (account, info, tx, settings, operatorId) {
|
||||
|
|
@ -120,8 +120,8 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
it.type === 'receive'
|
||||
)
|
||||
|
||||
const sum = _.reduce((acc, val) => val.add(acc), BN(0))
|
||||
const toBn = _.map(it => BN(it.valueString))
|
||||
const sum = _.reduce((acc, val) => val.plus(acc), new BN(0))
|
||||
const toBn = _.map(it => new BN(it.valueString))
|
||||
|
||||
const confirmed = _.compose(sum, toBn, filterConfirmed)(transfers)
|
||||
const pending = _.compose(sum, toBn, filterPending)(transfers)
|
||||
|
|
@ -143,8 +143,8 @@ function newFunding (account, cryptoCode, settings, operatorId) {
|
|||
const fundingAddress = result.address
|
||||
return wallet.updateAddress({ address: fundingAddress, label: 'Funding Address' })
|
||||
.then(() => ({
|
||||
fundingPendingBalance: BN(wallet._wallet.balanceString),
|
||||
fundingConfirmedBalance: BN(wallet._wallet.confirmedBalanceString),
|
||||
fundingPendingBalance: new BN(wallet._wallet.balanceString),
|
||||
fundingConfirmedBalance: new BN(wallet._wallet.confirmedBalanceString),
|
||||
fundingAddress: getCashAddress(fundingAddress, cryptoCode)
|
||||
}))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue