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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//! Contains a set of utility traits and implementations for querying the state
//! of an `ibc-rs` enabled chain, including implementation of essential IBC
//! query methods and gRPC query services defined in `ibc-proto` crate.
//! Therefore, some ready-to-use Query structs for each layer of the client,
//! connection, and channel have been implemented and exposed by this crate.
//!
//! The provided structs includes blanket implementation of their corresponding
//! gRPC service traits, if the host implements the following _context_ traits:
//! - [`ValidationContext`](ibc::core::host::ValidationContext)
//! - [`ProvableContext`](crate::core::context::ProvableContext)
//! - [`QueryContext`](crate::core::context::QueryContext)
//! - [`UpgradeValidationContext`](ibc::cosmos_host::upgrade_proposal::UpgradeValidationContext)
//! - Only for
//! [`ClientQuery::upgraded_client_state`](ibc_proto::ibc::core::client::v1::query_server::Query::upgraded_client_state)
//! and
//! [`ClientQuery::upgraded_client_state`](ibc_proto::ibc::core::client::v1::query_server::Query::upgraded_consensus_state)
//!
//! Example
//! ```rust,ignore
//! use ibc_proto::ibc::core::{
//! channel::v1::query_server::QueryServer as ChannelQueryServer
//! client::v1::query_server::QueryServer as ClientQueryServer,
//! connection::v1::query_server::QueryServer as ConnectionQueryServer,
//! }
//! use ibc::core::ValidationContext;
//! use ibc::hosts::tendermint::upgrade_proposal::UpgradeValidationContext;
//! use ibc::services::core::{ProvableContext, QueryContext};
//! use ibc::services::{ChannelQueryService, ClientQueryService, ConnectionQueryService};
//!
//! struct Ibc;
//! impl ValidationContext for Ibc { }
//! impl ProvableContext for Ibc { }
//! impl QueryContext for Ibc { }
//!
//! struct Upgrade;
//! impl UpgradeValidationContext for Upgrade { }
//!
//! let ibc = Ibc::new();
//! let upgrade = Upgrade::new();
//!
//! // `ibc` and `upgrade` must be thread-safe
//!
//! let client_service = ClientQueryServer::new(ClientQueryService::new(ibc.clone(), upgrade))
//! let connection_service = ConnectionQueryServer::new(ConnectionQueryService::new(ibc.clone()))
//! let channel_service = ChannelQueryServer::new(ChannelQueryService::new(ibc))
//!
//! let grpc_server = tonic::transport::Server::builder()
//! .add_service(client_service)
//! .add_service(connection_service)
//! .add_service(channel_service)
//! .serve(addr);
//! ```
//!
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![no_std]
#![deny(
warnings,
trivial_casts,
trivial_numeric_casts,
unused_import_braces,
unused_qualifications,
rust_2018_idioms
)]
#![forbid(unsafe_code)]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
pub mod core;
pub mod error;
pub mod types;
pub mod utils;