chore: update big number package
This commit is contained in:
parent
8aa18dd21c
commit
ea44478b48
30 changed files with 186 additions and 144 deletions
|
|
@ -14,7 +14,7 @@ let t0
|
|||
function _balance (cryptoCode) {
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
const unitScale = cryptoRec.unitScale
|
||||
return BN(10).shift(unitScale).round()
|
||||
return new BN(10).shiftedBy(unitScale).decimalPlaces(0)
|
||||
}
|
||||
|
||||
function balance (account, cryptoCode, settings, operatorId) {
|
||||
|
|
@ -24,7 +24,7 @@ function balance (account, cryptoCode, settings, operatorId) {
|
|||
|
||||
function pendingBalance (account, cryptoCode) {
|
||||
return balance(account, cryptoCode)
|
||||
.then(b => b.mul(1.1))
|
||||
.then(b => b.times(1.1))
|
||||
}
|
||||
|
||||
function confirmedBalance (account, cryptoCode) {
|
||||
|
|
@ -36,7 +36,7 @@ let sendCount = 100
|
|||
|
||||
function isInsufficient (cryptoAtoms, cryptoCode) {
|
||||
const b = _balance(cryptoCode)
|
||||
return cryptoAtoms.gt(b.div(1000).mul(sendCount))
|
||||
return cryptoAtoms.gt(b.div(1000).times(sendCount))
|
||||
}
|
||||
|
||||
function sendCoins (account, tx, settings, operatorId) {
|
||||
|
|
@ -52,7 +52,7 @@ function sendCoins (account, tx, settings, operatorId) {
|
|||
|
||||
console.log('[%s] DEBUG: Mock wallet sending %s cryptoAtoms to %s',
|
||||
cryptoCode, cryptoAtoms.toString(), toAddress)
|
||||
return resolve({ txid: '<txHash>', fee: BN(0) })
|
||||
return resolve({ txid: '<txHash>', fee: new BN(0) })
|
||||
}, 2000)
|
||||
})
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
const { toAddress, cryptoCode } = tx
|
||||
const elapsed = Date.now() - t0
|
||||
|
||||
if (elapsed < PUBLISH_TIME) return Promise.resolve({ receivedCryptoAtoms: BN(0), status: 'notSeen' })
|
||||
if (elapsed < PUBLISH_TIME) return Promise.resolve({ receivedCryptoAtoms: new BN(0), status: 'notSeen' })
|
||||
if (elapsed < AUTHORIZE_TIME) return Promise.resolve({ receivedCryptoAtoms: requested, status: 'published' })
|
||||
if (elapsed < CONFIRM_TIME) return Promise.resolve({ receivedCryptoAtoms: requested, status: 'authorized' })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue