From caf2c83bfbbbdfc641b7b422971c4c9654a5247a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Mon, 15 Feb 2021 13:30:59 +0000 Subject: [PATCH] fix: move ETH pending balance fix to wallet --- lib/new-admin/funding.js | 4 +--- lib/plugins/wallet/geth/base.js | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/new-admin/funding.js b/lib/new-admin/funding.js index 3e34f3e9..9531a68b 100644 --- a/lib/new-admin/funding.js +++ b/lib/new-admin/funding.js @@ -51,9 +51,7 @@ function getSingleCoinFunding (settings, fiatCode, cryptoCode) { const rate = (rates.ask.add(rates.bid)).div(2) const fundingConfirmedBalance = fundingRec.fundingConfirmedBalance const fiatConfirmedBalance = computeFiat(rate, cryptoCode, fundingConfirmedBalance) - const pending = cryptoCode === 'ETH' - ? fundingRec.fundingPendingBalance - fundingRec.fundingConfirmedBalance - : fundingRec.fundingPendingBalance + const pending = fundingRec.fundingPendingBalance const fiatPending = computeFiat(rate, cryptoCode, pending) const fundingAddress = fundingRec.fundingAddress const fundingAddressUrl = coinUtils.buildUrl(cryptoCode, fundingAddress) diff --git a/lib/plugins/wallet/geth/base.js b/lib/plugins/wallet/geth/base.js index 0e8b8dfa..5d2ae84b 100644 --- a/lib/plugins/wallet/geth/base.js +++ b/lib/plugins/wallet/geth/base.js @@ -71,7 +71,10 @@ function balance (account, cryptoCode) { .then(() => pendingBalance(defaultAddress(account))) } -const pendingBalance = address => _balance(true, address) +const pendingBalance = address => { + const promises = [_balance(true, address), _balance(false, address)] + return Promise.all(promises).then(([pending, confirmed]) => pending - confirmed) +} const confirmedBalance = address => _balance(false, address) function _balance (includePending, address) {