fix: promise all array values and monero get_transfers arg

This commit is contained in:
José Oliveira 2022-07-21 10:22:24 +01:00
parent baf95b1e7c
commit bc1925a14c
5 changed files with 5 additions and 6 deletions

View file

@ -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))
}