Skip to content

Commit

Permalink
fix: check txn validity (aave#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jan 12, 2022
1 parent c5a3da6 commit d4311ce
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions src/components/TxConfirmationView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ export default function TxConfirmationView({
});
}
setLoadingTxData(false);
return true;
} catch (e) {
console.log('Error on txs loading', e);
setBackendNotAvailable(true);
setLoadingTxData(false);
return false;
}
};

Expand Down Expand Up @@ -305,18 +307,28 @@ export default function TxConfirmationView({
blockingError ||
boxDescription
}
onSubmitTransaction={() =>
sendEthTransaction(
actionTxData.unsignedData,
provider,
setActionTxData,
customGasPrice,
{
onExecution: onMainTxExecuted,
onConfirmation: onMainTxConfirmed,
}
)
}
onSubmitTransaction={async () => {
const success = await handleGetTxData();
if (success) {
return sendEthTransaction(
actionTxData.unsignedData,
provider,
setActionTxData,
customGasPrice,
{
onExecution: onMainTxExecuted,
onConfirmation: onMainTxConfirmed,
}
);
} else {
setActionTxData((state) => ({
...state,
txStatus: TxStatusType.error,
loading: false,
error: 'transaction no longer valid',
}));
}
}}
successButtonTitle={successButtonTitle}
goToAfterSuccess={goToAfterSuccess}
buttonTitle={buttonTitle || boxTitle}
Expand Down

0 comments on commit d4311ce

Please sign in to comment.