#[derive(::serde::Serialize, ::serde::Deserialize)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConnectionEnd {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag="2")]
pub versions: ::prost::alloc::vec::Vec<Version>,
#[prost(enumeration="State", tag="3")]
pub state: i32,
#[prost(message, optional, tag="4")]
pub counterparty: ::core::option::Option<Counterparty>,
#[prost(uint64, tag="5")]
pub delay_period: u64,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IdentifiedConnection {
#[prost(string, tag="1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub client_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag="3")]
pub versions: ::prost::alloc::vec::Vec<Version>,
#[prost(enumeration="State", tag="4")]
pub state: i32,
#[prost(message, optional, tag="5")]
pub counterparty: ::core::option::Option<Counterparty>,
#[prost(uint64, tag="6")]
pub delay_period: u64,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Counterparty {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub connection_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="3")]
pub prefix: ::core::option::Option<super::super::commitment::v1::MerklePrefix>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClientPaths {
#[prost(string, repeated, tag="1")]
pub paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConnectionPaths {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, repeated, tag="2")]
pub paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Version {
#[prost(string, tag="1")]
pub identifier: ::prost::alloc::string::String,
#[prost(string, repeated, tag="2")]
pub features: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Params {
#[prost(uint64, tag="1")]
pub max_expected_time_per_block: u64,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
UninitializedUnspecified = 0,
Init = 1,
Tryopen = 2,
Open = 3,
}
impl State {
pub fn as_str_name(&self) -> &'static str {
match self {
State::UninitializedUnspecified => "STATE_UNINITIALIZED_UNSPECIFIED",
State::Init => "STATE_INIT",
State::Tryopen => "STATE_TRYOPEN",
State::Open => "STATE_OPEN",
}
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisState {
#[prost(message, repeated, tag="1")]
pub connections: ::prost::alloc::vec::Vec<IdentifiedConnection>,
#[prost(message, repeated, tag="2")]
pub client_connection_paths: ::prost::alloc::vec::Vec<ConnectionPaths>,
#[prost(uint64, tag="3")]
pub next_connection_sequence: u64,
#[prost(message, optional, tag="4")]
pub params: ::core::option::Option<Params>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenInit {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub counterparty: ::core::option::Option<Counterparty>,
#[prost(message, optional, tag="3")]
pub version: ::core::option::Option<Version>,
#[prost(uint64, tag="4")]
pub delay_period: u64,
#[prost(string, tag="5")]
pub signer: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenInitResponse {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenTry {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag="2")]
pub previous_connection_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="3")]
pub client_state: ::core::option::Option<super::super::super::super::google::protobuf::Any>,
#[prost(message, optional, tag="4")]
pub counterparty: ::core::option::Option<Counterparty>,
#[prost(uint64, tag="5")]
pub delay_period: u64,
#[prost(message, repeated, tag="6")]
pub counterparty_versions: ::prost::alloc::vec::Vec<Version>,
#[prost(message, optional, tag="7")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
#[prost(bytes="vec", tag="8")]
pub proof_init: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="9")]
pub proof_client: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="10")]
pub proof_consensus: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="11")]
pub consensus_height: ::core::option::Option<super::super::client::v1::Height>,
#[prost(string, tag="12")]
pub signer: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenTryResponse {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenAck {
#[prost(string, tag="1")]
pub connection_id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub counterparty_connection_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="3")]
pub version: ::core::option::Option<Version>,
#[prost(message, optional, tag="4")]
pub client_state: ::core::option::Option<super::super::super::super::google::protobuf::Any>,
#[prost(message, optional, tag="5")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
#[prost(bytes="vec", tag="6")]
pub proof_try: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="7")]
pub proof_client: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="8")]
pub proof_consensus: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="9")]
pub consensus_height: ::core::option::Option<super::super::client::v1::Height>,
#[prost(string, tag="10")]
pub signer: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenAckResponse {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenConfirm {
#[prost(string, tag="1")]
pub connection_id: ::prost::alloc::string::String,
#[prost(bytes="vec", tag="2")]
pub proof_ack: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="3")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
#[prost(string, tag="4")]
pub signer: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgConnectionOpenConfirmResponse {
}
#[cfg(feature = "client")]
pub mod msg_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MsgClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MsgClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MsgClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MsgClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
MsgClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn connection_open_init(
&mut self,
request: impl tonic::IntoRequest<super::MsgConnectionOpenInit>,
) -> Result<
tonic::Response<super::MsgConnectionOpenInitResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Msg/ConnectionOpenInit",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connection_open_try(
&mut self,
request: impl tonic::IntoRequest<super::MsgConnectionOpenTry>,
) -> Result<
tonic::Response<super::MsgConnectionOpenTryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Msg/ConnectionOpenTry",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connection_open_ack(
&mut self,
request: impl tonic::IntoRequest<super::MsgConnectionOpenAck>,
) -> Result<
tonic::Response<super::MsgConnectionOpenAckResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Msg/ConnectionOpenAck",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connection_open_confirm(
&mut self,
request: impl tonic::IntoRequest<super::MsgConnectionOpenConfirm>,
) -> Result<
tonic::Response<super::MsgConnectionOpenConfirmResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Msg/ConnectionOpenConfirm",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[cfg(feature = "server")]
pub mod msg_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Msg: Send + Sync + 'static {
async fn connection_open_init(
&self,
request: tonic::Request<super::MsgConnectionOpenInit>,
) -> Result<
tonic::Response<super::MsgConnectionOpenInitResponse>,
tonic::Status,
>;
async fn connection_open_try(
&self,
request: tonic::Request<super::MsgConnectionOpenTry>,
) -> Result<tonic::Response<super::MsgConnectionOpenTryResponse>, tonic::Status>;
async fn connection_open_ack(
&self,
request: tonic::Request<super::MsgConnectionOpenAck>,
) -> Result<tonic::Response<super::MsgConnectionOpenAckResponse>, tonic::Status>;
async fn connection_open_confirm(
&self,
request: tonic::Request<super::MsgConnectionOpenConfirm>,
) -> Result<
tonic::Response<super::MsgConnectionOpenConfirmResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct MsgServer<T: Msg> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Msg> MsgServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
where
T: Msg,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/ibc.core.connection.v1.Msg/ConnectionOpenInit" => {
#[allow(non_camel_case_types)]
struct ConnectionOpenInitSvc<T: Msg>(pub Arc<T>);
impl<
T: Msg,
> tonic::server::UnaryService<super::MsgConnectionOpenInit>
for ConnectionOpenInitSvc<T> {
type Response = super::MsgConnectionOpenInitResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgConnectionOpenInit>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_open_init(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionOpenInitSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Msg/ConnectionOpenTry" => {
#[allow(non_camel_case_types)]
struct ConnectionOpenTrySvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgConnectionOpenTry>
for ConnectionOpenTrySvc<T> {
type Response = super::MsgConnectionOpenTryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgConnectionOpenTry>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_open_try(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionOpenTrySvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Msg/ConnectionOpenAck" => {
#[allow(non_camel_case_types)]
struct ConnectionOpenAckSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgConnectionOpenAck>
for ConnectionOpenAckSvc<T> {
type Response = super::MsgConnectionOpenAckResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgConnectionOpenAck>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_open_ack(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionOpenAckSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Msg/ConnectionOpenConfirm" => {
#[allow(non_camel_case_types)]
struct ConnectionOpenConfirmSvc<T: Msg>(pub Arc<T>);
impl<
T: Msg,
> tonic::server::UnaryService<super::MsgConnectionOpenConfirm>
for ConnectionOpenConfirmSvc<T> {
type Response = super::MsgConnectionOpenConfirmResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgConnectionOpenConfirm>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_open_confirm(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionOpenConfirmSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Msg> Clone for MsgServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
}
}
}
impl<T: Msg> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
const NAME: &'static str = "ibc.core.connection.v1.Msg";
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionRequest {
#[prost(string, tag="1")]
pub connection_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionResponse {
#[prost(message, optional, tag="1")]
pub connection: ::core::option::Option<ConnectionEnd>,
#[prost(bytes="vec", tag="2")]
pub proof: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="3")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionsRequest {
#[prost(message, optional, tag="1")]
pub pagination: ::core::option::Option<super::super::super::super::cosmos::base::query::v1beta1::PageRequest>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionsResponse {
#[prost(message, repeated, tag="1")]
pub connections: ::prost::alloc::vec::Vec<IdentifiedConnection>,
#[prost(message, optional, tag="2")]
pub pagination: ::core::option::Option<super::super::super::super::cosmos::base::query::v1beta1::PageResponse>,
#[prost(message, optional, tag="3")]
pub height: ::core::option::Option<super::super::client::v1::Height>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryClientConnectionsRequest {
#[prost(string, tag="1")]
pub client_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryClientConnectionsResponse {
#[prost(string, repeated, tag="1")]
pub connection_paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bytes="vec", tag="2")]
pub proof: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="3")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionClientStateRequest {
#[prost(string, tag="1")]
pub connection_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionClientStateResponse {
#[prost(message, optional, tag="1")]
pub identified_client_state: ::core::option::Option<super::super::client::v1::IdentifiedClientState>,
#[prost(bytes="vec", tag="2")]
pub proof: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="3")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionConsensusStateRequest {
#[prost(string, tag="1")]
pub connection_id: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub revision_number: u64,
#[prost(uint64, tag="3")]
pub revision_height: u64,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConnectionConsensusStateResponse {
#[prost(message, optional, tag="1")]
pub consensus_state: ::core::option::Option<super::super::super::super::google::protobuf::Any>,
#[prost(string, tag="2")]
pub client_id: ::prost::alloc::string::String,
#[prost(bytes="vec", tag="3")]
pub proof: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="4")]
pub proof_height: ::core::option::Option<super::super::client::v1::Height>,
}
#[cfg(feature = "client")]
pub mod query_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct QueryClient<T> {
inner: tonic::client::Grpc<T>,
}
impl QueryClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> QueryClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> QueryClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
QueryClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn connection(
&mut self,
request: impl tonic::IntoRequest<super::QueryConnectionRequest>,
) -> Result<tonic::Response<super::QueryConnectionResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Query/Connection",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connections(
&mut self,
request: impl tonic::IntoRequest<super::QueryConnectionsRequest>,
) -> Result<tonic::Response<super::QueryConnectionsResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Query/Connections",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn client_connections(
&mut self,
request: impl tonic::IntoRequest<super::QueryClientConnectionsRequest>,
) -> Result<
tonic::Response<super::QueryClientConnectionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Query/ClientConnections",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connection_client_state(
&mut self,
request: impl tonic::IntoRequest<super::QueryConnectionClientStateRequest>,
) -> Result<
tonic::Response<super::QueryConnectionClientStateResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Query/ConnectionClientState",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn connection_consensus_state(
&mut self,
request: impl tonic::IntoRequest<super::QueryConnectionConsensusStateRequest>,
) -> Result<
tonic::Response<super::QueryConnectionConsensusStateResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ibc.core.connection.v1.Query/ConnectionConsensusState",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[cfg(feature = "server")]
pub mod query_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Query: Send + Sync + 'static {
async fn connection(
&self,
request: tonic::Request<super::QueryConnectionRequest>,
) -> Result<tonic::Response<super::QueryConnectionResponse>, tonic::Status>;
async fn connections(
&self,
request: tonic::Request<super::QueryConnectionsRequest>,
) -> Result<tonic::Response<super::QueryConnectionsResponse>, tonic::Status>;
async fn client_connections(
&self,
request: tonic::Request<super::QueryClientConnectionsRequest>,
) -> Result<
tonic::Response<super::QueryClientConnectionsResponse>,
tonic::Status,
>;
async fn connection_client_state(
&self,
request: tonic::Request<super::QueryConnectionClientStateRequest>,
) -> Result<
tonic::Response<super::QueryConnectionClientStateResponse>,
tonic::Status,
>;
async fn connection_consensus_state(
&self,
request: tonic::Request<super::QueryConnectionConsensusStateRequest>,
) -> Result<
tonic::Response<super::QueryConnectionConsensusStateResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct QueryServer<T: Query> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Query> QueryServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
where
T: Query,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/ibc.core.connection.v1.Query/Connection" => {
#[allow(non_camel_case_types)]
struct ConnectionSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryConnectionRequest>
for ConnectionSvc<T> {
type Response = super::QueryConnectionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryConnectionRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).connection(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Query/Connections" => {
#[allow(non_camel_case_types)]
struct ConnectionsSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryConnectionsRequest>
for ConnectionsSvc<T> {
type Response = super::QueryConnectionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryConnectionsRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).connections(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Query/ClientConnections" => {
#[allow(non_camel_case_types)]
struct ClientConnectionsSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<super::QueryClientConnectionsRequest>
for ClientConnectionsSvc<T> {
type Response = super::QueryClientConnectionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QueryClientConnectionsRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).client_connections(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ClientConnectionsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Query/ConnectionClientState" => {
#[allow(non_camel_case_types)]
struct ConnectionClientStateSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<
super::QueryConnectionClientStateRequest,
> for ConnectionClientStateSvc<T> {
type Response = super::QueryConnectionClientStateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::QueryConnectionClientStateRequest,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_client_state(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionClientStateSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ibc.core.connection.v1.Query/ConnectionConsensusState" => {
#[allow(non_camel_case_types)]
struct ConnectionConsensusStateSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<
super::QueryConnectionConsensusStateRequest,
> for ConnectionConsensusStateSvc<T> {
type Response = super::QueryConnectionConsensusStateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::QueryConnectionConsensusStateRequest,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).connection_consensus_state(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ConnectionConsensusStateSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Query> Clone for QueryServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
}
}
}
impl<T: Query> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Query> tonic::server::NamedService for QueryServer<T> {
const NAME: &'static str = "ibc.core.connection.v1.Query";
}
}