use ibc::core::channel::types::channel::IdentifiedChannelEnd;
use ibc::core::channel::types::packet::PacketState;
use ibc::core::client::types::Height;
use ibc::core::connection::types::IdentifiedConnectionEnd;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::identifiers::{ClientId, ConnectionId, Sequence};
use ibc::core::host::types::path::{ChannelEndPath, Path};
use ibc::core::host::{ClientStateRef, ConsensusStateRef, ValidationContext};
use ibc::core::primitives::prelude::*;
pub trait ProvableContext {
fn get_proof(&self, height: Height, path: &Path) -> Option<Vec<u8>>;
}
pub trait QueryContext: ProvableContext + ValidationContext {
fn client_states(&self) -> Result<Vec<(ClientId, ClientStateRef<Self>)>, ContextError>;
fn consensus_states(
&self,
client_id: &ClientId,
) -> Result<Vec<(Height, ConsensusStateRef<Self>)>, ContextError>;
fn consensus_state_heights(&self, client_id: &ClientId) -> Result<Vec<Height>, ContextError>;
fn connection_ends(&self) -> Result<Vec<IdentifiedConnectionEnd>, ContextError>;
fn client_connection_ends(
&self,
client_id: &ClientId,
) -> Result<Vec<ConnectionId>, ContextError>;
fn channel_ends(&self) -> Result<Vec<IdentifiedChannelEnd>, ContextError>;
fn packet_commitments(
&self,
channel_end_path: &ChannelEndPath,
) -> Result<Vec<PacketState>, ContextError>;
fn packet_acknowledgements(
&self,
channel_end_path: &ChannelEndPath,
sequences: impl ExactSizeIterator<Item = Sequence>,
) -> Result<Vec<PacketState>, ContextError>;
fn unreceived_packets(
&self,
channel_end_path: &ChannelEndPath,
sequences: impl ExactSizeIterator<Item = Sequence>,
) -> Result<Vec<Sequence>, ContextError>;
fn unreceived_acks(
&self,
channel_end_path: &ChannelEndPath,
sequences: impl ExactSizeIterator<Item = Sequence>,
) -> Result<Vec<Sequence>, ContextError>;
}