xrpl_api/api/
server_state.rs

1//! The server_state command asks the server for various machine-readable
2//! information about the rippled server's current state. The response is
3//! almost the same as the server_info method, but uses units that are easier
4//! to process instead of easier to read. (For example, XRP values are given in
5//! integer drops instead of scientific notation or decimal values, and time is
6//! given in milliseconds instead of seconds.)
7//!
8//! <https://xrpl.org/server_state.html>
9
10use crate::Request;
11use serde::{Deserialize, Serialize};
12
13#[derive(Default, Debug, Clone, Serialize)]
14pub struct ServerStateRequest {}
15
16impl Request for ServerStateRequest {
17    type Response = ServerStateResponse;
18
19    fn method(&self) -> String {
20        "server_state".to_owned()
21    }
22}
23
24impl ServerStateRequest {
25    pub fn new() -> Self {
26        Self::default()
27    }
28}
29
30#[derive(Debug, Deserialize)]
31pub struct SSValidatedLedger {
32    pub seq: u32,
33    pub base_fee: u64,
34}
35
36#[derive(Debug, Deserialize)]
37pub struct ServerState {
38    pub validated_ledger: SSValidatedLedger,
39}
40
41#[derive(Debug, Deserialize)]
42pub struct ServerStateResponse {
43    pub state: ServerState,
44}