MetaMask / MetaMask/core

Remove legacy global/selected-chain path from GasFeeController

Open
#9,585 0 comments 0 reactions 0 assignees View on GitHub
team-confirmations
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

## Summary

`GasFeeController` supports two modes: the multichain path (`fetchGasFeeEstimates({ networkClientId })` → `gasFeeEstimatesByChainId[chainId]`) and a legacy **global/selected-chain** path that predates multichain support. Remove the global path so the per-`networkClientId` route is the only one.

## Surface to remove

- Constructor options: `getProvider`, `getChainId`, `getCurrentNetworkEIP1559Compatibility`, `getCurrentNetworkLegacyGasAPICompatibility`, `getCurrentAccountEIP1559Compatibility`, `onNetworkDidChange`
- Flat top-level state: `gasFeeEstimates`, `gasEstimateType`, `estimatedGasFeeTimeBounds`
- No-arg polling `getGasFeeEstimatesAndStartPolling()` and the `NetworkController:networkDidChange` subscription/reset
- Make `networkClientId` required in `fetchGasFeeEstimates`; give `getTimeEstimate` a chain/`networkClientId` arg

## Impact — **BREAKING**

- **Core:** low risk. No consumer reads the flat state or uses no-arg polling; transaction-controller already passes `networkClientId`. Mostly mechanical + large `GasFeeController.test.ts` rewrite (~60-70% is global-path).

## Notes

Follow-up to #9569, which made the global path init-order-agnostic — this removal deletes that code path entirely.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with GasFeeController and the large GasFeeController.test.ts suite, separating the multichain path from the legacy global/selected-chain cases listed in the issue. Check transaction-controller's existing networkClientId calls, then remove the legacy surface and update the tests so the required per-networkClientId flow remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.