Skip to content

chore: Update Core Platform / Wallet Integrations controllers to expose all methods through messenger#8201

Merged
Mrtenz merged 13 commits intomainfrom
mrtenz/wallet-integrations-action-methods
Mar 19, 2026
Merged

chore: Update Core Platform / Wallet Integrations controllers to expose all methods through messenger#8201
Mrtenz merged 13 commits intomainfrom
mrtenz/wallet-integrations-action-methods

Conversation

@Mrtenz
Copy link
Copy Markdown
Member

@Mrtenz Mrtenz commented Mar 16, 2026

Explanation

This updates the following controllers to expose all methods through the messenger in a standardised way:

  • PermissionController.
  • PermissionLogController.
  • SelectedNetworkController.
  • SubjectMetadataController.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes messenger action registration and exported action type surface for multiple controllers; consumers relying on old action types or unexposed actions may see TypeScript/API breakage despite deprecations.

Overview
Standardizes how PermissionController, SubjectMetadataController, PermissionLogController, and SelectedNetworkController expose public methods via the messenger by switching to registerMethodActionHandlers with explicit MESSENGER_EXPOSED_METHODS lists.

Adds auto-generated *-method-action-types.ts files and re-exports their strongly named ...Action types from package index.ts, while deprecating older action type aliases (e.g., GetPermissionControllerState, SelectedNetworkControllerGetSelectedNetworkStateAction).

Updates tests to invoke controllers through messenger calls (and adds minimal mocking for ApprovalController:addRequest), and adds a generate-method-action-types script plus tsx devDependency in affected packages.

Written by Cursor Bugbot for commit 7b70fe7. This will update automatically on new commits. Configure here.

@Mrtenz Mrtenz marked this pull request as ready for review March 16, 2026 13:14
@Mrtenz Mrtenz requested review from a team as code owners March 16, 2026 13:14
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments, but otherwise looks good to me.

Comment thread packages/permission-controller/src/index.ts Outdated
Comment thread packages/permission-controller/src/index.ts Outdated
Comment thread packages/permission-log-controller/src/index.ts Outdated
Comment thread packages/selected-network-controller/src/index.ts Outdated
@Mrtenz Mrtenz force-pushed the mrtenz/wallet-integrations-action-methods branch from 4d32eb4 to d9d6672 Compare March 17, 2026 11:55
mcmire
mcmire previously approved these changes Mar 17, 2026
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (well, aside from the conflicts)

type: typeof SelectedNetworkControllerActionTypes.setNetworkClientIdForDomain;
handler: SelectedNetworkController['setNetworkClientIdForDomain'];
};

export type SelectedNetworkControllerActions =
| SelectedNetworkControllerGetSelectedNetworkStateAction
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type should really be called SelectedNetworkControllerGetStateAction :( Oh well. Maybe we can fix this in another PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Had to fix conflicts anyway, so I fixed this type too.

@Mrtenz Mrtenz force-pushed the mrtenz/wallet-integrations-action-methods branch from d9d6672 to 3f90ef5 Compare March 18, 2026 12:55
… favor of `SelectedNetworkControllerGetStateAction`
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread packages/permission-controller/src/PermissionController.ts Outdated
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Mrtenz Mrtenz enabled auto-merge March 19, 2026 16:56
@Mrtenz Mrtenz added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit c92951f Mar 19, 2026
322 checks passed
@Mrtenz Mrtenz deleted the mrtenz/wallet-integrations-action-methods branch March 19, 2026 19:40
pull Bot pushed a commit to Reality2byte/core that referenced this pull request May 4, 2026
…enger (MetaMask#8675)

## Explanation
This exposes missing methods used in the clients through the messenger
after MetaMask#8201
## References
Progresses https://consensyssoftware.atlassian.net/browse/WPC-989

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this primarily expands the messenger-exposed API surface and
TypeScript action types without changing permission logic, but consumers
may start depending on these newly exposed actions.
> 
> **Overview**
> **Exposes additional `PermissionController` methods via the
messenger** by adding new action types and including them in the
controller’s `MESSENGER_EXPOSED_METHODS` allowlist.
> 
> Newly exposed actions include `acceptPermissionsRequest`,
`rejectPermissionsRequest`, `revokePermission`,
`updatePermissionsByCaveat`, and `getPermission`, with corresponding
exports from the package entrypoint and a changelog entry documenting
the additions.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
092f6a5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants