fix: get subaddress unlocked balance

This commit is contained in:
Sérgio Salgado 2022-02-14 19:12:21 +00:00
parent 7c5cc3ff21
commit 63b0f01409

View file

@ -131,7 +131,7 @@ function newAddress (account, info, tx, settings, operatorId) {
function addressBalance (address, confirmations) {
return fetch('get_address_index', { address: address })
.then(addressRes => fetch('get_balance', { account_index: addressRes.index.major, address_indices: [addressRes.index.minor] }))
.then(res => BN(res.unlocked_balance))
.then(res => BN(_.find(it => it.address === address, res.per_subaddress).unlocked_balance))
.catch(err => handleError(err))
}