pub struct RpcClient { /* private fields */ }Expand description
A concrete wrapper around an RpcClientT which provides some higher level helper methods
and is cheaply cloneable.
Implementations§
Source§impl RpcClient
impl RpcClient
Sourcepub async fn from_url<U: AsRef<str>>(url: U) -> Result<Self, Error>
Available on crate feature jsonrpsee only.
pub async fn from_url<U: AsRef<str>>(url: U) -> Result<Self, Error>
jsonrpsee only.Create a default RPC client pointed at some URL, currently based on jsonrpsee.
Errors if an insecure URL is provided. In this case, use RpcClient::from_insecure_url instead.
Sourcepub async fn from_insecure_url<U: AsRef<str>>(url: U) -> Result<Self, Error>
Available on crate feature jsonrpsee only.
pub async fn from_insecure_url<U: AsRef<str>>(url: U) -> Result<Self, Error>
jsonrpsee only.Create a default RPC client pointed at some URL, currently based on jsonrpsee.
Allows insecure URLs without SSL encryption, e.g. (http:// and ws:// URLs).
Sourcepub fn new<R: RpcClientT>(client: R) -> Self
pub fn new<R: RpcClientT>(client: R) -> Self
Create a new RpcClient from an arbitrary RpcClientT implementation.
Sourcepub async fn request<Res: DeserializeOwned>(
&self,
method: &str,
params: RpcParams,
) -> Result<Res, Error>
pub async fn request<Res: DeserializeOwned>( &self, method: &str, params: RpcParams, ) -> Result<Res, Error>
Make an RPC request, given a method name and some parameters.
See RpcParams and the rpc_params! macro for an example of how to
construct the parameters.
Sourcepub async fn subscribe<Res: DeserializeOwned>(
&self,
sub: &str,
params: RpcParams,
unsub: &str,
) -> Result<RpcSubscription<Res>, Error>
pub async fn subscribe<Res: DeserializeOwned>( &self, sub: &str, params: RpcParams, unsub: &str, ) -> Result<RpcSubscription<Res>, Error>
Subscribe to an RPC endpoint, providing the parameters and the method to call to unsubscribe from it again.
See RpcParams and the rpc_params! macro for an example of how to
construct the parameters.