Skip to content

Commit

Permalink
Merge branch 'improve-api-errors' into release-v2.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Jan 14, 2025
2 parents bdf560f + b27f2ff commit 4fb87a2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/utils/RestClient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,17 @@ const RestClient = async (chainId, restUrls, opts) => {
if (order)
searchParams.append('order_by', order);
return client.get(apiPath('tx', `txs?${searchParams.toString()}`), {
'axios-retry': { retries: retries },
'axios-retry': { retries: retries ?? config.retries },
...opts
}).then((res) => res.data);
}

function getTransaction(txHash) {
return client.get(apiPath('tx', `txs/${txHash}`)).then((res) => res.data);
function getTransaction(txHash, _opts) {
const { retries, ...opts } = _opts;
return client.get(apiPath('tx', `txs/${txHash}`), {
'axios-retry': { retries: retries ?? config.retries },
...opts
}).then((res) => res.data);
}

function getAccount(address) {
Expand Down Expand Up @@ -305,7 +309,7 @@ const RestClient = async (chainId, restUrls, opts) => {
}
await sleep(pollIntervalMs);
try {
const response = await getTransaction(txId);
const response = await getTransaction(txId, { retries: 0 });
const result = parseTxResult(response.tx_response)
return result
} catch {
Expand Down

0 comments on commit 4fb87a2

Please sign in to comment.