From b27f2ffa651668d8a24550be084debba6f73eb79 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 14 Jan 2025 20:56:23 +0000 Subject: [PATCH] Don't retry when polling for transaction after broadcast --- src/utils/RestClient.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils/RestClient.mjs b/src/utils/RestClient.mjs index 9627bc3..118c65e 100644 --- a/src/utils/RestClient.mjs +++ b/src/utils/RestClient.mjs @@ -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) { @@ -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 {