feat(wallet): add AccountsController and ConnectivityController#8924
feat(wallet): add AccountsController and ConnectivityController#8924grypez wants to merge 3 commits into
Conversation
d35a344 to
83241f6
Compare
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>
ce86ff2 to
e85be4e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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(), | ||
| }), |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit e85be4e. Configure here.


Explanation
Adds
AccountsControllerandConnectivityControlleras default initialized controllers in thewalletpackage, following theInitializationConfigurationpattern established byKeyringController. The required messenger delegation forAccountsControlleris wired up (keyring actions, SnapKeyring events, andMultichainNetworkController:networkDidChange). A temporaryAlwaysOnlineAdapteris introduced forConnectivityControllerpending a real platform adapter, and acreateSecretRecoveryPhraseutility is added alongside the existingimportSecretRecoveryPhrase.AccountsControlleris deprecated in favour ofAccountTreeControllerandMultichainAccountService, but both of those still consumeAccountsControlleractions/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
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
AccountsControllerandConnectivityControllerby default, using the sameInitializationConfigurationpattern asKeyringController.AccountsControlleris 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.ConnectivityControlleris wired with a temporaryAlwaysOnlineAdapterthat always reports online until consumers inject a real platform connectivity adapter.A new
createSecretRecoveryPhraseutility creates a vault viaKeyringController: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.