Merge pull request #1340 from josepfo/feat/get-tx-hashes-for-address

Feat/get tx hashes for address
This commit is contained in:
Rafael Taranto 2022-08-03 10:36:51 +01:00 committed by GitHub
commit 0cdd1d7801
10 changed files with 91 additions and 20 deletions

View file

@ -164,7 +164,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
return checkCryptoCode(cryptoCode)
.then(() => refreshWallet())
.then(() => fetch('get_address_index', { address: toAddress }))
.then(addressRes => fetch('get_transfers', { in: true, pool: true, account_index: addressRes.index.major, address_indices: [addressRes.index.minor] }))
.then(addressRes => fetch('get_transfers', { in: true, pool: true, account_index: addressRes.index.major, subaddr_indices: [addressRes.index.minor] }))
.then(transferRes => {
const confirmedToAddress = _.filter(it => it.address === toAddress, transferRes.in ?? [])
const pendingToAddress = _.filter(it => it.address === toAddress, transferRes.pool ?? [])
@ -235,6 +235,14 @@ function checkBlockchainStatus (cryptoCode) {
})
}
function getTxHashesByAddress (cryptoCode, address) {
checkCryptoCode(cryptoCode)
.then(() => refreshWallet())
.then(() => fetch('get_address_index', { address: address }))
.then(addressRes => fetch('get_transfers', { in: true, pool: true, pending: true, account_index: addressRes.index.major, subaddr_indices: [addressRes.index.minor] }))
.then(_.map(({ txid }) => txid))
}
module.exports = {
balance,
sendCoins,
@ -242,5 +250,6 @@ module.exports = {
getStatus,
newFunding,
cryptoNetwork,
checkBlockchainStatus
checkBlockchainStatus,
getTxHashesByAddress
}