-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat: Add accepted
and rejected
events to ApprovalController
#5127
Conversation
@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.
|
type: `${typeof controllerName}:rejected`; | ||
payload: [ | ||
{ | ||
approval: ApprovalRequest<ApprovalRequestData>; |
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.
Would request
be more explicit here?
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.
Done
@@ -826,6 +832,15 @@ describe('approval controller', () => { | |||
|
|||
const result = await approvalPromise; | |||
expect(result).toBe('success'); | |||
|
|||
expect(acceptedEvent.mock.calls[0][0]).toEqual({ |
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.
For maintainability and modularity, should we have distinct tests to verify the events are fired?
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.
Done
445749e
Explanation
This PR introduces two new
ApprovalController
event which is emitted on theApproval
reject or accept actions.ApprovalController:accepted
ApprovalController:rejected
References
Need to be used in extension: MetaMask/metamask-extension#29656
Changelog
@metamask/approval-controller
accepted
andrejected
events.Checklist