From 783a7eab0fae8333cfca26348846b84203fa8e45 Mon Sep 17 00:00:00 2001 From: "Sebastian.Bor" Date: Tue, 17 Aug 2021 22:19:12 +0200 Subject: [PATCH] fix: increase tx timeout to 30s and show timeout msg --- packages/common/src/contexts/connection.tsx | 26 +++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/common/src/contexts/connection.tsx b/packages/common/src/contexts/connection.tsx index 0fb18df..5791b44 100644 --- a/packages/common/src/contexts/connection.tsx +++ b/packages/common/src/contexts/connection.tsx @@ -398,6 +398,26 @@ export const sendTransaction = async ( console.error('getErrorForTransaction() error', ex); } + if ('timeout' in confirmationStatus.err) { + notify({ + message: `Transaction hasn't been confirmed within ${ + DEFAULT_TIMEOUT / 1000 + }s. Please check on Solana Explorer`, + description: ( + <> + + + ), + type: 'warn', + }); + throw new TransactionTimeoutError(txid); + } + notify({ message: 'Transaction error', description: ( @@ -416,10 +436,6 @@ export const sendTransaction = async ( type: 'error', }); - if ('timeout' in confirmationStatus.err) { - throw new TransactionTimeoutError(txid); - } - throw new SendTransactionError( `Transaction ${txid} failed (${JSON.stringify(confirmationStatus)})`, txid, @@ -480,7 +496,7 @@ export const getUnixTs = () => { return new Date().getTime() / 1000; }; -const DEFAULT_TIMEOUT = 15000; +const DEFAULT_TIMEOUT = 30000; export async function sendSignedTransaction({ signedTransaction,