9 unstable releases (4 breaking)

new 0.5.0 Nov 8, 2024
0.4.0 May 3, 2024
0.3.1 Apr 25, 2024
0.3.0 Feb 28, 2024
0.1.1 Dec 30, 2019

#1 in #nimiq

Download history 149/week @ 2024-07-19 86/week @ 2024-07-26 564/week @ 2024-08-02 1533/week @ 2024-08-09 2548/week @ 2024-08-16 3587/week @ 2024-08-23 4756/week @ 2024-08-30 4714/week @ 2024-09-06 4625/week @ 2024-09-13 4795/week @ 2024-09-20 4731/week @ 2024-09-27 3718/week @ 2024-10-04 3105/week @ 2024-10-11 1667/week @ 2024-10-18 554/week @ 2024-10-25 30/week @ 2024-11-01

5,820 downloads per month

Apache-2.0

41KB
503 lines

Build Crates.io

Nimiq Rust Client

Rust implementation of the Nimiq RPC client specs.

About

A Nimiq RPC client library in Rust. This client library implements the Nimiq RPC specification. The client uses the jsonrpsee library to handle JSON-RPC 2.0 requests and responses. For more information about this library see the jsonrpsee HTTP client documentation.

Usage

use nimiq_rpc::Client;

#[tokio::main]
async fn main() {
	let client = Client::new("http://seed-host.com:8648/".to_string());
	// If your node uses credentials
	let client = Client::new_with_credentials("http://seed-host.com:8648/".to_string(), "user".to_string(), "password".to_string());
	
	println!("{:?}", client.accounts().await.unwrap());
	println!("{:?}", client.block_number().await.unwrap());
	println!("{:?}", client.hashrate().await.unwrap());
	println!("{:?}", client.log("*", "log").await.unwrap());
}

Documentation

Docs.rs link to the official crate documentation. And check out the Nimiq RPC specs for details.

Installation

Add the crate to your Cargo.toml file.

Contributions

This implementation was originally contributed by Eligioo.

Please send your contributions as pull requests. Refer to the issue tracker for ideas.

License

Apache 2.0

Dependencies

~10–20MB
~272K SLoC