neo3/neo_clients/rpc/
connections.rs

1use std::fmt::Debug;
2
3use crate::neo_clients::ProviderError;
4use async_trait::async_trait;
5use auto_impl::auto_impl;
6use serde::{de::DeserializeOwned, Serialize};
7
8#[cfg_attr(target_arch = "wasm32", async_trait(? Send))]
9#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
10#[auto_impl(&, Box, Arc)]
11/// Trait which must be implemented by data transports to be used with the Neo
12/// JSON-RPC provider.
13pub trait JsonRpcProvider: Debug + Send + Sync {
14	/// A JSON-RPC Error
15	type Error: Into<ProviderError>;
16
17	/// Sends a request with the provided JSON-RPC and parameters serialized as JSON
18	async fn fetch<T, R>(&self, method: &str, params: T) -> Result<R, Self::Error>
19	where
20		T: Debug + Serialize + Send + Sync,
21		R: DeserializeOwned + Send;
22}