use crate::client::Client;
use crate::command::request::request;
use crate::command::CallableCommand;
use serde::Deserialize;
use serde::Serialize;
use serde_json::value::RawValue;
pub struct GetMempoolInfoCommand {}
impl GetMempoolInfoCommand {
pub fn new() -> Self {
GetMempoolInfoCommand {}
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct GetMempoolInfoCommandResponse {
loaded: bool,
size: u64,
bytes: u64,
usage: u64,
total_fee: f64,
maxmempool: u64,
mempoolminfee: f64,
minrelaytxfee: f64,
unbroadcastcount: u64,
}
impl CallableCommand for GetMempoolInfoCommand {
type Response = GetMempoolInfoCommandResponse;
fn call(&self, client: &Client) -> Result<Self::Response, jsonrpc::Error> {
let command = "getmempoolinfo";
let params: Vec<Box<RawValue>> = vec![];
let r = request(client, command, params);
let response: GetMempoolInfoCommandResponse = r.result()?;
Ok(response)
}
}