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: migrate EarnController to @metamask/messenger (#6445)
## Explanation
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
This PR migrates the `EarnController` class to the new
`@metamask/messenger` comm system, as opposed to the one exported from
`@metamask/base-controller`.
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
* Related to #5626
## 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/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Migrates `EarnController` from `RestrictedMessenger` to
`@metamask/messenger`, updates state metadata keys, and aligns tests,
configs, and docs.
>
> - **EarnController**:
> - Migrate messaging from `RestrictedMessenger` to
`@metamask/messenger` with new typed `Messenger` and `delegate` usage;
replace `messagingSystem` calls with `messenger.call/subscribe`.
> - Update imports to `@metamask/base-controller/next`.
> - Rename metadata key `anonymous` to `includeInDebugSnapshot` and
adjust values.
> - **Tests** (`packages/earn-controller/src/EarnController.test.ts`):
> - Switch to `@metamask/messenger` root and namespaced messengers;
update types; adjust `deriveStateFromMetadata` selector to
`includeInDebugSnapshot`.
> - **Package/Config**:
> - Add dependency `@metamask/messenger` and TS project references.
> - **Docs**:
> - Update dependency graph in `README.md` to link `earn_controller` →
`messenger` and add `eip_7702_internal_rpc_middleware` →
`controller_utils`.
> - **Changelog**:
> - Note breaking changes: new `Messenger` requirement and metadata key
rename.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ba9bcec. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
0 commit comments