fix: pending and confirmed address balance
This commit is contained in:
parent
63b0f01409
commit
873980869b
1 changed files with 4 additions and 1 deletions
|
|
@ -131,7 +131,10 @@ function newAddress (account, info, tx, settings, operatorId) {
|
||||||
function addressBalance (address, confirmations) {
|
function addressBalance (address, confirmations) {
|
||||||
return fetch('get_address_index', { address: address })
|
return fetch('get_address_index', { address: address })
|
||||||
.then(addressRes => fetch('get_balance', { account_index: addressRes.index.major, address_indices: [addressRes.index.minor] }))
|
.then(addressRes => fetch('get_balance', { account_index: addressRes.index.major, address_indices: [addressRes.index.minor] }))
|
||||||
.then(res => BN(_.find(it => it.address === address, res.per_subaddress).unlocked_balance))
|
.then(res => {
|
||||||
|
const addressInfo = _.find(it => it.address === address, res.per_subaddress)
|
||||||
|
return confirmations > 0 ? BN(addressInfo.unlocked_balance) : BN(addressInfo.balance)
|
||||||
|
})
|
||||||
.catch(err => handleError(err))
|
.catch(err => handleError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue