diff --git a/CHANGELOG.md b/CHANGELOG.md index 49b3c436df3..4d872bf670e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -407,6 +407,7 @@ Released with 1.0.0-beta.37 code base. ### Added - London transaction support (#4155) +- RPC support `eth_feehistory` call ### Changed - Grammar fix (#4088) and updated Swarm (#4151)and Whisper doc links (#4170) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 107b172e721..64fb7e0412c 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -716,6 +716,43 @@ Example ------------------------------------------------------------------------------ +.. _eth-feehistory: + + +getFeeHistory +===================== + +.. code-block:: javascript + + web3.eth.getFeeHistory(blockCount, newestBlock, rewardPercentiles, [callback]) + +Transaction fee history +Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available. +The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older +history are optional to support. For pre-EIP-1559 blocks the gas prices are returned as rewards and zeroes are returned for the base fee per gas. + +---------- +Parameters +---------- + +1. ``String|Number|BN|BigNumber`` - Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. +2. ``String|Number|BN|BigNumber`` - Highest number block of the requested range. +3. ``Array of numbers`` - A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. Example: `["0", "25", "50", "75", "100"]` or `["0", "0.5", "1", "1.5", "3", "80"]` +4. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second. + +------- +Returns +------- + +``Promise`` returns ``Object`` - Fee history for the returned block range. The object: + +- ``Number`` oldestBlock - Lowest number block of the returned range. +- ``Array of strings`` baseFeePerGas - An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks. +- ``Array of numbers`` gasUsedRatio - An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit. +- ``Array of string arrays`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. + +------------------------------------------------------------------------------ + getAccounts =====================