From c6e1d4a0bd8c16c5a43881a7ba4cd30578905d2e Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Jul 2021 14:16:22 -0400 Subject: [PATCH 1/6] updating docs --- CHANGELOG.md | 1 + docs/web3-eth.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) 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..934135f1677 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -707,6 +707,56 @@ Example ------- +.. code-block:: javascript + + web3.eth.getGasPrice() + .then(console.log); + > "20000000000" + + +------------------------------------------------------------------------------ + +.. _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 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`` - Highest number block of the requested range. +3. ``Array of numbers`` - (optional) 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. +3. ``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: + +- ``String`` 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 strings`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. + + +------- +Example +------- + + .. code-block:: javascript web3.eth.getGasPrice() From e1eeb8912f325d91cabca67255a292d90214bde0 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Jul 2021 14:18:23 -0400 Subject: [PATCH 2/6] updating example --- docs/web3-eth.rst | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 934135f1677..a1953439197 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -751,19 +751,6 @@ Returns - ``Array of numbers`` gasUsedRatio - An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit. - ``Array of strings`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. - -------- -Example -------- - - -.. code-block:: javascript - - web3.eth.getGasPrice() - .then(console.log); - > "20000000000" - - ------------------------------------------------------------------------------ From 14c5da495e8493d073e28158cb2aa745116c1a33 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 23 Jul 2021 09:16:27 -0400 Subject: [PATCH 3/6] updating types and adding example of list --- docs/web3-eth.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index a1953439197..bdb09eb04c1 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -735,10 +735,10 @@ history are optional to support. For pre-EIP-1559 blocks the gas prices are retu Parameters ---------- -1. ``String`` - 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`` - Highest number block of the requested range. -3. ``Array of numbers`` - (optional) 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. -3. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second. +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`` - (optional) 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 From 148dcc9761bea6bec72c8ab4c9d86ffe41633ea4 Mon Sep 17 00:00:00 2001 From: Wyatt Barnes Date: Fri, 23 Jul 2021 13:51:35 -1000 Subject: [PATCH 4/6] Update docs/web3-eth.rst --- docs/web3-eth.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index bdb09eb04c1..3746993b86a 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -737,7 +737,7 @@ 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`` - (optional) 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"]` +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. ------- From 1369a3b54c4b053459c1bc6f996d376e7d8f9ab2 Mon Sep 17 00:00:00 2001 From: Wyatt Barnes Date: Fri, 23 Jul 2021 13:51:43 -1000 Subject: [PATCH 5/6] Update docs/web3-eth.rst --- docs/web3-eth.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 3746993b86a..268573f558a 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -746,7 +746,7 @@ Returns ``Promise`` returns ``Object`` - Fee history for the returned block range. The object: -- ``String`` oldestBlock - Lowest number block of the returned range. +- ``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 strings`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. From 7a64e0fee79754e4e8a4dae0cd51fe5494257144 Mon Sep 17 00:00:00 2001 From: Wyatt Barnes Date: Fri, 23 Jul 2021 13:51:51 -1000 Subject: [PATCH 6/6] Update docs/web3-eth.rst --- docs/web3-eth.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 268573f558a..64fb7e0412c 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -749,7 +749,7 @@ Returns - ``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 strings`` reward - An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. +- ``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. ------------------------------------------------------------------------------