Trait floresta_cli::rpc::JsonRPCClient
source · pub trait JsonRPCClient: Sized {
// Required method
fn call<T>(&self, method: &str, params: &[Value]) -> Result<T, Error>
where T: for<'a> Deserialize<'a> + DeserializeOwned + Debug;
}
Expand description
Since the workflow for jsonrpc is the same for all methods, we can implement a trait that will let us call any method on the client, and then implement the methods on any client that implements this trait.
Required Methods§
sourcefn call<T>(&self, method: &str, params: &[Value]) -> Result<T, Error>where
T: for<'a> Deserialize<'a> + DeserializeOwned + Debug,
fn call<T>(&self, method: &str, params: &[Value]) -> Result<T, Error>where T: for<'a> Deserialize<'a> + DeserializeOwned + Debug,
Calls a method on the client
This should call the appropriated rpc method and return a parsed response or error.