cometbft_rpc/endpoint/
block.rs1use cometbft::block::{self, Block};
4use serde::{Deserialize, Serialize};
5
6use crate::{dialect::Dialect, request::RequestMessage};
7
8#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
10pub struct Request {
11 pub height: Option<block::Height>,
15}
16
17impl Request {
18 pub fn new(height: block::Height) -> Self {
20 Self {
21 height: Some(height),
22 }
23 }
24}
25
26impl RequestMessage for Request {
27 fn method(&self) -> crate::Method {
28 crate::Method::Block
29 }
30}
31
32impl<S: Dialect> crate::Request<S> for Request {
33 type Response = Response;
34}
35
36impl<S: Dialect> crate::SimpleRequest<S> for Request {
37 type Output = Response;
38}
39
40#[derive(Clone, Debug, Deserialize, Serialize)]
42pub struct Response {
43 pub block_id: block::Id,
45
46 pub block: Block,
48}
49
50impl crate::Response for Response {}