diff --git a/lib/cash-out/cash-out-helper.js b/lib/cash-out/cash-out-helper.js index 8a3a37cb..dc4597fd 100644 --- a/lib/cash-out/cash-out-helper.js +++ b/lib/cash-out/cash-out-helper.js @@ -16,7 +16,8 @@ function convertBigNumFields (obj) { return value.toString() } - if (_.includes(key, [ 'commissionPercentage', 'rawTickerPrice' ]) && value) { + // Only test isNil for these fields since the others should not be empty. + if (_.includes(key, [ 'commissionPercentage', 'rawTickerPrice' ]) && !_.isNil(value)) { return value.toString() } diff --git a/lib/plugins/wallet/mock-wallet/mock-wallet.js b/lib/plugins/wallet/mock-wallet/mock-wallet.js index eea9b3b4..abaff6f7 100644 --- a/lib/plugins/wallet/mock-wallet/mock-wallet.js +++ b/lib/plugins/wallet/mock-wallet/mock-wallet.js @@ -79,9 +79,9 @@ function newFunding (account, cryptoCode) { function getStatus (account, toAddress, cryptoAtoms, cryptoCode) { const elapsed = Date.now() - t0 - if (elapsed < PUBLISH_TIME) return Promise.resolve({ receivedCryptoAtoms: cryptoAtoms - 10, status: 'notSeen' }) - if (elapsed < AUTHORIZE_TIME) return Promise.resolve({ receivedCryptoAtoms: cryptoAtoms - 10, status: 'published' }) - if (elapsed < CONFIRM_TIME) return Promise.resolve({ receivedCryptoAtoms: null, status: 'authorized' }) + if (elapsed < PUBLISH_TIME) return Promise.resolve({ receivedCryptoAtoms: BN(0), status: 'notSeen' }) + if (elapsed < AUTHORIZE_TIME) return Promise.resolve({ receivedCryptoAtoms: cryptoAtoms, status: 'published' }) + if (elapsed < CONFIRM_TIME) return Promise.resolve({ receivedCryptoAtoms: cryptoAtoms, status: 'authorized' }) console.log('[%s] DEBUG: Mock wallet has confirmed transaction [%s]', cryptoCode, toAddress.slice(0, 5)) diff --git a/lib/wallet.js b/lib/wallet.js index 4fc8e0de..49124ef9 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -126,7 +126,7 @@ function getWalletStatus (settings, tx) { const fudgeFactor = fudgeFactorEnabled ? 10 : 0 const walletStatusPromise = fetchWallet(settings, tx.cryptoCode) - .then(r => r.wallet.getStatus(r.account, tx.toAddress, tx.cryptoAtoms.add(fudgeFactor), tx.cryptoCode)) + .then(r => r.wallet.getStatus(r.account, tx.toAddress, tx.cryptoAtoms.minus(fudgeFactor), tx.cryptoCode)) return Promise.all([ walletStatusPromise,