Skip to main content

LoadFee

Trait LoadFee 

Source
pub trait LoadFee: LoadBlock{
    // Required methods
    fn gas_oracle(&self) -> &GasPriceOracle<Self::Provider>;
    fn fee_history_cache(
        &self,
    ) -> &FeeHistoryCache<<Self::Provider as HeaderProvider>::Header>;

    // Provided methods
    fn legacy_gas_price(
        &self,
        gas_price: Option<Uint<256, 4>>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn eip1559_fees(
        &self,
        base_fee: Option<Uint<256, 4>>,
        max_priority_fee_per_gas: Option<Uint<256, 4>>,
    ) -> impl Future<Output = Result<(Uint<256, 4>, Uint<256, 4>), Self::Error>> + Send { ... }
    fn eip4844_blob_fee(
        &self,
        blob_fee: Option<Uint<256, 4>>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn gas_price(
        &self,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn blob_base_fee(
        &self,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn base_fee(
        &self,
    ) -> impl Future<Output = Result<Option<Uint<256, 4>>, Self::Error>> + Send { ... }
    fn suggested_priority_fee(
        &self,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send
       where Self: 'static { ... }
}
Available on crate feature rpc only.
Expand description

Loads fee from database.

Behaviour shared by several eth_ RPC methods, not exclusive to eth_ fees RPC methods.

Required Methods§

Source

fn gas_oracle(&self) -> &GasPriceOracle<Self::Provider>

Returns a handle for reading gas price.

Data access in default (L1) trait method implementations.

Source

fn fee_history_cache( &self, ) -> &FeeHistoryCache<<Self::Provider as HeaderProvider>::Header>

Returns a handle for reading fee history data from memory.

Data access in default (L1) trait method implementations.

Provided Methods§

Source

fn legacy_gas_price( &self, gas_price: Option<Uint<256, 4>>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns the gas price if it is set, otherwise fetches a suggested gas price for legacy transactions.

Source

fn eip1559_fees( &self, base_fee: Option<Uint<256, 4>>, max_priority_fee_per_gas: Option<Uint<256, 4>>, ) -> impl Future<Output = Result<(Uint<256, 4>, Uint<256, 4>), Self::Error>> + Send

Returns the EIP-1559 fees if they are set, otherwise fetches a suggested gas price for EIP-1559 transactions.

Returns (base_fee, priority_fee)

Source

fn eip4844_blob_fee( &self, blob_fee: Option<Uint<256, 4>>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns the EIP-4844 blob fee if it is set, otherwise fetches a blob fee.

Source

fn gas_price( &self, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns a suggestion for a gas price for legacy transactions.

See also: https://github.com/ethereum/pm/issues/328#issuecomment-853234014

Source

fn blob_base_fee( &self, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns a suggestion for a base fee for blob transactions.

Source

fn base_fee( &self, ) -> impl Future<Output = Result<Option<Uint<256, 4>>, Self::Error>> + Send

Returns the base fee for the next block, or None before London activation.

Source

fn suggested_priority_fee( &self, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send
where Self: 'static,

Returns a suggestion for the priority fee (the tip)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<N, Rpc> LoadFee for EthApi<N, Rpc>
where N: RpcNodeCore, EthApiError: FromEvmError<<N as RpcNodeCore>::Evm>, Rpc: RpcConvert<Primitives = <N as RpcNodeCore>::Primitives, Error = EthApiError>,