fix: increase tx timeout to 30s and show timeout msg

This commit is contained in:
Sebastian.Bor 2021-08-17 22:19:12 +02:00
parent 137321e7a3
commit 783a7eab0f
1 changed files with 21 additions and 5 deletions

View File

@ -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: (
<>
<ExplorerLink
address={txid}
type="transaction"
short
connection={connection}
/>
</>
),
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,