tendermint_rpc/endpoint/
commit.rs

1//! `/commit` endpoint JSON-RPC wrapper
2
3use serde::{Deserialize, Serialize};
4use tendermint::{block, block::signed_header::SignedHeader};
5
6use crate::{dialect::Dialect, request::RequestMessage};
7
8/// Get commit information about a specific block
9#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
10pub struct Request {
11    pub height: Option<block::Height>,
12}
13
14impl Request {
15    /// Create a new request for commit info about a particular block
16    pub fn new(height: block::Height) -> Self {
17        Self {
18            height: Some(height),
19        }
20    }
21}
22
23impl RequestMessage for Request {
24    fn method(&self) -> crate::Method {
25        crate::Method::Commit
26    }
27}
28
29impl<S: Dialect> crate::Request<S> for Request {
30    type Response = Response;
31}
32
33impl<S: Dialect> crate::SimpleRequest<S> for Request {
34    type Output = Response;
35}
36
37/// Commit responses
38#[derive(Clone, Debug, Deserialize, Serialize)]
39pub struct Response {
40    /// Signed header
41    pub signed_header: SignedHeader,
42
43    /// Is the signed header canonical?
44    pub canonical: bool,
45}
46
47impl crate::Response for Response {}