Remove confirmation for terminated snaps (#14566)

feature/default_network_editable
Frederik Bolding 3 years ago committed by GitHub
parent 12cda5eb2d
commit b258cbafe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      app/scripts/metamask-controller.js

@ -1226,6 +1226,26 @@ export default class MetamaskController extends EventEmitter {
}); });
}, },
); );
this.controllerMessenger.subscribe(
`${this.snapController.name}:snapTerminated`,
(snapId) => {
const approvals = Object.values(
this.approvalController.state.pendingApprovals,
).filter(
(approval) =>
approval.origin === snapId &&
approval.type === MESSAGE_TYPE.SNAP_CONFIRM,
);
for (const approval of approvals) {
this.approvalController.reject(
approval.id,
new Error('Snap was terminated.'),
);
}
},
);
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
} }

Loading…
Cancel
Save