1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{
models::{QueryTimeRange, Reward, Validator, ValidatorStats},
*,
};
pub fn all(client: &Client) -> Stream<Validator> {
client.fetch_stream("/validators", NO_QUERY)
}
pub async fn get(client: &Client, address: &str) -> Result<Validator> {
client
.fetch(&format!("/validators/{}", address), NO_QUERY)
.await
}
pub async fn stats(client: &Client) -> Result<ValidatorStats> {
client.fetch("/validators/stats", NO_QUERY).await
}
pub fn rewards(client: &Client, address: &str, query: &QueryTimeRange) -> Stream<Reward> {
client.fetch_stream(&format!("/validators/{}/rewards", address), query)
}