ibc_client_cw/types/
response.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Contains the response types for the CosmWasm contract.
use cosmwasm_schema::cw_serde;
use ibc_core::client::types::{Height, Status};

/// The response to [`super::msgs::QueryMsg::Status`]
#[cw_serde]
pub struct StatusResponse {
    /// The status of the client
    pub status: Status,
}

/// The response to [`super::msgs::QueryMsg::TimestampAtHeight`]
#[cw_serde]
pub struct TimestampAtHeightResponse {
    /// The timestamp at the given height
    pub timestamp: u64,
}

/// The response to [`super::QueryMsg::VerifyClientMessage`]
#[cw_serde]
pub struct VerifyClientMessageResponse {
    /// Whether the client message is valid
    pub is_valid: bool,
}

/// The response to [`super::msgs::QueryMsg::CheckForMisbehaviour`]
#[cw_serde]
pub struct CheckForMisbehaviourResponse {
    /// Whether misbehaviour was found
    pub found_misbehaviour: bool,
}

#[cw_serde]
pub struct ContractResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub heights: Option<Vec<Height>>,
}

impl ContractResult {
    pub fn success() -> Self {
        Self { heights: None }
    }

    pub fn heights(mut self, heights: Vec<Height>) -> Self {
        self.heights = Some(heights);
        self
    }
}