bitcoind_request/command/
get_block_count.rs1use crate::command::CallableCommand;
15use crate::{client::Client, command::request::request};
16use serde::{Deserialize, Serialize};
17use serde_json::value::RawValue;
18
19pub struct GetBlockCountCommand {}
20impl GetBlockCountCommand {
21 pub fn new() -> Self {
22 GetBlockCountCommand {}
23 }
24}
25
26#[derive(Serialize, Deserialize, Debug)]
27pub struct GetBlockCountCommandResponse(pub u64);
28
29impl CallableCommand for GetBlockCountCommand {
30 type Response = GetBlockCountCommandResponse;
31 fn call(&self, client: &Client) -> Result<Self::Response, jsonrpc::Error> {
32 let command = "getblockcount";
33 let params: Vec<Box<RawValue>> = vec![];
34 let r = request(client, command, params);
35 let response: GetBlockCountCommandResponse = r.result()?;
36 Ok(response)
37 }
38}