Skip to content

feat: Integrate SubscriptionController into wallet initialization - #9598

Open
tuna1207 wants to merge 15 commits into
mainfrom
feat/subscription-controller-mm-wallet
Open

feat: Integrate SubscriptionController into wallet initialization#9598
tuna1207 wants to merge 15 commits into
mainfrom
feat/subscription-controller-mm-wallet

Conversation

@tuna1207

@tuna1207 tuna1207 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Explanation

Adds SubscriptionController as a default initialized unit in @metamask/wallet, with injectable or default SubscriptionService construction and AuthenticationController messenger delegation.

@metamask/wallet is the shared controller-integration layer for extension, mobile, and other clients. Build-specific and runtime values are injected via instanceOptions rather than hardcoded.

Breaking changes

  • BREAKING: instanceOptions.subscriptionController is now required with at least env and fetchFunction.
  • When passing a full subscriptionService override, env and fetchFunction remain required at the type level but are unused for service construction.

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
Breaking wallet instanceOptions and subscription billing/auth integration require all hosts to supply config and register AuthenticationController; misconfiguration could break subscription API calls but does not directly alter keyring or transaction signing.

Overview
SubscriptionController can now be constructed with either an injected subscriptionService or service config (env, fetchFunction, optional getAccessToken / captureException); the default path builds SubscriptionService and uses AuthenticationController:getBearerToken when no token getter is supplied. The messenger no longer declares unused AuthenticationController:stateChange (AllowedEvents export removed).

@metamask/wallet adds SubscriptionController to default initialization: a required instanceOptions.subscriptionController slot, a new init module that delegates auth actions to the root messenger, dependency on @metamask/subscription-controller, and tests/docs/CODEOWNERS updates. wallet-cli passes { fetchFunction: globalThis.fetch } so the daemon gets production API defaults without extra env wiring.

Changelogs document breaking wallet and subscription-controller API changes; eslint suppressions for removed index.ts exports are cleaned up.

Reviewed by Cursor Bugbot for commit caa3113. Bugbot is set up for automated code reviews on this repo. Configure here.

@tuna1207
tuna1207 marked this pull request as ready for review July 23, 2026 00:58
@tuna1207
tuna1207 requested review from a team as code owners July 23, 2026 00:58
@tuna1207
tuna1207 temporarily deployed to default-branch July 23, 2026 00:58 — with GitHub Actions Inactive
@tuna1207
tuna1207 requested a review from a team as a code owner July 30, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants