cosmos_sdk_proto_nymlab/prost/ibc-go/
ibc.applications.interchain_accounts.controller.v1.tonic.rs1#[cfg(feature = "grpc")]
4#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
5pub mod query_client {
6 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
7 use tonic::codegen::http::Uri;
8 use tonic::codegen::*;
9 #[derive(Debug, Clone)]
10 pub struct QueryClient<T> {
11 inner: tonic::client::Grpc<T>,
12 }
13 #[cfg(feature = "grpc-transport")]
14 #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
15 impl QueryClient<tonic::transport::Channel> {
16 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
18 where
19 D: std::convert::TryInto<tonic::transport::Endpoint>,
20 D::Error: Into<StdError>,
21 {
22 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
23 Ok(Self::new(conn))
24 }
25 }
26 impl<T> QueryClient<T>
27 where
28 T: tonic::client::GrpcService<tonic::body::BoxBody>,
29 T::Error: Into<StdError>,
30 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
31 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
32 {
33 pub fn new(inner: T) -> Self {
34 let inner = tonic::client::Grpc::new(inner);
35 Self { inner }
36 }
37 pub fn with_origin(inner: T, origin: Uri) -> Self {
38 let inner = tonic::client::Grpc::with_origin(inner, origin);
39 Self { inner }
40 }
41 pub fn with_interceptor<F>(
42 inner: T,
43 interceptor: F,
44 ) -> QueryClient<InterceptedService<T, F>>
45 where
46 F: tonic::service::Interceptor,
47 T::ResponseBody: Default,
48 T: tonic::codegen::Service<
49 http::Request<tonic::body::BoxBody>,
50 Response = http::Response<
51 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
52 >,
53 >,
54 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
55 Into<StdError> + Send + Sync,
56 {
57 QueryClient::new(InterceptedService::new(inner, interceptor))
58 }
59 #[must_use]
64 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
65 self.inner = self.inner.send_compressed(encoding);
66 self
67 }
68 #[must_use]
70 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
71 self.inner = self.inner.accept_compressed(encoding);
72 self
73 }
74 pub async fn interchain_account(
75 &mut self,
76 request: impl tonic::IntoRequest<super::QueryInterchainAccountRequest>,
77 ) -> Result<tonic::Response<super::QueryInterchainAccountResponse>, tonic::Status> {
78 self.inner.ready().await.map_err(|e| {
79 tonic::Status::new(
80 tonic::Code::Unknown,
81 format!("Service was not ready: {}", e.into()),
82 )
83 })?;
84 let codec = tonic::codec::ProstCodec::default();
85 let path = http::uri::PathAndQuery::from_static(
86 "/ibc.applications.interchain_accounts.controller.v1.Query/InterchainAccount",
87 );
88 self.inner.unary(request.into_request(), path, codec).await
89 }
90 pub async fn params(
91 &mut self,
92 request: impl tonic::IntoRequest<super::QueryParamsRequest>,
93 ) -> Result<tonic::Response<super::QueryParamsResponse>, tonic::Status> {
94 self.inner.ready().await.map_err(|e| {
95 tonic::Status::new(
96 tonic::Code::Unknown,
97 format!("Service was not ready: {}", e.into()),
98 )
99 })?;
100 let codec = tonic::codec::ProstCodec::default();
101 let path = http::uri::PathAndQuery::from_static(
102 "/ibc.applications.interchain_accounts.controller.v1.Query/Params",
103 );
104 self.inner.unary(request.into_request(), path, codec).await
105 }
106 }
107}
108#[cfg(feature = "grpc")]
110#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
111pub mod msg_client {
112 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
113 use tonic::codegen::http::Uri;
114 use tonic::codegen::*;
115 #[derive(Debug, Clone)]
116 pub struct MsgClient<T> {
117 inner: tonic::client::Grpc<T>,
118 }
119 #[cfg(feature = "grpc-transport")]
120 #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
121 impl MsgClient<tonic::transport::Channel> {
122 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
124 where
125 D: std::convert::TryInto<tonic::transport::Endpoint>,
126 D::Error: Into<StdError>,
127 {
128 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
129 Ok(Self::new(conn))
130 }
131 }
132 impl<T> MsgClient<T>
133 where
134 T: tonic::client::GrpcService<tonic::body::BoxBody>,
135 T::Error: Into<StdError>,
136 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
137 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
138 {
139 pub fn new(inner: T) -> Self {
140 let inner = tonic::client::Grpc::new(inner);
141 Self { inner }
142 }
143 pub fn with_origin(inner: T, origin: Uri) -> Self {
144 let inner = tonic::client::Grpc::with_origin(inner, origin);
145 Self { inner }
146 }
147 pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
148 where
149 F: tonic::service::Interceptor,
150 T::ResponseBody: Default,
151 T: tonic::codegen::Service<
152 http::Request<tonic::body::BoxBody>,
153 Response = http::Response<
154 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
155 >,
156 >,
157 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
158 Into<StdError> + Send + Sync,
159 {
160 MsgClient::new(InterceptedService::new(inner, interceptor))
161 }
162 #[must_use]
167 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
168 self.inner = self.inner.send_compressed(encoding);
169 self
170 }
171 #[must_use]
173 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
174 self.inner = self.inner.accept_compressed(encoding);
175 self
176 }
177 pub async fn register_interchain_account(
178 &mut self,
179 request: impl tonic::IntoRequest<super::MsgRegisterInterchainAccount>,
180 ) -> Result<tonic::Response<super::MsgRegisterInterchainAccountResponse>, tonic::Status>
181 {
182 self.inner.ready().await.map_err(|e| {
183 tonic::Status::new(
184 tonic::Code::Unknown,
185 format!("Service was not ready: {}", e.into()),
186 )
187 })?;
188 let codec = tonic::codec::ProstCodec::default();
189 let path = http::uri::PathAndQuery::from_static(
190 "/ibc.applications.interchain_accounts.controller.v1.Msg/RegisterInterchainAccount",
191 );
192 self.inner.unary(request.into_request(), path, codec).await
193 }
194 pub async fn send_tx(
195 &mut self,
196 request: impl tonic::IntoRequest<super::MsgSendTx>,
197 ) -> Result<tonic::Response<super::MsgSendTxResponse>, tonic::Status> {
198 self.inner.ready().await.map_err(|e| {
199 tonic::Status::new(
200 tonic::Code::Unknown,
201 format!("Service was not ready: {}", e.into()),
202 )
203 })?;
204 let codec = tonic::codec::ProstCodec::default();
205 let path = http::uri::PathAndQuery::from_static(
206 "/ibc.applications.interchain_accounts.controller.v1.Msg/SendTx",
207 );
208 self.inner.unary(request.into_request(), path, codec).await
209 }
210 }
211}