pub struct JsonRpcClient {
pub base_url: Url,
pub http: Client,
}Expand description
JSON-RPC client for Accumulate API calls
Fields§
§base_url: Url§http: ClientImplementations§
Source§impl JsonRpcClient
impl JsonRpcClient
Sourcepub fn new(base_url: Url) -> Result<Self, JsonRpcError>
pub fn new(base_url: Url) -> Result<Self, JsonRpcError>
Create a new JSON-RPC client
Sourcepub fn with_client(base_url: Url, http: Client) -> Result<Self, JsonRpcError>
pub fn with_client(base_url: Url, http: Client) -> Result<Self, JsonRpcError>
Create a new JSON-RPC client with custom HTTP client
Sourcepub async fn call<T: DeserializeOwned>(
&self,
method: &str,
params: Value,
) -> Result<T, JsonRpcError>
pub async fn call<T: DeserializeOwned>( &self, method: &str, params: Value, ) -> Result<T, JsonRpcError>
Make a generic JSON-RPC call
Sourcepub async fn call_v2<T: DeserializeOwned>(
&self,
method_path: &str,
payload: Option<Value>,
) -> Result<T, JsonRpcError>
pub async fn call_v2<T: DeserializeOwned>( &self, method_path: &str, payload: Option<Value>, ) -> Result<T, JsonRpcError>
Make a V2 API call (non-JSON-RPC)
Sourcepub async fn call_v3<T: DeserializeOwned>(
&self,
method: &str,
params: Value,
) -> Result<T, JsonRpcError>
pub async fn call_v3<T: DeserializeOwned>( &self, method: &str, params: Value, ) -> Result<T, JsonRpcError>
Make a V3 API call
Trait Implementations§
Source§impl Clone for JsonRpcClient
impl Clone for JsonRpcClient
Source§fn clone(&self) -> JsonRpcClient
fn clone(&self) -> JsonRpcClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for JsonRpcClient
impl !RefUnwindSafe for JsonRpcClient
impl Send for JsonRpcClient
impl Sync for JsonRpcClient
impl Unpin for JsonRpcClient
impl UnsafeUnpin for JsonRpcClient
impl !UnwindSafe for JsonRpcClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more