chore: add delay before fetching tx hash

This commit is contained in:
José Oliveira 2022-07-01 17:50:56 +01:00
parent 11e3793e6e
commit c6741bf33f

View file

@ -59,10 +59,12 @@ function getTransactionHash (account, cryptoCode, receivingAddress) {
const { apiVersion, authHeader } = client const { apiVersion, authHeader } = client
logger.info(`** DEBUG ** getTransactionHash ENDPOINT: https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`) logger.info(`** DEBUG ** getTransactionHash ENDPOINT: https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`)
return new Promise(resolve => {
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, { setTimeout(resolve, 5)
headers: authHeader
}) })
.then(axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, {
headers: authHeader
}))
.then(res => { .then(res => {
const data = res.data const data = res.data
if (_.size(data.txHistory) > 1) { if (_.size(data.txHistory) > 1) {