feat(wallet)!: wire LoggingController into default initialization#9378
Open
grypez wants to merge 3 commits into
Open
feat(wallet)!: wire LoggingController into default initialization#9378grypez wants to merge 3 commits into
LoggingController into default initialization#9378grypez wants to merge 3 commits into
Conversation
259c830 to
d3d3caf
Compare
Wire `LoggingController` into the default wallet initialization so that `LoggingController:getState`, `LoggingController:add`, and `LoggingController:clear` are exposed on the shared messenger bus. The controller's construction is identical across extension and mobile — it takes only `messenger` and `state` and delegates no external actions/events — so no injectable `instanceOptions` are required. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d3d3caf to
58e804b
Compare
…ontroller # Conflicts: # packages/wallet/CHANGELOG.md # packages/wallet/package.json # yarn.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Wire
LoggingControllerinto the default@metamask/walletinitialization sothat its actions and events are exposed on the shared messenger bus:
LoggingController:getState/:stateChange,LoggingController:add, andLoggingController:clear.@metamask/walletis the shared controller-integration layer adopted byextension, mobile, and other clients, so any constructor value that differs
between clients must be an injectable
instanceOptionsrather than hardcoded.For
LoggingControllerthere is nothing to inject: both clients construct itwith only
messengerandstate, and it delegates no external actions/events.It therefore wires up as a plain namespaced child messenger with no
instanceOptionsslot.Per-environment options
{ messenger, state }only{ messenger, state }onlyThere are no injectable options. The extension additionally registers a
runtime.onInstalledlistener that emits a version-update log; that isclient-side glue around construction (not a controller constructor option) and
stays in the extension's own adoption layer.
References
Checklist
LoggingControllerthrough@metamask/walletyet; adoption PRs follow separately)Note
Medium Risk
Marked breaking for
@metamask/walletconsumers because default initialization and wallet state shape gainLoggingController; scope is limited to standard controller wiring with tests and no injectable options.Overview
Breaking:
@metamask/walletnow initializesLoggingControllerby default alongside the other bundled controllers, exposingLoggingController:getState,:stateChange,:add, and:clearon the wallet messenger.The wiring follows the same pattern as controllers like
AddressBookController: a newlogging-controllerinitialization instance constructs the controller frommessengerandstateonly, with noinstanceOptionsslot.@metamask/logging-controlleris added as a direct dependency; TypeScript project references, README dependency graph, and CODEOWNERS for the init path are updated accordingly.Integration is covered by unit tests on the init module and new
Wallettests for default state, constructorstate.LoggingController, and routingLoggingController:addthrough the wallet messenger.Reviewed by Cursor Bugbot for commit bc4dab4. Bugbot is set up for automated code reviews on this repo. Configure here.