reth::rpc::api::servers::eth::helpers::state

Trait EthState

pub trait EthState: LoadState + SpawnBlocking {
    // Required method
    fn max_proof_window(&self) -> u64;

    // Provided methods
    fn transaction_count(
        &self,
        address: Address,
        block_id: Option<BlockId>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn get_code(
        &self,
        address: Address,
        block_id: Option<BlockId>,
    ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send { ... }
    fn balance(
        &self,
        address: Address,
        block_id: Option<BlockId>,
    ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send { ... }
    fn storage_at(
        &self,
        address: Address,
        index: JsonStorageKey,
        block_id: Option<BlockId>,
    ) -> impl Future<Output = Result<FixedBytes<32>, Self::Error>> + Send { ... }
    fn get_proof(
        &self,
        address: Address,
        keys: Vec<JsonStorageKey>,
        block_id: Option<BlockId>,
    ) -> Result<impl Future<Output = Result<EIP1186AccountProofResponse, Self::Error>> + Send, Self::Error>
       where Self: EthApiSpec { ... }
    fn get_account(
        &self,
        address: Address,
        block_id: BlockId,
    ) -> impl Future<Output = Result<Option<Account>, Self::Error>> + Send { ... }
}
Expand description

Helper methods for eth_ methods relating to state (accounts).

Required Methods§

fn max_proof_window(&self) -> u64

Returns the maximum number of blocks into the past for generating state proofs.

Provided Methods§

fn transaction_count( &self, address: Address, block_id: Option<BlockId>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns the number of transactions sent from an address at the given block identifier.

If this is BlockNumberOrTag::Pending then this will look up the highest transaction in pool and return the next nonce (highest + 1).

fn get_code( &self, address: Address, block_id: Option<BlockId>, ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send

Returns code of given account, at given blocknumber.

fn balance( &self, address: Address, block_id: Option<BlockId>, ) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send

Returns balance of given account, at given blocknumber.

fn storage_at( &self, address: Address, index: JsonStorageKey, block_id: Option<BlockId>, ) -> impl Future<Output = Result<FixedBytes<32>, Self::Error>> + Send

Returns values stored of given account, at given blocknumber.

fn get_proof( &self, address: Address, keys: Vec<JsonStorageKey>, block_id: Option<BlockId>, ) -> Result<impl Future<Output = Result<EIP1186AccountProofResponse, Self::Error>> + Send, Self::Error>
where Self: EthApiSpec,

Returns values stored of given account, with Merkle-proof, at given blocknumber.

fn get_account( &self, address: Address, block_id: BlockId, ) -> impl Future<Output = Result<Option<Account>, Self::Error>> + Send

Returns the account at the given address for the provided block identifier.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Provider, Pool, Network, EvmConfig> EthState for EthApi<Provider, Pool, Network, EvmConfig>
where EthApi<Provider, Pool, Network, EvmConfig>: LoadState + SpawnBlocking,