-
-
Couldn't load subscription status.
- Fork 253
feat: New base-controller API
#6926
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
Conversation
096b17b to
f2a74d5
Compare
f2a74d5 to
0f304e9
Compare
next export of base-controller
next export of base-controllerbase-controller API
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.
LGTM!
Bug: Metadata Constraint Mismatch Causes Type IssuesThe |
Bug: Inconsistent Messenger Usage in BaseController MethodsThe |
0f304e9 to
955f43b
Compare
|
I have added |
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.
LGTM!
7811651
2735ccd to
61b5206
Compare
|
Rebased to resolve conflicts |
The `@metamask/base-controller` package has been updated to use the new API that had previously been exposed under the `next` export. Major changes include: - Remove `Messenger` and `RestrictedMessenger` - Replaced by the `@metamask/messenger` library - Update `BaseController` to require `@metamask/messenger` instance - Rename `anonymous` metadata property to `includeInDebugLogs` - Make `includeInStateLogs` and `usedInUi` metadata properties required - Remove `getPersistentState` and `getAnonymizedState` - Remove `isBaseController` - Rename `ListenerV2` to `StateChangeListener` - Rename `messagingSystem` protected instance variable to `messenger`
Breaking changes are now labelled as such, and a sub-bullet was added about the two places where the new metadata proeprties are now required. Additionally, a bug fix entry was removed because it's now redundant alongside the entry about renaming the `anonymous` metadata property in the main export.
The TypeScript compiler option `skipLibCheck` has been temporarily enabled for workspace packages. We don't want to leave this enabled forever because it can result in dependencies silently degrading to type `any` when they have errors. But this is necessary until we publish the next major version of the package `base-controller`, to avoid resolving `base-controller` in dependencies to an incompatible version.
61b5206 to
be031b5
Compare
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.
LFG!
Explanation
The
@metamask/base-controllerpackage has been updated to use the new API that had previously been exposed under thenextexport. Major changes include:MessengerandRestrictedMessenger@metamask/messengerlibraryBaseControllerto require@metamask/messengerinstanceanonymousmetadata property toincludeInDebugLogsincludeInStateLogsandusedInUimetadata properties requiredgetPersistentStateandgetAnonymizedStateisBaseControllerListenerV2toStateChangeListenermessagingSystemprotected instance variable tomessengernextexportReferences
Relates to #5626
Checklist
Note
Migrate all packages to the new
@metamask/base-controllerAPI using@metamask/messenger, remove the/nextexport and legacy messenger, and update metadata types and configs accordingly.Messenger/RestrictedMessengerwith@metamask/messenger;BaseControllernow requires aMessengerinstance./nextexport and legacy files (src/next/*,next.js,next.d.ts).anonymous->includeInDebugSnapshot; requireincludeInStateLogsandusedInUi.ListenerV2->StateChangeListener; renamemessagingSystem->messenger.getPersistentState,getAnonymizedState, andisBaseController.CHANGELOG.mdwith breaking changes.@metamask/base-controller/nextto@metamask/base-controlleracross controllers/tests (accounts, assets, network, permissions, transactions, etc.).@metamask/messengerand new metadata keys.moduleNameMapperfor/next; adjust TypeScriptpathsand addskipLibCheckintsconfig.packages.build.json.eslint-warning-thresholds.jsonaccordingly.Written by Cursor Bugbot for commit 61b5206. This will update automatically on new commits. Configure here.