ibc_query/core/
context.rs1use ibc::core::channel::types::channel::IdentifiedChannelEnd;
4use ibc::core::channel::types::packet::PacketState;
5use ibc::core::client::types::Height;
6use ibc::core::connection::types::IdentifiedConnectionEnd;
7use ibc::core::host::types::error::HostError;
8use ibc::core::host::types::identifiers::{ClientId, ConnectionId, Sequence};
9use ibc::core::host::types::path::{ChannelEndPath, Path};
10use ibc::core::host::{ClientStateRef, ConsensusStateRef, ValidationContext};
11use ibc::core::primitives::prelude::*;
12
13pub trait ProvableContext {
15 fn get_proof(&self, height: Height, path: &Path) -> Option<Vec<u8>>;
18}
19
20pub trait QueryContext: ProvableContext + ValidationContext {
22 fn client_states(&self) -> Result<Vec<(ClientId, ClientStateRef<Self>)>, HostError>;
26
27 fn consensus_states(
29 &self,
30 client_id: &ClientId,
31 ) -> Result<Vec<(Height, ConsensusStateRef<Self>)>, HostError>;
32
33 fn consensus_state_heights(&self, client_id: &ClientId) -> Result<Vec<Height>, HostError>;
35
36 fn connection_ends(&self) -> Result<Vec<IdentifiedConnectionEnd>, HostError>;
40
41 fn client_connection_ends(&self, client_id: &ClientId) -> Result<Vec<ConnectionId>, HostError>;
43
44 fn channel_ends(&self) -> Result<Vec<IdentifiedChannelEnd>, HostError>;
48
49 fn packet_commitments(
53 &self,
54 channel_end_path: &ChannelEndPath,
55 ) -> Result<Vec<PacketState>, HostError>;
56
57 fn packet_acknowledgements(
60 &self,
61 channel_end_path: &ChannelEndPath,
62 sequences: impl ExactSizeIterator<Item = Sequence>,
63 ) -> Result<Vec<PacketState>, HostError>;
64
65 fn unreceived_packets(
67 &self,
68 channel_end_path: &ChannelEndPath,
69 sequences: impl ExactSizeIterator<Item = Sequence>,
70 ) -> Result<Vec<Sequence>, HostError>;
71
72 fn unreceived_acks(
75 &self,
76 channel_end_path: &ChannelEndPath,
77 sequences: impl ExactSizeIterator<Item = Sequence>,
78 ) -> Result<Vec<Sequence>, HostError>;
79}