MetaMask / MetaMask/metamask-extension

Refactor / Improve the way we handle getting gas estimate currently

Open
#12,277 0 comments 0 reactions 0 assignees View on GitHub
area-gas team-confirmations-planning type-refactor
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Currently GasFeeController returns the gas estimates using current network and account type, if network is advanced and supports EIP-1559, there is no way to get gas estimates for a legacy transaction on that network using GasFeeController. It will be nice to change gas fee controller to return gas estimates after considering the type of transaction, for for instance a type-0 transaction on a network supporting EIP-1559 we should be able to get `gasPrice` estimates.

Thus we need to refactor GasFeeController, TransactionController and also UI code for this. As metamask see a new transaction it will get gasEstimates using its type, it will be stored in state in a Map. As UI starts polling for gasFeeEstimates it can continue to update this map in the state. All of the UI components can use this map in state as source of gas estimates. This will also work well in scenario when the user sends request of different types of transactions to metamask.

Together with the task: https://github.com/MetaMask/metamask-extension/issues/12276, this will simplify our UI.

Contributor guide

Open the contributing guide

Research direction

Start by tracing GasFeeController and TransactionController, then follow the UI code that requests and polls gas estimates. Compare the requested transaction type with the current network and account-based flow, and review issue #12276 for related context. Done means estimates are stored and updated per transaction type so both legacy and EIP-1559 transactions can use the appropriate values.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, blockchain, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.