ibc_client_cw/types/
response.rs

1//! Contains the response types for the CosmWasm contract.
2use cosmwasm_schema::cw_serde;
3use ibc_core::client::types::{Height, Status};
4
5/// The response to [`super::msgs::QueryMsg::Status`]
6#[cw_serde]
7pub struct StatusResponse {
8    /// The status of the client
9    pub status: Status,
10}
11
12/// The response to [`super::msgs::QueryMsg::TimestampAtHeight`]
13#[cw_serde]
14pub struct TimestampAtHeightResponse {
15    /// The timestamp at the given height
16    pub timestamp: u64,
17}
18
19/// The response to [`super::QueryMsg::VerifyClientMessage`]
20#[cw_serde]
21pub struct VerifyClientMessageResponse {
22    /// Whether the client message is valid
23    pub is_valid: bool,
24}
25
26/// The response to [`super::msgs::QueryMsg::CheckForMisbehaviour`]
27#[cw_serde]
28pub struct CheckForMisbehaviourResponse {
29    /// Whether misbehaviour was found
30    pub found_misbehaviour: bool,
31}
32
33#[cw_serde]
34pub struct ContractResult {
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub heights: Option<Vec<Height>>,
37}
38
39impl ContractResult {
40    pub fn success() -> Self {
41        Self { heights: None }
42    }
43
44    pub fn heights(mut self, heights: Vec<Height>) -> Self {
45        self.heights = Some(heights);
46        self
47    }
48}