Skip to content

feat: Expose NetworkController methods through messenger#8350

Open
cryptodev-2s wants to merge 11 commits intomainfrom
feat/network-controller-messenger-exposed-methods
Open

feat: Expose NetworkController methods through messenger#8350
cryptodev-2s wants to merge 11 commits intomainfrom
feat/network-controller-messenger-exposed-methods

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Mar 31, 2026

Explanation

Migrates NetworkController to use MESSENGER_EXPOSED_METHODS and registerMethodActionHandlers, replacing manual registerActionHandler calls. The generate-method-action-types script is used to auto-generate action types.

  • Adds public getEthQuery() method (replaces lambda accessing private field)
  • Exposes 11 previously unregistered public methods as messenger actions
  • Deprecates old type aliases missing Action suffix (NetworkControllerGetNetworkConfigurationByNetworkClientId)

References

Changelog

Added

  • 11 new messenger actions: enableRpcFailover, disableRpcFailover, getProviderAndBlockTracker, getNetworkClientRegistry, initializeProvider, lookupNetwork, lookupNetworkByClientId, get1559CompatibilityWithNetworkClientId, resetConnection, rollbackToPreviousProvider, loadBackup

Deprecated

  • NetworkControllerGetNetworkConfigurationByNetworkClientId → use NetworkControllerGetNetworkConfigurationByNetworkClientIdAction

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
Expands and refactors NetworkController messenger action registration and exported types, which can affect downstream consumers’ typing and any code calling these actions. Runtime behavior should be unchanged, but mis-registration or method list drift could break integrations.

Overview
Exposes additional NetworkController methods via the messenger by switching from many manual registerActionHandler calls to registerMethodActionHandlers driven by a centralized MESSENGER_EXPOSED_METHODS list.

Adds an auto-generated NetworkController-method-action-types.ts file (plus a generate-method-action-types script and tsx dev dependency) and re-exports these new action types from index.ts, including new actions like RPC failover toggles and connection/provider lifecycle methods.

Updates assets controllers to import NetworkControllerFindNetworkClientIdByChainIdAction from @metamask/network-controller (removing relative-package type imports) and records the consumer-facing typing fixes in changelogs; removes now-unneeded import-x/no-relative-packages eslint suppressions.

Written by Cursor Bugbot for commit 3db94fa. This will update automatically on new commits. Configure here.

Migrate NetworkController to use MESSENGER_EXPOSED_METHODS and
registerMethodActionHandlers, replacing manual registerActionHandler
calls. Auto-generate action types via generate-method-action-types
script.

- Add public getEthQuery() method (replaces lambda)
- Expose 11 previously unregistered public methods as messenger actions
- Deprecate old type aliases missing Action suffix
@cryptodev-2s cryptodev-2s marked this pull request as ready for review March 31, 2026 12:09
@cryptodev-2s cryptodev-2s requested review from a team as code owners March 31, 2026 12:09
@cryptodev-2s cryptodev-2s self-assigned this Mar 31, 2026
@cryptodev-2s cryptodev-2s marked this pull request as draft March 31, 2026 12:15
@cryptodev-2s cryptodev-2s marked this pull request as ready for review March 31, 2026 12:32
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.

@cryptodev-2s cryptodev-2s enabled auto-merge March 31, 2026 13:17
@cryptodev-2s cryptodev-2s requested a review from mcmire March 31, 2026 14:16
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

One more thing, and then I can approve.

mcmire
mcmire previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcmire mcmire dismissed their stale review March 31, 2026 14:32

Actually I noticed one more thing :)

@cryptodev-2s cryptodev-2s disabled auto-merge March 31, 2026 14:32
mcmire
mcmire previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good now.

@cryptodev-2s
Copy link
Copy Markdown
Contributor Author

cryptodev-2s commented Mar 31, 2026

Looks good now.

Sorry I made this new commit 3db94fa for wrong sections order.

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.

2 participants