Skip to content

Commit

Permalink
Extract determineGasFeeSuggestions
Browse files Browse the repository at this point in the history
We would like to introduce another fallback to how we estimate gas fees
in a future commit — namely, we want to use `eth_feeHistory` for
EIP-1559 networks if the usual API is down. To do this, the existing
code around gas fee estimates needs to be refactored. This is the first
in a two-part refactor, extracting the majority of the code in
`GasFeeController._fetchGasFeeEstimateData` to `gas-util`. In addition
to making room for more changes, this also allows us to test this code
in isolation from the polling code that already exists in
GasFeeController.

Note that I am using the term "suggestions" to encompass the data that
`_fetchGasFeeEstimateData` returns. This is because `gasFeeEstimates` is
an intermediate value that can also be packaged with
`estimatedGasFeeTimeBounds`, so "estimates" could be confusing. Also, I
replaced "fetch" with "determine" as in the future we may be performing
calculations that APIs have done for us in the past ("fetch" seems like
a more low-level action).
  • Loading branch information
mcmire committed Oct 28, 2021
1 parent f174f93 commit 4d5a23b
Show file tree
Hide file tree
Showing 4 changed files with 594 additions and 321 deletions.
Loading

0 comments on commit 4d5a23b

Please sign in to comment.