Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 509fccd

Browse files
Alexalexspacesailor24
authored
eth-feehistory docs (#4190)
* updating docs * updating example * updating types and adding example of list * Update docs/web3-eth.rst * Update docs/web3-eth.rst * Update docs/web3-eth.rst Co-authored-by: alex <[email protected]> Co-authored-by: Wyatt Barnes <[email protected]>
1 parent 44a62a8 commit 509fccd

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ Released with 1.0.0-beta.37 code base.
407407
### Added
408408

409409
- London transaction support (#4155)
410+
- RPC support `eth_feehistory` call
410411

411412
### Changed
412413
- Grammar fix (#4088) and updated Swarm (#4151)and Whisper doc links (#4170)

docs/web3-eth.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,43 @@ Example
716716
717717
------------------------------------------------------------------------------
718718

719+
.. _eth-feehistory:
720+
721+
722+
getFeeHistory
723+
=====================
724+
725+
.. code-block:: javascript
726+
727+
web3.eth.getFeeHistory(blockCount, newestBlock, rewardPercentiles, [callback])
728+
729+
Transaction fee history
730+
Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available.
731+
The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older
732+
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.
733+
734+
----------
735+
Parameters
736+
----------
737+
738+
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.
739+
2. ``String|Number|BN|BigNumber`` - Highest number block of the requested range.
740+
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"]`
741+
4. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second.
742+
743+
-------
744+
Returns
745+
-------
746+
747+
``Promise`` returns ``Object`` - Fee history for the returned block range. The object:
748+
749+
- ``Number`` oldestBlock - Lowest number block of the returned range.
750+
- ``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.
751+
- ``Array of numbers`` gasUsedRatio - An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.
752+
- ``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.
753+
754+
------------------------------------------------------------------------------
755+
719756

720757
getAccounts
721758
=====================

0 commit comments

Comments
 (0)