From 4b604ba6981b81abd0ecf120d4dfc77181a809a1 Mon Sep 17 00:00:00 2001 From: Neal Date: Fri, 28 Jan 2022 20:16:56 -0500 Subject: [PATCH 1/2] fix: monero bn methods --- lib/plugins/wallet/monerod/monerod.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/wallet/monerod/monerod.js b/lib/plugins/wallet/monerod/monerod.js index 37d46a77..afd395a7 100644 --- a/lib/plugins/wallet/monerod/monerod.js +++ b/lib/plugins/wallet/monerod/monerod.js @@ -92,7 +92,7 @@ function accountBalance (cryptoCode) { .then(() => refreshWallet()) .then(() => fetch('get_balance', { account_index: 0, address_indices: [0] })) .then(res => { - return BN(res.unlocked_balance).shift(unitScale).round() + return BN(res.unlocked_balance).shiftedBy(unitScale).round() }) .catch(err => handleError(err)) } @@ -177,7 +177,7 @@ function newFunding (account, cryptoCode) { fetch('create_address', { account_index: 0 }) ])) .then(([balanceRes, addressRes]) => ({ - fundingPendingBalance: BN(balanceRes.balance).sub(balanceRes.unlocked_balance), + fundingPendingBalance: BN(balanceRes.balance).minus(balanceRes.unlocked_balance), fundingConfirmedBalance: BN(balanceRes.unlocked_balance), fundingAddress: addressRes.address })) From 1c3c3f84ff08f2f790bf3d04a92a8991b2d2198d Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Mon, 31 Jan 2022 09:40:29 -0500 Subject: [PATCH 2/2] Update lib/plugins/wallet/monerod/monerod.js Co-authored-by: chaotixkilla --- lib/plugins/wallet/monerod/monerod.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/wallet/monerod/monerod.js b/lib/plugins/wallet/monerod/monerod.js index afd395a7..3b85088c 100644 --- a/lib/plugins/wallet/monerod/monerod.js +++ b/lib/plugins/wallet/monerod/monerod.js @@ -92,7 +92,7 @@ function accountBalance (cryptoCode) { .then(() => refreshWallet()) .then(() => fetch('get_balance', { account_index: 0, address_indices: [0] })) .then(res => { - return BN(res.unlocked_balance).shiftedBy(unitScale).round() + return BN(res.unlocked_balance).shiftedBy(unitScale).decimalPlaces(0) }) .catch(err => handleError(err)) }