refactor: encapsulate provider logic in transaction-controller, eliminate ethQuery#8273
Draft
matthewwalsh0 wants to merge 1 commit intomainfrom
Draft
refactor: encapsulate provider logic in transaction-controller, eliminate ethQuery#8273matthewwalsh0 wants to merge 1 commit intomainfrom
matthewwalsh0 wants to merge 1 commit intomainfrom
Conversation
c2ffb95 to
72ca7a5
Compare
…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
72ca7a5 to
a7e5332
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Currently,
transaction-controllerpassesethQueryinstances throughout the codebase — into utils, helpers, hooks, and gas flows — to make RPC calls. This couples every layer toEthQueryinternals and makes the provider plumbing verbose and fragile.This PR introduces a
utils/provider.tsmodule with two functions:rpcRequest(messenger, { chainId?, networkClientId? }, method, params?)— sends a JSON-RPC request given just a messenger and chain/network identifiergetProvider(messenger, { chainId?, networkClientId? })— returns the raw provider for cases that need it (e.g. layer 1 gas fee flows)All
ethQuery/EthQueryusage is replaced across utils, gas flows, helpers, hooks, andTransactionControlleritself. The@metamask/eth-querydependency is removed entirely.Breaking changes
GasFeeFlowRequesttype:ethQueryfield replaced withnetworkClientIddetermineTransactionTypesecond parameter changed fromethQueryto an options object{ messenger, networkClientId }@metamask/eth-queryremoved as a dependencyReferences
None
Checklist