cosm_tome_wasm_deploy_fork/modules/tendermint/
api.rs

1use cosmrs::proto::cosmos::base::tendermint::v1beta1::{
2    GetLatestBlockRequest, GetLatestBlockResponse,
3};
4
5use crate::clients::client::{CosmTome, CosmosClient};
6
7use super::{error::TendermintError, model::BlockResponse};
8
9impl<T: CosmosClient> CosmTome<T> {
10    pub async fn tendermint_query_latest_block(&self) -> Result<BlockResponse, TendermintError> {
11        let req = GetLatestBlockRequest {};
12
13        let res = self
14            .client
15            .query::<_, GetLatestBlockResponse>(
16                req,
17                "/cosmos.base.tendermint.v1beta1.Service/GetLatestBlock",
18            )
19            .await?;
20
21        res.try_into()
22    }
23}