@@ -725,6 +725,16 @@ pub enum BlockCount {
725725 U256Type ( U256 ) ,
726726}
727727
728+ /// Response type for `eth_feeHistory` RPC call.
729+ /// Three types of response are possible:
730+ /// 1. With reward, it returned when request parameter REWARDPERCENTILES is not
731+ /// null: `{"oldestBlock": "0x...", "reward": [["0x...", ...], ...],
732+ /// "baseFeePerGas": ["0x...", ...], "gasUsedRatio": [0.0, ...]}` 2. Without
733+ /// reward, it returned when request parameter REWARDPERCENTILES is null:
734+ /// `{"oldestBlock": "0x...", "baseFeePerGas": ["0x...", ...], "gasUsedRatio":
735+ /// [0.0, ...]}` 3. Zero block count, it returned when request parameter
736+ /// BLOCKCOUNT is 0: `{"oldestBlock": "0x...", "baseFeePerGas": [],
737+ /// "gasUsedRatio": []}` See https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/eth_feehistory
728738#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq ) ]
729739#[ serde( rename_all = "camelCase" , untagged) ]
730740pub enum Web3FeeHistory {
@@ -733,27 +743,51 @@ pub enum Web3FeeHistory {
733743 ZeroBlockCount ( FeeHistoryEmpty ) ,
734744}
735745
746+ /// Response type for `eth_feeHistory` RPC call with parameter REWARDPERCENTILES
747+ /// is not null.
736748#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq ) ]
737749#[ serde( rename_all = "camelCase" ) ]
738750pub struct FeeHistoryWithReward {
751+ /// Lowest number block of the returned range.
739752 pub oldest_block : U256 ,
740- pub reward : Vec < Vec < U256 > > ,
753+ /// An array of block base fees per gas.
754+ /// This includes the next block after the newest of the returned range,
755+ /// because this value can be derived from the newest block. Zeroes are
756+ /// returned for pre-EIP-1559 blocks.
741757 pub base_fee_per_gas : Vec < U256 > ,
758+ /// An array of block gas used ratios. These are calculated as the ratio
759+ /// of `gasUsed` and `gasLimit`.
742760 pub gas_used_ratio : Vec < f64 > ,
761+ /// An (optional) array of effective priority fee per gas data points from a
762+ /// single block. All zeroes are returned if the block is empty.
763+ pub reward : Vec < Vec < U256 > > ,
743764}
744765
766+ /// Response type for `eth_feeHistory` RPC call with parameter REWARDPERCENTILES
767+ /// is null.
745768#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq ) ]
746769#[ serde( rename_all = "camelCase" ) ]
747770pub struct FeeHistoryWithoutReward {
771+ /// Lowest number block of the returned range.
748772 pub oldest_block : U256 ,
773+ /// An array of block base fees per gas.
774+ /// This includes the next block after the newest of the returned range,
775+ /// because this value can be derived from the newest block. Zeroes are
776+ /// returned for pre-EIP-1559 blocks.
749777 pub base_fee_per_gas : Vec < U256 > ,
778+ /// An array of block gas used ratios. These are calculated as the ratio
779+ /// of `gasUsed` and `gasLimit`.
750780 pub gas_used_ratio : Vec < f64 > ,
751781}
752782
783+ /// Response type for `eth_feeHistory` RPC call with parameter BLOCKCOUNT is 0.
753784#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq ) ]
754785#[ serde( rename_all = "camelCase" ) ]
755786pub struct FeeHistoryEmpty {
787+ /// Lowest number block of the returned range.
756788 pub oldest_block : U256 ,
789+ /// An array of block gas used ratios. These are calculated as the ratio
790+ /// of `gasUsed` and `gasLimit`.
757791 pub gas_used_ratio : Option < Vec < f64 > > ,
758792}
759793
0 commit comments