You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It fetches historical gas fee data for a range of blocks using the eth_feeHistory JSON-RPC method added in EIP-1559.
The @params documentation describes the arguments:
ethQuery - An EthQuery instance to make JSON-RPC calls
endBlock - The end block number, or 'latest' for the latest block
numberOfBlocks - The number of blocks to fetch data for
percentiles - The percentiles to calculate priority fees for
includeNextBlock - Whether to estimate data for the next block
The @returns documentation describes the return value - an array of FeeHistoryBlock objects sorted from oldest to newest.
The function is exported as the default export.
It first handles the percentiles argument - converting it to a sorted unique array.
It gets the final end block number, handling 'latest' by querying the current block number.
It calls determineRequestChunkSpecifiers to break up the block range into chunks of max 1024 blocks.
It makes a Promise.all call to fetch each chunk in parallel.
Each chunk fetches data by calling makeRequestForChunk. The last chunk sets includeNextBlock to true.
The results are concatenated together and returned.
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_feeHistory
will be made.priorityFeesByPercentile
in each returned block will be formed. When Ethereum runs theeth_feeHistory
method, for each block it is considering, it will first sort all transactions bypriorityFeesByPercentile
represents the priority fees of transactions at keybaseFeePerGas
will be filled in for this block (which is*/
The text was updated successfully, but these errors were encountered: