Skip to content
Merged

Dev #125

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/asynch/clients/json_rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use super::{client::XRPLClient, exceptions::XRPLClientResult};

/// Renames the requests field `command` to `method` for JSON-RPC.
fn request_to_json_rpc(request: &impl Serialize) -> XRPLClientResult<Value> {

Check warning on line 13 in src/asynch/clients/json_rpc/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/clients/json_rpc/mod.rs:13:53 | 13 | fn request_to_json_rpc(request: &impl Serialize) -> XRPLClientResult<Value> { | ^^^^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/clients/exceptions.rs:26:5 | 26 | XRPLWebSocketError(#[from] XRPLWebSocketException), | -------------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::clients::exceptions::XRPLClientException`, for example by boxing large elements or replacing it with `Box<asynch::clients::exceptions::XRPLClientException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
let mut json_rpc_request = Map::new();
let request_value = serde_json::to_value(request)?;
let mut request = request_value
Expand Down Expand Up @@ -45,11 +45,15 @@

pub struct AsyncJsonRpcClient {
url: Url,
client: HttpClient,
}

impl AsyncJsonRpcClient {
pub fn connect(url: Url) -> Self {
Self { url }
Self {
url,
client: HttpClient::new(),
}
}
}

Expand All @@ -58,9 +62,9 @@
&self,
request: XRPLRequest<'a>,
) -> XRPLClientResult<XRPLResponse<'b>> {
let client = HttpClient::new();
let request_json_rpc = request_to_json_rpc(&request)?;
let response = client
let response = self
.client
.post(self.url.as_ref())
.json(&request_json_rpc)
.send()
Expand Down
Loading