chore: update big number package
This commit is contained in:
parent
8aa18dd21c
commit
ea44478b48
30 changed files with 186 additions and 144 deletions
|
|
@ -30,7 +30,7 @@ function balance (account, cryptoCode, settings, operatorId) {
|
|||
})
|
||||
.then(({ data }) => {
|
||||
if (data.error) throw new Error(JSON.stringify(data.error))
|
||||
return BN(data.balance)
|
||||
return new BN(data.balance)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ function sendCoins (account, tx, settings, operatorId) {
|
|||
.then(({ data }) => {
|
||||
if (data.error && data.error.errorCode === 'sc-001') throw new E.InsufficientFundsError()
|
||||
else if (data.error) throw new Error(JSON.stringify(data.error))
|
||||
const fee = BN(data.fee).round()
|
||||
const fee = new BN(data.fee).decimalPlaces()
|
||||
const txid = data.txid
|
||||
return { txid, fee }
|
||||
})
|
||||
|
|
@ -74,8 +74,8 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
.then(() => axios.get(`/balance/${tx.toAddress}?cryptoCode=${tx.cryptoCode}`))
|
||||
.then(({ data }) => {
|
||||
if (data.error) throw new Error(JSON.stringify(data.error))
|
||||
const confirmed = BN(data.confirmedBalance)
|
||||
const pending = BN(data.pendingBalance)
|
||||
const confirmed = new BN(data.confirmedBalance)
|
||||
const pending = new BN(data.pendingBalance)
|
||||
if (confirmed.gte(requested)) return { receivedCryptoAtoms: confirmed, status: 'confirmed' }
|
||||
if (pending.gte(requested)) return { receivedCryptoAtoms: pending, status: 'authorized' }
|
||||
if (pending.gt(0)) return { receivedCryptoAtoms: pending, status: 'insufficientFunds' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue