From 5895342b32709464369f030da4ebb06f82c179c9 Mon Sep 17 00:00:00 2001 From: Elias Date: Wed, 21 Apr 2021 00:22:12 +0200 Subject: [PATCH 1/3] Fix redirecting to the transaction-error view when the user rejects L1 tx signing --- src/store/transaction/transaction.thunks.js | 20 +++++++++++++++---- .../transaction-overview.view.jsx | 6 ++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 02d1eddd2..0f78e65f2 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -219,7 +219,10 @@ function deposit (amount, account) { .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - dispatch(transactionActions.goToTransactionErrorStep()) + // 4001 erro code means that user denied tx signature + if (error.code !== 4001) { + dispatch(transactionActions.goToTransactionErrorStep()) + } }) } } @@ -267,7 +270,10 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith }).catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - dispatch(transactionActions.goToTransactionErrorStep()) + // 4001 erro code means that user denied tx signature + if (error.code !== 4001) { + dispatch(transactionActions.goToTransactionErrorStep()) + } }) } else { return Tx.delayedWithdraw( @@ -289,7 +295,10 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - dispatch(transactionActions.goToTransactionErrorStep()) + // 4001 erro code means that user denied tx signature + if (error.code !== 4001) { + dispatch(transactionActions.goToTransactionErrorStep()) + } }) } } @@ -311,7 +320,10 @@ function forceExit (amount, account) { .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - dispatch(transactionActions.goToTransactionErrorStep()) + // 4001 erro code means that user denied tx signature + if (error.code !== 4001) { + dispatch(transactionActions.goToTransactionErrorStep()) + } }) } } diff --git a/src/views/transaction/components/transaction-overview/transaction-overview.view.jsx b/src/views/transaction/components/transaction-overview/transaction-overview.view.jsx index 16538d528..05c32f0db 100644 --- a/src/views/transaction/components/transaction-overview/transaction-overview.view.jsx +++ b/src/views/transaction/components/transaction-overview/transaction-overview.view.jsx @@ -85,8 +85,8 @@ function TransactionOverview ({ * @returns {void} */ async function handleFormSubmit () { - setIsButtonDisabled(true) - + // We only need to disable the button on L2 txs, as L1 txs are going to display an + // spinner which will prevent the user from submitting the form twice switch (transactionType) { case TxType.Deposit: { return onDeposit(amount, account) @@ -98,9 +98,11 @@ function TransactionOverview ({ return onWithdraw(amount, account, exit, completeDelayedWithdrawal, instantWithdrawal) } case TxType.Exit: { + setIsButtonDisabled(true) return onExit(amount, account, fee) } default: { + setIsButtonDisabled(true) return onTransfer(amount, account, to, fee) } } From d30c534be79ada99436ef0e96ea58fd1049a3445 Mon Sep 17 00:00:00 2001 From: Elias Date: Wed, 21 Apr 2021 00:22:39 +0200 Subject: [PATCH 2/3] Fix onClick event listener for the force exit button --- src/views/my-account/my-account.view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/my-account/my-account.view.jsx b/src/views/my-account/my-account.view.jsx index cf39da297..8ddbc0927 100644 --- a/src/views/my-account/my-account.view.jsx +++ b/src/views/my-account/my-account.view.jsx @@ -101,9 +101,9 @@ function MyAccount ({
-
+
-

Force withdrawal

+

Force withdrawal

Forces the coordinator to process the transaction (more Gas is required).

From 281444c2aa1dba7e92e8b3a7061ee38c6740d4f7 Mon Sep 17 00:00:00 2001 From: Elias Date: Wed, 21 Apr 2021 00:23:48 +0200 Subject: [PATCH 3/3] Fix typo in the new comments --- src/store/transaction/transaction.thunks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 0f78e65f2..1237917cc 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -219,7 +219,7 @@ function deposit (amount, account) { .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - // 4001 erro code means that user denied tx signature + // 4001 error code means that user denied tx signature if (error.code !== 4001) { dispatch(transactionActions.goToTransactionErrorStep()) } @@ -270,7 +270,7 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith }).catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - // 4001 erro code means that user denied tx signature + // 4001 error code means that user denied tx signature if (error.code !== 4001) { dispatch(transactionActions.goToTransactionErrorStep()) } @@ -295,7 +295,7 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - // 4001 erro code means that user denied tx signature + // 4001 error code means that user denied tx signature if (error.code !== 4001) { dispatch(transactionActions.goToTransactionErrorStep()) } @@ -320,7 +320,7 @@ function forceExit (amount, account) { .catch((error) => { console.error(error) dispatch(transactionActions.stopTransactionSigning()) - // 4001 erro code means that user denied tx signature + // 4001 error code means that user denied tx signature if (error.code !== 4001) { dispatch(transactionActions.goToTransactionErrorStep()) }