From 55a8109646e0cdf2a480f22fa4e947efe8883151 Mon Sep 17 00:00:00 2001 From: samuelea Date: Tue, 7 Oct 2025 15:41:00 -0400 Subject: [PATCH] enclosed fetchTransactionReceipt request in a try catch --- packages/connect/src/styles.ts | 4 +--- packages/connect/src/utils/transactions.ts | 17 +++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/connect/src/styles.ts b/packages/connect/src/styles.ts index c64720c19..2700224e8 100644 --- a/packages/connect/src/styles.ts +++ b/packages/connect/src/styles.ts @@ -2500,6 +2500,4 @@ export const styles = String.raw` --tw-gradient-to-position: 100%; } } -} - -` +}` diff --git a/packages/connect/src/utils/transactions.ts b/packages/connect/src/utils/transactions.ts index fd8847f3b..7111e9df1 100644 --- a/packages/connect/src/utils/transactions.ts +++ b/packages/connect/src/utils/transactions.ts @@ -214,20 +214,21 @@ export const waitForTransactionReceipt = async ({ let receipt: TransactionReceipt | undefined while (Date.now() - startTime < maxWaitTime && !receipt) { - const response = await indexerClient.fetchTransactionReceipt({ - txnHash - }) - - receipt = response.receipt + try { + const response = await indexerClient.fetchTransactionReceipt({ + txnHash, + maxBlockWait: 400 + }) - // Additional wait time between requests. fetchTransactionReceipt will wait for 400 blocks, but this could be short amount of time if the blocktime is very short - if (!receipt) { + receipt = response.receipt + } catch (e) { + // Wait a little bit between request in case of very small block times await new Promise(resolve => setTimeout(resolve, WAIT_TIME_BETWEEN_REQUESTS_MS)) } } if (!receipt) { - throw new Error('Timeout: Transaction receipt not found') + throw new Error('Transaction receipt not found') } if (confirmations) {