Skip to content

refactor: encapsulate provider logic in transaction-controller, eliminate ethQuery#8273

Draft
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/encapsulate-provider-util
Draft

refactor: encapsulate provider logic in transaction-controller, eliminate ethQuery#8273
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/encapsulate-provider-util

Conversation

@matthewwalsh0
Copy link
Member

Explanation

Currently, transaction-controller passes ethQuery instances throughout the codebase — into utils, helpers, hooks, and gas flows — to make RPC calls. This couples every layer to EthQuery internals and makes the provider plumbing verbose and fragile.

This PR introduces a utils/provider.ts module with two functions:

  • rpcRequest(messenger, { chainId?, networkClientId? }, method, params?) — sends a JSON-RPC request given just a messenger and chain/network identifier
  • getProvider(messenger, { chainId?, networkClientId? }) — returns the raw provider for cases that need it (e.g. layer 1 gas fee flows)

All ethQuery/EthQuery usage is replaced across utils, gas flows, helpers, hooks, and TransactionController itself. The @metamask/eth-query dependency is removed entirely.

Breaking changes

  • GasFeeFlowRequest type: ethQuery field replaced with networkClientId
  • determineTransactionType second parameter changed from ethQuery to an options object { messenger, networkClientId }
  • @metamask/eth-query removed as a dependency

References

None

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

@matthewwalsh0 matthewwalsh0 force-pushed the feat/encapsulate-provider-util branch 2 times, most recently from c2ffb95 to 72ca7a5 Compare March 23, 2026 16:14
…ethQuery from transaction-controller

Replace all ethQuery/EthQuery usage with a new rpcRequest() utility that
accepts messenger + chainId/networkClientId + method + params. Any file
can now send RPC requests without passing around ethQuery instances.

- Add utils/provider.ts with rpcRequest() and getProvider() functions
- Migrate all utils, gas-flows, helpers, hooks, and TransactionController
- Update GasFeeFlowRequest type: ethQuery -> networkClientId (BREAKING)
- Update determineTransactionType signature to options object (BREAKING)
- Remove @metamask/eth-query dependency
- Update all test files to match new signatures
@matthewwalsh0 matthewwalsh0 force-pushed the feat/encapsulate-provider-util branch from 72ca7a5 to a7e5332 Compare March 23, 2026 16:15
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