You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Use messenger for majority of Snaps RPC methods (#29970)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
## **Description**
This PR completes a refactor to use the messenger to replace the
majority of the method hooks used by Snaps RPC methods. This lets
consolidate implementations across both clients and reduces the
maintenance burden. There should be no functional difference to the
user.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
https://consensyssoftware.atlassian.net/browse/WPC-995
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Refactors Snaps RPC/permission wiring to rely on messenger calls and
updates Snap-related package versions, which could subtly change
authorization/unlock behavior or break Snap RPC methods if messenger
action contracts differ.
>
> **Overview**
> Refactors `snapMethodMiddlewareBuilder` and Snap permission
specifications to remove direct `Engine.context` hook usage and instead
rely on `controllerMessenger`/`initMessenger` (`waitUntil`, `call`) for
unlock state, keyring creation, and other Snap RPC hooks.
>
> Updates `permissionControllerInit` to stop injecting a
`KeyringController` client into Snap permission specs, removes the
legacy `getMnemonic` helper/tests, and adjusts Snap/BackgroundBridge
tests to mock the newer messenger APIs (e.g., `delegate`).
>
> Bumps `@metamask/snaps-controllers`, `@metamask/snaps-rpc-methods`,
and `@metamask/snaps-sdk` to newer versions.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
cecac79. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
from extension https://github.dev/MetaMask/metamask-extension/blob/1d5e8a78400d7aaaf2b3cbdb30cff9399061df34/app/scripts/metamask-controller.js#L3830-L3861
0 commit comments