Skip to content

Commit

Permalink
cancelling transaction when user does not give dapp permission to tra…
Browse files Browse the repository at this point in the history
…nsfer funds (MetaMask#5115)
  • Loading branch information
tommasini authored Dec 15, 2022
1 parent 41dc517 commit 6387d1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/components/Views/ApproveView/Approve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,20 @@ class Approve extends PureComponent {
};

onCancel = () => {
const { TransactionController } = Engine.context;
TransactionController.cancelTransaction(this.props.transaction.id);
AnalyticsV2.trackEvent(
AnalyticsV2.ANALYTICS_EVENTS.APPROVAL_CANCELLED,
this.getAnalyticsParams(),
);
this.props.toggleApproveModal(false);

NotificationManager.showSimpleNotification({
status: `simple_notification_rejected`,
duration: 5000,
title: strings('notifications.approved_tx_rejected_title'),
description: strings('notifications.wc_description'),
});
};

review = () => {
Expand Down
1 change: 1 addition & 0 deletions locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,7 @@
"wc_signed_rejected_title": "You've rejected the sign request",
"wc_signed_failed_title": "This sign request failed",
"wc_sent_tx_rejected_title": "You've rejected the transaction request",
"approved_tx_rejected_title": "You've rejected granting permission",
"wc_description": "Please check the application"
},
"protect_your_wallet_modal": {
Expand Down

0 comments on commit 6387d1b

Please sign in to comment.