fix: move transaction hash fetching to the right place
This commit is contained in:
parent
7abc10b28e
commit
5095d66b49
1 changed files with 5 additions and 3 deletions
|
|
@ -59,6 +59,10 @@ function getAddressTransactionsHashes (receivingAddress, cryptoCode, client, wal
|
||||||
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, {
|
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, {
|
||||||
headers: authHeader
|
headers: authHeader
|
||||||
})
|
})
|
||||||
|
.then(_.flow(
|
||||||
|
_.get(['data', 'txHistory']),
|
||||||
|
_.map(_.get(['txHash']))
|
||||||
|
))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`)
|
console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`)
|
||||||
console.log(`** DEBUG ** Fetching transactions hashes via wallet node...`)
|
console.log(`** DEBUG ** Fetching transactions hashes via wallet node...`)
|
||||||
|
|
@ -70,9 +74,7 @@ function getTransactionHash (account, cryptoCode, receivingAddress, wallet) {
|
||||||
const client = getClient(account)
|
const client = getClient(account)
|
||||||
if (!_.includes(_.toUpper(cryptoCode), SUPPORTED_COINS) || _.isNil(client)) return Promise.resolve(null)
|
if (!_.includes(_.toUpper(cryptoCode), SUPPORTED_COINS) || _.isNil(client)) return Promise.resolve(null)
|
||||||
return getAddressTransactionsHashes(receivingAddress, cryptoCode, client, wallet)
|
return getAddressTransactionsHashes(receivingAddress, cryptoCode, client, wallet)
|
||||||
.then(({ data: { txHistory } }) => {
|
.then(txHashes => {
|
||||||
const txHashes = _.map(_.get(['txHash']), txHistory)
|
|
||||||
|
|
||||||
if (_.size(txHashes) > 1) {
|
if (_.size(txHashes) > 1) {
|
||||||
logger.warn('An address generated by this wallet was used in more than one transaction')
|
logger.warn('An address generated by this wallet was used in more than one transaction')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue