Remove legacy global/selected-chain path from GasFeeController

Open
#9,585 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

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.

Description

team-confirmations

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.

Dominant language
TypeScript
Stars
422
Forks
313
Avg merge
1d 8h
Merged PRs (30d)
414

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MetaMask/core

All issues in MetaMask/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.