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
#![cfg(feature = "stargate")]
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::ibc::IbcChannel;
/// These are queries to the various IBC modules to see the state of the contract's
/// IBC connection. These will return errors if the contract is not "ibc enabled"
#[non_exhaustive]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum IbcQuery {
/// Gets the Port ID the current contract is bound to.
///
/// Returns a `PortIdResponse`.
PortId {},
/// Lists all channels that are bound to a given port.
/// If `port_id` is omitted, this list all channels bound to the contract's port.
///
/// Returns a `ListChannelsResponse`.
ListChannels { port_id: Option<String> },
/// Lists all information for a (portID, channelID) pair.
/// If port_id is omitted, it will default to the contract's own channel.
/// (To save a PortId{} call)
///
/// Returns a `ChannelResponse`.
Channel {
channel_id: String,
port_id: Option<String>,
},
// TODO: Add more
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct PortIdResponse {
pub port_id: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct ListChannelsResponse {
pub channels: Vec<IbcChannel>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct ChannelResponse {
pub channel: Option<IbcChannel>,
}