pub struct HttpRpcClient { /* private fields */ }Expand description
HTTP JSON-RPC client with built-in reliability features.
Implementations§
Source§impl HttpRpcClient
impl HttpRpcClient
Sourcepub fn new(url: impl Into<String>, config: HttpClientConfig) -> Self
pub fn new(url: impl Into<String>, config: HttpClientConfig) -> Self
Create a new client for the given JSON-RPC endpoint URL.
Sourcepub fn with_metrics(
url: impl Into<String>,
config: HttpClientConfig,
metrics: Arc<ProviderMetrics>,
) -> Self
pub fn with_metrics( url: impl Into<String>, config: HttpClientConfig, metrics: Arc<ProviderMetrics>, ) -> Self
Create a new client with metrics recording enabled.
Sourcepub fn default_for(url: impl Into<String>) -> Self
pub fn default_for(url: impl Into<String>) -> Self
Create with default configuration.
Trait Implementations§
Source§impl RpcTransport for HttpRpcClient
impl RpcTransport for HttpRpcClient
Source§fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
True HTTP batch: send all requests as a JSON array in one HTTP call.
Source§fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a single JSON-RPC request and return the response.
Source§fn health(&self) -> HealthStatus
fn health(&self) -> HealthStatus
Return the current health status of this transport.
Source§fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
Convenience: call a method and deserialize the result.
Auto Trait Implementations§
impl !Freeze for HttpRpcClient
impl !RefUnwindSafe for HttpRpcClient
impl Send for HttpRpcClient
impl Sync for HttpRpcClient
impl Unpin for HttpRpcClient
impl UnsafeUnpin for HttpRpcClient
impl !UnwindSafe for HttpRpcClient
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