Merge pull request #1079 from naconner/monero-fix

fix: monero bn methods
This commit is contained in:
Rafael Taranto 2022-02-01 09:41:16 +00:00 committed by GitHub
commit 20ba336997

View file

@ -92,7 +92,7 @@ function accountBalance (cryptoCode) {
.then(() => refreshWallet()) .then(() => refreshWallet())
.then(() => fetch('get_balance', { account_index: 0, address_indices: [0] })) .then(() => fetch('get_balance', { account_index: 0, address_indices: [0] }))
.then(res => { .then(res => {
return BN(res.unlocked_balance).shift(unitScale).round() return BN(res.unlocked_balance).shiftedBy(unitScale).decimalPlaces(0)
}) })
.catch(err => handleError(err)) .catch(err => handleError(err))
} }
@ -177,7 +177,7 @@ function newFunding (account, cryptoCode) {
fetch('create_address', { account_index: 0 }) fetch('create_address', { account_index: 0 })
])) ]))
.then(([balanceRes, addressRes]) => ({ .then(([balanceRes, addressRes]) => ({
fundingPendingBalance: BN(balanceRes.balance).sub(balanceRes.unlocked_balance), fundingPendingBalance: BN(balanceRes.balance).minus(balanceRes.unlocked_balance),
fundingConfirmedBalance: BN(balanceRes.unlocked_balance), fundingConfirmedBalance: BN(balanceRes.unlocked_balance),
fundingAddress: addressRes.address fundingAddress: addressRes.address
})) }))