Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #433 from hermeznetwork/fix-behavior-when-rejectin…
Browse files Browse the repository at this point in the history
…g-l1-tx-signing

Fix behavior when rejecting l1 tx signing
  • Loading branch information
elias-garcia authored Apr 21, 2021
2 parents 869ba26 + 281444c commit 6907574
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
20 changes: 16 additions & 4 deletions src/store/transaction/transaction.thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ function deposit (amount, account) {
.catch((error) => {
console.error(error)
dispatch(transactionActions.stopTransactionSigning())
dispatch(transactionActions.goToTransactionErrorStep())
// 4001 error code means that user denied tx signature
if (error.code !== 4001) {
dispatch(transactionActions.goToTransactionErrorStep())
}
})
}
}
Expand Down Expand Up @@ -267,7 +270,10 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith
}).catch((error) => {
console.error(error)
dispatch(transactionActions.stopTransactionSigning())
dispatch(transactionActions.goToTransactionErrorStep())
// 4001 error code means that user denied tx signature
if (error.code !== 4001) {
dispatch(transactionActions.goToTransactionErrorStep())
}
})
} else {
return Tx.delayedWithdraw(
Expand All @@ -289,7 +295,10 @@ function withdraw (amount, account, exit, completeDelayedWithdrawal, instantWith
.catch((error) => {
console.error(error)
dispatch(transactionActions.stopTransactionSigning())
dispatch(transactionActions.goToTransactionErrorStep())
// 4001 error code means that user denied tx signature
if (error.code !== 4001) {
dispatch(transactionActions.goToTransactionErrorStep())
}
})
}
}
Expand All @@ -311,7 +320,10 @@ function forceExit (amount, account) {
.catch((error) => {
console.error(error)
dispatch(transactionActions.stopTransactionSigning())
dispatch(transactionActions.goToTransactionErrorStep())
// 4001 error code means that user denied tx signature
if (error.code !== 4001) {
dispatch(transactionActions.goToTransactionErrorStep())
}
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/my-account/my-account.view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ function MyAccount ({
</div>
</div>
<div className={classes.settingContainer}>
<div className={classes.settingHeader}>
<div className={classes.settingHeader} onClick={onNavigateToForceExit}>
<ExitIcon />
<p className={classes.settingTitle} onClick={onNavigateToForceExit}>Force withdrawal</p>
<p className={classes.settingTitle}>Force withdrawal</p>
<p className={classes.settingSubTitle}>Forces the coordinator to process the transaction (more Gas is required).</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 6907574

Please sign in to comment.