pub struct EthClient {
pub urls: Vec<Url>,
pub max_number_of_retries: u64,
pub backoff_factor: u64,
pub min_retry_delay: u64,
pub max_retry_delay: u64,
pub maximum_allowed_max_fee_per_gas: Option<u64>,
pub maximum_allowed_max_fee_per_blob_gas: Option<u64>,
/* private fields */
}Fields§
§urls: Vec<Url>§max_number_of_retries: u64§backoff_factor: u64§min_retry_delay: u64§max_retry_delay: u64§maximum_allowed_max_fee_per_gas: Option<u64>§maximum_allowed_max_fee_per_blob_gas: Option<u64>Implementations§
Source§impl EthClient
impl EthClient
pub fn new(url: Url) -> Result<EthClient, EthClientError>
pub fn new_with_config( urls: Vec<Url>, max_number_of_retries: u64, backoff_factor: u64, min_retry_delay: u64, max_retry_delay: u64, maximum_allowed_max_fee_per_gas: Option<u64>, maximum_allowed_max_fee_per_blob_gas: Option<u64>, ) -> Result<Self, EthClientError>
pub fn new_with_multiple_urls( urls: Vec<Url>, ) -> Result<EthClient, EthClientError>
Sourcepub async fn send_request(
&self,
request: RpcRequest,
) -> Result<RpcResponse, EthClientError>
pub async fn send_request( &self, request: RpcRequest, ) -> Result<RpcResponse, EthClientError>
Send a request to the RPC. Tries each URL until one succeeds.
Sourcepub async fn send_request_parsed<T: DeserializeOwned>(
&self,
request: RpcRequest,
) -> Result<T, EthClientError>
pub async fn send_request_parsed<T: DeserializeOwned>( &self, request: RpcRequest, ) -> Result<T, EthClientError>
Helper to send a request and parse the response, handling errors uniformly. Extracts the method name from the request for error reporting.
pub async fn send_raw_transaction( &self, data: &[u8], ) -> Result<H256, EthClientError>
pub async fn estimate_gas( &self, transaction: GenericTransaction, ) -> Result<u64, EthClientError>
pub async fn call( &self, to: Address, calldata: Bytes, overrides: Overrides, ) -> Result<String, EthClientError>
pub async fn get_max_priority_fee(&self) -> Result<U256, EthClientError>
pub async fn get_gas_price(&self) -> Result<U256, EthClientError>
pub async fn get_gas_price_with_extra( &self, bump_percent: u64, ) -> Result<U256, EthClientError>
pub async fn get_nonce( &self, address: Address, block: BlockIdentifier, ) -> Result<u64, EthClientError>
pub async fn get_block_number(&self) -> Result<u64, EthClientError>
pub async fn get_block_by_hash( &self, block_hash: H256, ) -> Result<RpcBlock, EthClientError>
pub async fn peer_count(&self) -> Result<U256, EthClientError>
Sourcepub async fn get_block_by_number(
&self,
block: BlockIdentifier,
hydrated: bool,
) -> Result<RpcBlock, EthClientError>
pub async fn get_block_by_number( &self, block: BlockIdentifier, hydrated: bool, ) -> Result<RpcBlock, EthClientError>
Fetches a block from the Ethereum blockchain by its number or the latest/earliest/pending block.
If no block_number is provided, get the latest.
pub async fn get_raw_block( &self, block: BlockIdentifier, ) -> Result<Block, EthClientError>
pub async fn get_logs( &self, from_block: U256, to_block: U256, address: Address, topics: Vec<H256>, ) -> Result<Vec<RpcLog>, EthClientError>
pub async fn get_transaction_receipt( &self, tx_hash: H256, ) -> Result<Option<RpcReceipt>, EthClientError>
pub async fn get_balance( &self, address: Address, block: BlockIdentifier, ) -> Result<U256, EthClientError>
pub async fn get_storage_at( &self, address: Address, slot: U256, block: BlockIdentifier, ) -> Result<U256, EthClientError>
pub async fn get_chain_id(&self) -> Result<U256, EthClientError>
pub async fn get_eth_config(&self) -> Result<EthConfigResponse, EthClientError>
pub async fn get_code( &self, address: Address, block: BlockIdentifier, ) -> Result<Bytes, EthClientError>
pub async fn get_transaction_by_hash( &self, tx_hash: H256, ) -> Result<Option<RpcTransaction>, EthClientError>
Sourcepub async fn get_witness(
&self,
from: BlockIdentifier,
to: Option<BlockIdentifier>,
) -> Result<RpcExecutionWitness, EthClientError>
pub async fn get_witness( &self, from: BlockIdentifier, to: Option<BlockIdentifier>, ) -> Result<RpcExecutionWitness, EthClientError>
Fethches the execution witnes for a given block or range of blocks. WARNNING: This method is only compatible with ethrex and not with other debug_executionWitness implementations.
pub async fn tx_pool_content(&self) -> Result<MempoolContent, EthClientError>
pub async fn get_blob_base_fee( &self, block: BlockIdentifier, ) -> Result<u64, EthClientError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EthClient
impl !UnwindSafe for EthClient
impl Freeze for EthClient
impl Send for EthClient
impl Sync for EthClient
impl Unpin for EthClient
impl UnsafeUnpin for EthClient
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.