4 releases

0.1.3 May 9, 2023
0.1.2 Apr 6, 2023
0.1.1 Mar 28, 2023
0.1.0 Mar 7, 2023

#21 in #server-url

Download history 5/week @ 2023-11-05 10/week @ 2023-11-12 5/week @ 2023-11-19 18/week @ 2023-11-26 7/week @ 2023-12-03 7/week @ 2023-12-10 4/week @ 2023-12-17 14/week @ 2023-12-24 3/week @ 2023-12-31 4/week @ 2024-01-07 4/week @ 2024-01-14 3/week @ 2024-01-21 11/week @ 2024-01-28 4/week @ 2024-02-04 19/week @ 2024-02-11 81/week @ 2024-02-18

115 downloads per month
Used in rhoast_wallet

MIT/Apache

68KB
1.5K SLoC

The Rhoast Client

This crate allows you to easily communicate with a running version0.12.x node using typed safe rust via the node's grpc and http modules.

// example of a grpc propose and getting a block via hash
use rhoast_client::grpc::Grpc;
use rhoast_client::proto::casper::BlocksQueryByHeight;
use rhoast_client::http::Http;

 let grpc=Grpc::new("endpoint");
 let http= Http::new("endpoint")
 let propose = grpc.propose(true).await.unwrap();
 let block_info = http.hash_block_call(&"hash".to_string()).await.unwrap()

//for grpc stream actions like visualize_dag_util_stream, show_main_chain_util_stream, show_blocks_util_stream,
// get_blocks_by_height_util_stream  pass in a function that takes in the returned value of the stream
// as well as how many stream events should be listned to, passing in None as the number of optional stream event
// would make the grpc listen forever

let block_query=BlocksQueryByHeight{
    start_block_number: 1,
    end_block_number: 40
}
fn write_stream_to_file(input: &BlockInfoResponse){
//write input to file
}
grpc.get_blocks_by_height_util_stream(block_query, write_stream_to_file, Some(40)).await.unwrap();

Link to doc here

Test

  • To run test exec URL=http://server_url PORT=port_number cargo test if no URL env var is provided, all test would be skipped

Dependencies

~18–33MB
~439K SLoC