Skip to content

Commit

Permalink
fixup! feat(suite): add timer to solana tx modal
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Feb 27, 2025
1 parent 14a4517 commit b5eca1d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ import { ReplaceByFeeFailedOriginalTxConfirmed } from '../UserContextModal/TxDet

const getTxValidityTimeoutInMs = (networkType?: NetworkType) => {
if (networkType === 'solana') {
return 40 * 1000; // 40 seconds
// Blockhash required in Solana tx is valid for 1 minute.
// However, usually tx fails even after elapsed 45 seconds, 40 seconds looks like safe time.
return 40 * 1000;
}

return 0;
Expand Down Expand Up @@ -147,8 +149,6 @@ export const TransactionReviewModalContent = ({
const timeLeft = Math.max(deadline - now, 0);
let mounted = true;

console.log(timeLeft);

const timeoutId = setTimeout(() => {
if (mounted && !isSending) {
TrezorConnect.cancel('tx-timeout');
Expand Down Expand Up @@ -199,7 +199,7 @@ export const TransactionReviewModalContent = ({
.find(type => type) || null;

const onCancel = () => {
if (isRbfConfirmedError || networkType === 'solana') {
if (isRbfConfirmedError || shouldCheckTxTimeValidity) {
dispatch(modalActions.onCancel());
}

Expand Down

0 comments on commit b5eca1d

Please sign in to comment.