MetaMask / MetaMask/core

Replace use of `any` with types for `query` from `controller-utils`

Open
#3,922 1 comment 0 reactions 0 assignees View on GitHub
team-wallet-framework wf-type-fixes
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

The `query` function in `controller-utils` uses `any` for its arguments as well as its return type. This means that `any` will infect other functions that use `query`

`query` is used in the following places throughout `core`:

- `assets-controllers`
- `AccountTrackerController.getBalanceFromChain`
- `AccountTrackerController.syncBalancesWithAddresses`
- `user-operation-controller`
- `getSuggestedGasFees`
- `PendingUserOperationTracker#onUserOperationConfirmed`
- `Bundler.estimateUserOperations`
- `gas-fee-controller`
- `fetchEthGasPriceEstimate`
- `fetchLatestBlock`
- `fetchBlockFeeHistory`
- `transaction-controller`
- `updatePostTransactionBalance`
- `getSuggestedGasFees`
- `TransactionController.approveTransaction`
- `TransactionController.publishTransaction`
- `estimateGas`
- `getCode`
- `getLatestBlock`
- `readAddressAsContract`
- `PendingTransactionTracker#getTransactionReceipt`
- `PendingTransactionTracker#getBlockByHash`
- `PendingTransactionTracker#getNetworkTransactionCount`

Changing the type of the arguments that `query` takes or its return type may affect all of these packages, or any other packages downstream.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `query` function in `controller-utils`, then trace its callers listed across assets-controllers, user-operation-controller, gas-fee-controller, and transaction-controller. Review how each caller uses the arguments and return value, and check the affected packages' type checks or tests. Done means the `query` API and its listed callers use explicit types without `any` propagation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.