Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth-feehistory docs #4190

Merged
merged 6 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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