pub trait ClientT {
// Required methods
fn notification<Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<(), Error>> + Send
where Params: ToRpcParams + Send;
fn request<R, Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<R, Error>> + Send
where R: DeserializeOwned,
Params: ToRpcParams + Send;
fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>> + Send
where R: DeserializeOwned + Debug + 'a;
}
Available on crate feature
client
only.Expand description
JSON-RPC client interface that can make requests and notifications.
Required Methods§
Sourcefn notification<Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Params: ToRpcParams + Send,
fn notification<Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Params: ToRpcParams + Send,
Send a notification request
Sourcefn request<R, Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<R, Error>> + Send
fn request<R, Params>( &self, method: &str, params: Params, ) -> impl Future<Output = Result<R, Error>> + Send
Send a method call request.
Sourcefn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>> + Sendwhere
R: DeserializeOwned + Debug + 'a,
fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>> + Sendwhere
R: DeserializeOwned + Debug + 'a,
Send a batch request.
The response to batch are returned in the same order as it was inserted in the batch.
Returns Ok
if all requests in the batch were answered.
Returns Error
if the network failed or any of the responses could be parsed a valid JSON-RPC response.
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.
Implementors§
impl<L> ClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
Available on crate features
async-client
and async-wasm-client
only.