You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2024. It is now read-only.
This library is compatible with Rust 1.63.0 or higher.
Rust JSONRPC Client
Rudimentary support for sending JSONRPC 2.0 requests and receiving responses.
As an example, hit a local bitcoind JSON-RPC endpoint and call the uptime command.
use jsonrpc::Client;use jsonrpc::simple_http::{self,SimpleHttpTransport};fnclient(url:&str,user:&str,pass:&str) -> Result<Client, simple_http::Error>{let t = SimpleHttpTransport::builder().url(url)?
.auth(user,Some(pass)).build();Ok(Client::with_transport(t))}// Demonstrate an example JSON-RCP call against bitcoind.fnmain(){let client = client("localhost:18443","user","pass").expect("failed to create client");let request = client.build_request("uptime",None);let response = client.send_request(request).expect("send_request failed");// For other commands this would be a struct matching the returned json.let result:u64 = response.result().expect("response is an error, use check_error");println!("bitcoind uptime: {}", result);}
Githooks
To assist devs in catching errors before running CI we provide some githooks. If you do not
already have locally configured githooks you can use the ones in this repository by running, in the
root directory of the repository:
git config --local core.hooksPath githooks/
Alternatively add symlinks in your .git/hooks directory to any of the githooks we provide.