Skip to content

feat(wallet): add AccountsController and ConnectivityController#8924

Open
grypez wants to merge 3 commits into
mainfrom
grypez/wallet-account-controllers
Open

feat(wallet): add AccountsController and ConnectivityController#8924
grypez wants to merge 3 commits into
mainfrom
grypez/wallet-account-controllers

Conversation

@grypez
Copy link
Copy Markdown

@grypez grypez commented May 28, 2026

Explanation

Adds AccountsController and ConnectivityController as default initialized controllers in the wallet package, following the InitializationConfiguration pattern established by KeyringController. The required messenger delegation for AccountsController is wired up (keyring actions, SnapKeyring events, and MultichainNetworkController:networkDidChange). A temporary AlwaysOnlineAdapter is introduced for ConnectivityController pending a real platform adapter, and a createSecretRecoveryPhrase utility is added alongside the existing importSecretRecoveryPhrase.

AccountsController is deprecated in favour of AccountTreeController and MultichainAccountService, but both of those still consume AccountsController actions/events at the messenger level, so it must remain present as infrastructure. Migration is tracked via a TODO on the initialization file.

References

N/A

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
Touches wallet bootstrap and keyring-linked account tracking; connectivity is stubbed so real offline behavior is not implemented yet.

Overview
The wallet package now boots AccountsController and ConnectivityController by default, using the same InitializationConfiguration pattern as KeyringController.

AccountsController is initialized with messenger delegation to keyring actions and several SnapKeyring / multichain network events so internal account state can stay in sync with the keyring. A TODO notes this controller is interim infrastructure until AccountTreeController / MultichainAccountService are wired in.

ConnectivityController is wired with a temporary AlwaysOnlineAdapter that always reports online until consumers inject a real platform connectivity adapter.

A new createSecretRecoveryPhrase utility creates a vault via KeyringController:createNewVaultAndKeychain (complementing import). Tests cover account tracking, online status, the adapter, and the new utility; build references and the changelog are updated.

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

@grypez grypez force-pushed the grypez/wallet-account-controllers branch 4 times, most recently from d35a344 to 83241f6 Compare May 29, 2026 00:49
grypez and others added 3 commits May 29, 2026 15:45
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ctivityController

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ller initialization

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@grypez grypez force-pushed the grypez/wallet-account-controllers branch from ce86ff2 to e85be4e Compare May 30, 2026 12:26
@grypez grypez marked this pull request as ready for review May 30, 2026 12:47
@grypez grypez requested a review from a team as a code owner May 30, 2026 12:47
@grypez grypez deployed to default-branch May 30, 2026 12:47 — with GitHub Actions Active
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e85be4e. Configure here.

new ConnectivityController({
messenger,
connectivityAdapter: new AlwaysOnlineAdapter(),
}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectivityController.init() never called during wallet initialization

Medium Severity

The ConnectivityController requires its init() method to be called after construction to fetch the initial connectivity status from the adapter. The unit test in connectivity-controller.test.ts correctly calls await controller.init() after connectivityController.init(...), but the actual wallet initialization in initialization.ts only calls the config's factory function — controller.init() is never invoked. This is currently masked because both getDefaultConnectivityControllerState() and AlwaysOnlineAdapter return Online, but when a real adapter is injected, the initial status will never be queried and the controller will incorrectly report Online regardless of actual connectivity.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e85be4e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant