Skip to content

Commit

Permalink
Extract determineGasFeeCalculations (#612)
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 "calculations" 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 Dec 10, 2021
1 parent 2570553 commit 215a879
Show file tree
Hide file tree
Showing 4 changed files with 595 additions and 322 deletions.
Loading

0 comments on commit 215a879

Please sign in to comment.