pub struct BlockchainHttpRpcClient { /* private fields */ }
Expand description
Client for making HTTP-based RPC requests to blockchain nodes.
This client is designed to interact with Ethereum-compatible blockchain networks, providing methods to execute RPC calls and handle responses in a type-safe manner.
Implementations§
Source§impl BlockchainHttpRpcClient
impl BlockchainHttpRpcClient
Sourcepub fn new(http_rpc_url: String, rpc_request_per_second: Option<u32>) -> Self
pub fn new(http_rpc_url: String, rpc_request_per_second: Option<u32>) -> Self
Creates a new HTTP RPC client with the given endpoint URL and optional rate limit.
§Panics
Panics if rpc_request_per_second
is Some(0)
, since a zero rate limit is invalid.
Sourcepub async fn execute_eth_call<T: DeserializeOwned>(
&self,
rpc_request: Value,
) -> Result<T>
pub async fn execute_eth_call<T: DeserializeOwned>( &self, rpc_request: Value, ) -> Result<T>
Executes an Ethereum JSON-RPC call and deserializes the response into the specified type T.
§Errors
Returns an error if the HTTP RPC request fails or the response cannot be parsed.
Sourcepub fn construct_eth_call(&self, to: &str, call_data: &[u8]) -> Value
pub fn construct_eth_call(&self, to: &str, call_data: &[u8]) -> Value
Creates a properly formatted eth_call
JSON-RPC request object targeting a specific contract address with encoded function data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockchainHttpRpcClient
impl !RefUnwindSafe for BlockchainHttpRpcClient
impl Send for BlockchainHttpRpcClient
impl Sync for BlockchainHttpRpcClient
impl Unpin for BlockchainHttpRpcClient
impl !UnwindSafe for BlockchainHttpRpcClient
Blanket Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more