use cometbft::block::Height;
use serde::{Deserialize, Serialize};
use crate::{dialect::Dialect, request::RequestMessage};
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct Request {
pub height: Option<Height>,
}
impl Request {
pub fn new(maybe_height: Option<Height>) -> Self {
Self {
height: maybe_height,
}
}
}
impl RequestMessage for Request {
fn method(&self) -> crate::Method {
crate::Method::ConsensusParams
}
}
impl<S: Dialect> crate::Request<S> for Request {
type Response = Response;
}
impl<S: Dialect> crate::SimpleRequest<S> for Request {
type Output = Response;
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Response {
pub block_height: Height,
pub consensus_params: cometbft::consensus::Params,
}
impl crate::Response for Response {}