在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:apoelstra/rust-jsonrpc开源软件地址:https://github.com/apoelstra/rust-jsonrpc开源编程语言:Rust 96.2%开源软件介绍:Rust Version compatibilityThis library is compatible with Rust 1.41.1 or higher. Rust JSONRPC ClientRudimentary support for sending JSONRPC 2.0 requests and receiving responses. As an example, hit a local bitcoind JSON-RPC endpoint and call the use jsonrpc::Client;
use jsonrpc::simple_http::{self, SimpleHttpTransport};
fn client(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.
fn main() {
let client = client("localhost:18443", "user", "pass").expect("failed to create client");
let request = client.build_request("uptime", &[]);
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);
} GithooksTo 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:
Alternatively add symlinks in your |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论