ethers_providers/rpc/
connections.rs1use crate::{ProviderError, RpcError};
2use async_trait::async_trait;
3use auto_impl::auto_impl;
4use serde::{de::DeserializeOwned, Serialize};
5use std::fmt::Debug;
6
7#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
8#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
9#[auto_impl(&, Box, Arc)]
10pub trait JsonRpcClient: Debug + Send + Sync {
13 type Error: Into<ProviderError> + RpcError;
15
16 async fn request<T, R>(&self, method: &str, params: T) -> Result<R, Self::Error>
18 where
19 T: Debug + Serialize + Send + Sync,
20 R: DeserializeOwned + Send;
21}