Skip to content

Commit

Permalink
eth-feehistory docs (#4190)
Browse files Browse the repository at this point in the history
* 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 <luu.alex@outlook.com>
Co-authored-by: Wyatt Barnes <wyatt@writerof.software>
  • Loading branch information
3 people authored Jul 23, 2021
1 parent 44a62a8 commit 509fccd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 37 additions & 0 deletions docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====================
Expand Down

0 comments on commit 509fccd

Please sign in to comment.