reth_storage_api

Trait StateProvider

Source
pub trait StateProvider:
    BlockHashReader
    + AccountReader
    + StateRootProvider
    + StorageRootProvider
    + StateProofProvider
    + HashedPostStateProvider
    + Send
    + Sync {
    // Required methods
    fn storage(
        &self,
        account: Address,
        storage_key: StorageKey,
    ) -> ProviderResult<Option<StorageValue>>;
    fn bytecode_by_hash(
        &self,
        code_hash: B256,
    ) -> ProviderResult<Option<Bytecode>>;

    // Provided methods
    fn account_code(&self, addr: Address) -> ProviderResult<Option<Bytecode>> { ... }
    fn account_balance(&self, addr: Address) -> ProviderResult<Option<U256>> { ... }
    fn account_nonce(&self, addr: Address) -> ProviderResult<Option<u64>> { ... }
}
Expand description

An abstraction for a type that provides state data.

Required Methods§

Source

fn storage( &self, account: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>

Get storage of given account.

Source

fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>

Get account code by its hash

Provided Methods§

Source

fn account_code(&self, addr: Address) -> ProviderResult<Option<Bytecode>>

Get account code by its address.

Returns None if the account doesn’t exist or account is not a contract

Source

fn account_balance(&self, addr: Address) -> ProviderResult<Option<U256>>

Get account balance by its address.

Returns None if the account doesn’t exist

Source

fn account_nonce(&self, addr: Address) -> ProviderResult<Option<u64>>

Get account nonce by its address.

Returns None if the account doesn’t exist

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + StateProvider + ?Sized> StateProvider for &'a T

Source§

fn storage( &self, account: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>

Source§

fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>

Source§

fn account_code(&self, addr: Address) -> ProviderResult<Option<Bytecode>>

Source§

fn account_balance(&self, addr: Address) -> ProviderResult<Option<U256>>

Source§

fn account_nonce(&self, addr: Address) -> ProviderResult<Option<u64>>

Source§

impl<T: StateProvider + ?Sized> StateProvider for Box<T>

Source§

fn storage( &self, account: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>

Source§

fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>

Source§

fn account_code(&self, addr: Address) -> ProviderResult<Option<Bytecode>>

Source§

fn account_balance(&self, addr: Address) -> ProviderResult<Option<U256>>

Source§

fn account_nonce(&self, addr: Address) -> ProviderResult<Option<u64>>

Source§

impl<T: StateProvider + ?Sized> StateProvider for Arc<T>

Source§

fn storage( &self, account: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>

Source§

fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>

Source§

fn account_code(&self, addr: Address) -> ProviderResult<Option<Bytecode>>

Source§

fn account_balance(&self, addr: Address) -> ProviderResult<Option<U256>>

Source§

fn account_nonce(&self, addr: Address) -> ProviderResult<Option<u64>>

Implementors§

Source§

impl<C: Send + Sync, N: NodePrimitives> StateProvider for NoopProvider<C, N>