pub trait EthState: LoadState + SpawnBlocking {
// Required method
fn max_proof_window(&self) -> u64;
// Provided methods
fn ensure_within_proof_window(
&self,
block_id: BlockId,
) -> Result<(), Self::Error>
where Self: EthApiSpec { ... }
fn transaction_count(
&self,
address: Address,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<U256, 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<U256, Self::Error>> + Send { ... }
fn storage_at(
&self,
address: Address,
index: JsonStorageKey,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<B256, Self::Error>> + Send { ... }
fn storage_values(
&self,
requests: HashMap<Address, Vec<JsonStorageKey>>,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<HashMap<Address, Vec<B256>>, 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
where Self: EthApiSpec { ... }
fn get_account_info(
&self,
address: Address,
block_id: BlockId,
) -> impl Future<Output = Result<AccountInfo, Self::Error>> + Send { ... }
}Expand description
Helper methods for eth_ methods relating to state (accounts).
Required Methods§
Sourcefn max_proof_window(&self) -> u64
fn max_proof_window(&self) -> u64
Returns the maximum number of blocks into the past for generating state proofs.
Provided Methods§
Sourcefn ensure_within_proof_window(
&self,
block_id: BlockId,
) -> Result<(), Self::Error>where
Self: EthApiSpec,
fn ensure_within_proof_window(
&self,
block_id: BlockId,
) -> Result<(), Self::Error>where
Self: EthApiSpec,
Validates that the given block is within the configured proof window.
Returns an error if the distance between the chain tip and the requested block exceeds
Self::max_proof_window.
Sourcefn transaction_count(
&self,
address: Address,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<U256, Self::Error>> + Send
fn transaction_count( &self, address: Address, block_id: Option<BlockId>, ) -> impl Future<Output = Result<U256, 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).
Sourcefn get_code(
&self,
address: Address,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send
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.
Sourcefn balance(
&self,
address: Address,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<U256, Self::Error>> + Send
fn balance( &self, address: Address, block_id: Option<BlockId>, ) -> impl Future<Output = Result<U256, Self::Error>> + Send
Returns balance of given account, at given blocknumber.
Sourcefn storage_at(
&self,
address: Address,
index: JsonStorageKey,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<B256, Self::Error>> + Send
fn storage_at( &self, address: Address, index: JsonStorageKey, block_id: Option<BlockId>, ) -> impl Future<Output = Result<B256, Self::Error>> + Send
Returns values stored of given account, at given blocknumber.
Sourcefn storage_values(
&self,
requests: HashMap<Address, Vec<JsonStorageKey>>,
block_id: Option<BlockId>,
) -> impl Future<Output = Result<HashMap<Address, Vec<B256>>, Self::Error>> + Send
fn storage_values( &self, requests: HashMap<Address, Vec<JsonStorageKey>>, block_id: Option<BlockId>, ) -> impl Future<Output = Result<HashMap<Address, Vec<B256>>, Self::Error>> + Send
Returns values from multiple storage positions across multiple addresses.
Enforces a cap on total slot count (sum of all slot arrays) and returns an error if exceeded.
Sourcefn 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_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.
Sourcefn get_account(
&self,
address: Address,
block_id: BlockId,
) -> impl Future<Output = Result<Option<Account>, Self::Error>> + Sendwhere
Self: EthApiSpec,
fn get_account(
&self,
address: Address,
block_id: BlockId,
) -> impl Future<Output = Result<Option<Account>, Self::Error>> + Sendwhere
Self: EthApiSpec,
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.