-
-
Notifications
You must be signed in to change notification settings - Fork 255
fix: controller send transaction approved when user reject transaction in hardware devices. #7214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: controller send transaction approved when user reject transaction in hardware devices. #7214
Conversation
Updated the transaction approval logic to check the status of the transaction. If the transaction fails due to user rejection or other errors, it now publishes a failure message with the error details. This change improves error handling and user feedback during transaction processing.
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
Updated the transaction approval logic to differentiate between approved and failed transactions. If a transaction is not approved, a failure message is now published with relevant error details, improving error handling and user feedback during transaction processing.
| }); | ||
|
|
||
| if (approvalResult === ApprovalState.NotApproved) { | ||
| this.messenger.publish(`${controllerName}:transactionFailed`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already published in #failTransaction whenever the status is changed to failed.
So we can just check ApprovalState.Approved here instead, before publishing approved event.
This PR will fix some issue caused by user reject transaction in hardware wallet, which cause a lot of incorrect event log in segment.
Updated the transaction approval logic to check the status of the transaction. If the transaction fails due to user rejection or other errors, it now publishes a failure message with the error details. This change improves error handling and user feedback during transaction processing.
Explanation
References
Checklist
Note
Ensure post-approval emits transactionFailed (with error) instead of transactionApproved when the transaction ends in failed status (e.g., hardware wallet rejection).
packages/transaction-controller/src/TransactionController.ts):updatedTransactionMeta.status; iffailed, publish${controllerName}:transactionFailedwitherrormessage, else publish${controllerName}:transactionApproved.Written by Cursor Bugbot for commit e0caebb. This will update automatically on new commits. Configure here.