see https://sourcegraph.com/github.com/MetaMask/core@80ff2fbb1fb38f577b4a5c7e3778550c4682202d/-/blob/packages/gas-fee-controller/src/fetchBlockFeeHistory.ts
/**
- Uses
eth_feeHistory (an EIP-1559 feature) to obtain information about gas fees from a range of
- blocks that have occurred recently on a network.
- To learn more, see these resources:
-
-
-
-
-
- @param args - The arguments to this function.
- @param args.ethQuery - An EthQuery instance that wraps a provider for the network in question.
- @param args.endBlock - The desired end of the requested block range. Can be "latest" if you want
- to start from the latest successful block or the number of a known past block.
- @param args.numberOfBlocks - How many total blocks to fetch. Note that if this is more than 1024,
- multiple calls to
eth_feeHistory will be made.
- @param args.percentiles - A set of numbers between 1 and 100 which will dictate how
priorityFeesByPercentile in each returned block will be formed. When Ethereum runs the
eth_feeHistory method, for each block it is considering, it will first sort all transactions by
- the priority fee. It will then go through each transaction and add the total amount of gas paid
- for that transaction to a bucket which maxes out at the total gas used for the whole block. As
- the bucket fills, it will cross percentages which correspond to the percentiles specified here,
- and the priority fees of the first transactions which cause it to reach those percentages will be
- recorded. Hence,
priorityFeesByPercentile represents the priority fees of transactions at key
- gas used contribution levels, where earlier levels have smaller contributions and later levels
- have higher contributions.
- @param args.includeNextBlock - Whether to include an extra block that represents the next
- block after the latest one. Only the
baseFeePerGas will be filled in for this block (which is
- estimated).
- @returns The list of blocks and their fee data, sorted from oldest to newest.
*/
see https://sourcegraph.com/github.com/MetaMask/core@80ff2fbb1fb38f577b4a5c7e3778550c4682202d/-/blob/packages/gas-fee-controller/src/fetchBlockFeeHistory.ts
/**
eth_feeHistory(an EIP-1559 feature) to obtain information about gas fees from a range ofeth_feeHistorywill be made.priorityFeesByPercentilein each returned block will be formed. When Ethereum runs theeth_feeHistorymethod, for each block it is considering, it will first sort all transactions bypriorityFeesByPercentilerepresents the priority fees of transactions at keybaseFeePerGaswill be filled in for this block (which is*/