use crate::Request;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Default, Debug, Clone, Serialize)]
pub struct ServerInfoRequest {}
impl Request for ServerInfoRequest {
type Response = ServerInfoResponse;
fn method(&self) -> String {
"server_info".to_owned()
}
}
impl ServerInfoRequest {
pub fn new() -> Self {
Self::default()
}
}
#[derive(Debug, Deserialize)]
pub struct StateAccountingInfo {
pub duration_us: String,
pub transitions: String,
}
#[derive(Debug, Deserialize)]
pub struct SIValidatedLedger {
pub seq: u32,
pub base_fee_xrp: f64,
}
#[derive(Debug, Deserialize)]
pub struct ServerInfo {
pub amendment_blocked: Option<bool>,
pub build_version: Option<String>,
pub peers: Option<u32>,
pub hostid: Option<String>,
pub server_state: Option<String>,
pub state_accounting: Option<HashMap<String, StateAccountingInfo>>,
pub time: Option<String>,
pub uptime: Option<u32>,
pub validated_ledger: SIValidatedLedger,
}
#[derive(Debug, Deserialize)]
pub struct ServerInfoResponse {
pub info: ServerInfo,
}