fix: promise all array values and monero get_transfers arg
This commit is contained in:
parent
baf95b1e7c
commit
bc1925a14c
5 changed files with 5 additions and 6 deletions
|
|
@ -132,7 +132,7 @@ function checkBlockchainStatus (cryptoCode) {
|
|||
function getTxHashesByAddress (cryptoCode, address) {
|
||||
checkCryptoCode(cryptoCode)
|
||||
.then(() => fetch('listreceivedbyaddress', [0, true, true, address]))
|
||||
.then(txsByAddress => Promise.all(_.forEach(id => fetch('getrawtransaction', [id]), _.head(txsByAddress).txids)))
|
||||
.then(txsByAddress => Promise.all(_.map(id => fetch('getrawtransaction', [id]), _.flatMap(it => it.txids, txsByAddress))))
|
||||
.then(_.map(({ hash }) => hash))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ function checkBlockchainStatus (cryptoCode) {
|
|||
function getTxHashesByAddress (cryptoCode, address) {
|
||||
checkCryptoCode(cryptoCode)
|
||||
.then(() => fetch('listreceivedbyaddress', [0, true, true, address]))
|
||||
.then(txsByAddress => Promise.all(_.forEach(id => fetch('getrawtransaction', [id]), _.head(txsByAddress).txids)))
|
||||
.then(txsByAddress => Promise.all(_.map(id => fetch('getrawtransaction', [id]), _.flatMap(it => it.txids, txsByAddress))))
|
||||
.then(_.map(({ hash }) => hash))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ function checkBlockchainStatus (cryptoCode) {
|
|||
function getTxHashesByAddress (cryptoCode, address) {
|
||||
checkCryptoCode(cryptoCode)
|
||||
.then(() => fetch('listreceivedbyaddress', [0, true, true, true, address]))
|
||||
.then(txsByAddress => Promise.all(_.forEach(id => fetch('getrawtransaction', [id]), _.head(txsByAddress).txids)))
|
||||
.then(txsByAddress => Promise.all(_.map(id => fetch('getrawtransaction', [id]), _.flatMap(it => it.txids, txsByAddress))))
|
||||
.then(_.map(({ hash }) => hash))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ?? [])
|
||||
|
|
@ -239,7 +239,7 @@ 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, address_indices: [addressRes.index.minor] }))
|
||||
.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))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,6 @@ function checkBlockchainStatus (cryptoCode) {
|
|||
function getTxHashesByAddress (cryptoCode, address) {
|
||||
checkCryptoCode(cryptoCode)
|
||||
.then(() => fetch('getaddresstxids', [address]))
|
||||
.then(_.values)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue