forked from bitcoin-dev-project/warnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clear out tokio/jsonrpsee; insert jsonrpc
- Loading branch information
Showing
10 changed files
with
98 additions
and
823 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
use jsonrpsee::{core::client::ClientT, http_client::HttpClientBuilder}; | ||
use anyhow::Context; | ||
use jsonrpc::{simple_http::SimpleHttpTransport, Client}; | ||
|
||
use serde_json::Value; | ||
use serde_json::{value::to_raw_value, Value}; | ||
|
||
pub async fn make_rpc_call( | ||
request: &str, | ||
params: jsonrpsee::core::params::ObjectParams, | ||
) -> anyhow::Result<serde_json::Value> { | ||
pub fn make_rpc_call(request: &str, params: &Value) -> anyhow::Result<serde_json::Value> { | ||
let params = to_raw_value(¶ms)?; | ||
let url = "http://127.0.0.1:9276/api"; | ||
let client = HttpClientBuilder::default().build(url)?; | ||
let response = client.request::<Value, _>(request, params).await?; | ||
Ok(response) | ||
let t = SimpleHttpTransport::builder().url(url)?.build(); | ||
let client = Client::with_transport(t); | ||
let req = client.build_request(request, Some(¶ms)); | ||
let response = client.send_request(req)?; | ||
response | ||
.result() | ||
.with_context(|| format!("RPC call failed: {}", request)) | ||
} |
Oops, something went wrong.