accumulate_api/
blocks.rs

1use crate::*;
2use serde::{Deserialize, Serialize};
3use serde_json::json;
4
5use types;
6
7
8pub async fn get_range_major(
9	client: &Client,
10	scope: &str,
11	start: u64,
12	count: u64,
13	expand: bool,
14	from_end: bool,
15) -> Result<types::blocks_major::MajorBlocksRangeResponse> {
16	let json = json!(ApiCall::query_major_blocks(
17		scope.to_string(),
18		start,
19		count,
20		expand,
21		from_end
22	));
23	println!("{}", json);
24
25	let url_path = &("/v".to_string() + client.version.to_string().as_str());
26	client.post(url_path, &json).await
27}
28
29pub async fn get_range_minor(
30	client: &Client,
31	scope: &str,
32	start: u64,
33	count: u64,
34	expand: bool,
35	from_end: bool,
36) -> Result<types::blocks_major::MajorBlocksRangeResponse> {
37	let json = json!(ApiCall::query_minor_blocks(
38		scope.to_string(),
39		start,
40		count,
41		expand,
42		from_end
43	));
44	println!("{}", json);
45
46	let url_path = &("/v".to_string() + client.version.to_string().as_str());
47	client.post(url_path, &json).await
48}