ibc_proto/prost/
stride.interchainquery.v1.rs

1// This file is @generated by prost-build.
2/// MsgSubmitQueryResponse represents a message type to fulfil a query request.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct MsgSubmitQueryResponse {
5    #[prost(string, tag = "1")]
6    pub chain_id: ::prost::alloc::string::String,
7    #[prost(string, tag = "2")]
8    pub query_id: ::prost::alloc::string::String,
9    #[prost(bytes = "vec", tag = "3")]
10    pub result: ::prost::alloc::vec::Vec<u8>,
11    #[prost(message, optional, tag = "4")]
12    pub proof_ops: ::core::option::Option<::tendermint_proto::crypto::ProofOps>,
13    #[prost(int64, tag = "5")]
14    pub height: i64,
15    #[prost(string, tag = "6")]
16    pub from_address: ::prost::alloc::string::String,
17}
18impl ::prost::Name for MsgSubmitQueryResponse {
19    const NAME: &'static str = "MsgSubmitQueryResponse";
20    const PACKAGE: &'static str = "stride.interchainquery.v1";
21    fn full_name() -> ::prost::alloc::string::String {
22        "stride.interchainquery.v1.MsgSubmitQueryResponse".into()
23    }
24    fn type_url() -> ::prost::alloc::string::String {
25        "/stride.interchainquery.v1.MsgSubmitQueryResponse".into()
26    }
27}
28/// MsgSubmitQueryResponseResponse defines the MsgSubmitQueryResponse response
29/// type.
30#[derive(Clone, Copy, PartialEq, ::prost::Message)]
31pub struct MsgSubmitQueryResponseResponse {}
32impl ::prost::Name for MsgSubmitQueryResponseResponse {
33    const NAME: &'static str = "MsgSubmitQueryResponseResponse";
34    const PACKAGE: &'static str = "stride.interchainquery.v1";
35    fn full_name() -> ::prost::alloc::string::String {
36        "stride.interchainquery.v1.MsgSubmitQueryResponseResponse".into()
37    }
38    fn type_url() -> ::prost::alloc::string::String {
39        "/stride.interchainquery.v1.MsgSubmitQueryResponseResponse".into()
40    }
41}
42/// Generated client implementations.
43#[cfg(feature = "client")]
44pub mod msg_client {
45    #![allow(
46        unused_variables,
47        dead_code,
48        missing_docs,
49        clippy::wildcard_imports,
50        clippy::let_unit_value,
51    )]
52    use tonic::codegen::*;
53    use tonic::codegen::http::Uri;
54    /// Msg defines the interchainquery Msg service.
55    #[derive(Debug, Clone)]
56    pub struct MsgClient<T> {
57        inner: tonic::client::Grpc<T>,
58    }
59    #[cfg(feature = "transport")]
60    impl MsgClient<tonic::transport::Channel> {
61        /// Attempt to create a new client by connecting to a given endpoint.
62        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
63        where
64            D: TryInto<tonic::transport::Endpoint>,
65            D::Error: Into<StdError>,
66        {
67            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
68            Ok(Self::new(conn))
69        }
70    }
71    impl<T> MsgClient<T>
72    where
73        T: tonic::client::GrpcService<tonic::body::Body>,
74        T::Error: Into<StdError>,
75        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
76        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
77    {
78        pub fn new(inner: T) -> Self {
79            let inner = tonic::client::Grpc::new(inner);
80            Self { inner }
81        }
82        pub fn with_origin(inner: T, origin: Uri) -> Self {
83            let inner = tonic::client::Grpc::with_origin(inner, origin);
84            Self { inner }
85        }
86        pub fn with_interceptor<F>(
87            inner: T,
88            interceptor: F,
89        ) -> MsgClient<InterceptedService<T, F>>
90        where
91            F: tonic::service::Interceptor,
92            T::ResponseBody: Default,
93            T: tonic::codegen::Service<
94                http::Request<tonic::body::Body>,
95                Response = http::Response<
96                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
97                >,
98            >,
99            <T as tonic::codegen::Service<
100                http::Request<tonic::body::Body>,
101            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
102        {
103            MsgClient::new(InterceptedService::new(inner, interceptor))
104        }
105        /// Compress requests with the given encoding.
106        ///
107        /// This requires the server to support it otherwise it might respond with an
108        /// error.
109        #[must_use]
110        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
111            self.inner = self.inner.send_compressed(encoding);
112            self
113        }
114        /// Enable decompressing responses.
115        #[must_use]
116        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
117            self.inner = self.inner.accept_compressed(encoding);
118            self
119        }
120        /// Limits the maximum size of a decoded message.
121        ///
122        /// Default: `4MB`
123        #[must_use]
124        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
125            self.inner = self.inner.max_decoding_message_size(limit);
126            self
127        }
128        /// Limits the maximum size of an encoded message.
129        ///
130        /// Default: `usize::MAX`
131        #[must_use]
132        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
133            self.inner = self.inner.max_encoding_message_size(limit);
134            self
135        }
136        /// SubmitQueryResponse defines a method for submit query responses.
137        pub async fn submit_query_response(
138            &mut self,
139            request: impl tonic::IntoRequest<super::MsgSubmitQueryResponse>,
140        ) -> std::result::Result<
141            tonic::Response<super::MsgSubmitQueryResponseResponse>,
142            tonic::Status,
143        > {
144            self.inner
145                .ready()
146                .await
147                .map_err(|e| {
148                    tonic::Status::unknown(
149                        format!("Service was not ready: {}", e.into()),
150                    )
151                })?;
152            let codec = tonic::codec::ProstCodec::default();
153            let path = http::uri::PathAndQuery::from_static(
154                "/stride.interchainquery.v1.Msg/SubmitQueryResponse",
155            );
156            let mut req = request.into_request();
157            req.extensions_mut()
158                .insert(
159                    GrpcMethod::new(
160                        "stride.interchainquery.v1.Msg",
161                        "SubmitQueryResponse",
162                    ),
163                );
164            self.inner.unary(req, path, codec).await
165        }
166    }
167}
168/// Generated server implementations.
169#[cfg(feature = "server")]
170pub mod msg_server {
171    #![allow(
172        unused_variables,
173        dead_code,
174        missing_docs,
175        clippy::wildcard_imports,
176        clippy::let_unit_value,
177    )]
178    use tonic::codegen::*;
179    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
180    #[async_trait]
181    pub trait Msg: std::marker::Send + std::marker::Sync + 'static {
182        /// SubmitQueryResponse defines a method for submit query responses.
183        async fn submit_query_response(
184            &self,
185            request: tonic::Request<super::MsgSubmitQueryResponse>,
186        ) -> std::result::Result<
187            tonic::Response<super::MsgSubmitQueryResponseResponse>,
188            tonic::Status,
189        >;
190    }
191    /// Msg defines the interchainquery Msg service.
192    #[derive(Debug)]
193    pub struct MsgServer<T> {
194        inner: Arc<T>,
195        accept_compression_encodings: EnabledCompressionEncodings,
196        send_compression_encodings: EnabledCompressionEncodings,
197        max_decoding_message_size: Option<usize>,
198        max_encoding_message_size: Option<usize>,
199    }
200    impl<T> MsgServer<T> {
201        pub fn new(inner: T) -> Self {
202            Self::from_arc(Arc::new(inner))
203        }
204        pub fn from_arc(inner: Arc<T>) -> Self {
205            Self {
206                inner,
207                accept_compression_encodings: Default::default(),
208                send_compression_encodings: Default::default(),
209                max_decoding_message_size: None,
210                max_encoding_message_size: None,
211            }
212        }
213        pub fn with_interceptor<F>(
214            inner: T,
215            interceptor: F,
216        ) -> InterceptedService<Self, F>
217        where
218            F: tonic::service::Interceptor,
219        {
220            InterceptedService::new(Self::new(inner), interceptor)
221        }
222        /// Enable decompressing requests with the given encoding.
223        #[must_use]
224        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
225            self.accept_compression_encodings.enable(encoding);
226            self
227        }
228        /// Compress responses with the given encoding, if the client supports it.
229        #[must_use]
230        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
231            self.send_compression_encodings.enable(encoding);
232            self
233        }
234        /// Limits the maximum size of a decoded message.
235        ///
236        /// Default: `4MB`
237        #[must_use]
238        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
239            self.max_decoding_message_size = Some(limit);
240            self
241        }
242        /// Limits the maximum size of an encoded message.
243        ///
244        /// Default: `usize::MAX`
245        #[must_use]
246        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
247            self.max_encoding_message_size = Some(limit);
248            self
249        }
250    }
251    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
252    where
253        T: Msg,
254        B: Body + std::marker::Send + 'static,
255        B::Error: Into<StdError> + std::marker::Send + 'static,
256    {
257        type Response = http::Response<tonic::body::Body>;
258        type Error = std::convert::Infallible;
259        type Future = BoxFuture<Self::Response, Self::Error>;
260        fn poll_ready(
261            &mut self,
262            _cx: &mut Context<'_>,
263        ) -> Poll<std::result::Result<(), Self::Error>> {
264            Poll::Ready(Ok(()))
265        }
266        fn call(&mut self, req: http::Request<B>) -> Self::Future {
267            match req.uri().path() {
268                "/stride.interchainquery.v1.Msg/SubmitQueryResponse" => {
269                    #[allow(non_camel_case_types)]
270                    struct SubmitQueryResponseSvc<T: Msg>(pub Arc<T>);
271                    impl<
272                        T: Msg,
273                    > tonic::server::UnaryService<super::MsgSubmitQueryResponse>
274                    for SubmitQueryResponseSvc<T> {
275                        type Response = super::MsgSubmitQueryResponseResponse;
276                        type Future = BoxFuture<
277                            tonic::Response<Self::Response>,
278                            tonic::Status,
279                        >;
280                        fn call(
281                            &mut self,
282                            request: tonic::Request<super::MsgSubmitQueryResponse>,
283                        ) -> Self::Future {
284                            let inner = Arc::clone(&self.0);
285                            let fut = async move {
286                                <T as Msg>::submit_query_response(&inner, request).await
287                            };
288                            Box::pin(fut)
289                        }
290                    }
291                    let accept_compression_encodings = self.accept_compression_encodings;
292                    let send_compression_encodings = self.send_compression_encodings;
293                    let max_decoding_message_size = self.max_decoding_message_size;
294                    let max_encoding_message_size = self.max_encoding_message_size;
295                    let inner = self.inner.clone();
296                    let fut = async move {
297                        let method = SubmitQueryResponseSvc(inner);
298                        let codec = tonic::codec::ProstCodec::default();
299                        let mut grpc = tonic::server::Grpc::new(codec)
300                            .apply_compression_config(
301                                accept_compression_encodings,
302                                send_compression_encodings,
303                            )
304                            .apply_max_message_size_config(
305                                max_decoding_message_size,
306                                max_encoding_message_size,
307                            );
308                        let res = grpc.unary(method, req).await;
309                        Ok(res)
310                    };
311                    Box::pin(fut)
312                }
313                _ => {
314                    Box::pin(async move {
315                        let mut response = http::Response::new(
316                            tonic::body::Body::default(),
317                        );
318                        let headers = response.headers_mut();
319                        headers
320                            .insert(
321                                tonic::Status::GRPC_STATUS,
322                                (tonic::Code::Unimplemented as i32).into(),
323                            );
324                        headers
325                            .insert(
326                                http::header::CONTENT_TYPE,
327                                tonic::metadata::GRPC_CONTENT_TYPE,
328                            );
329                        Ok(response)
330                    })
331                }
332            }
333        }
334    }
335    impl<T> Clone for MsgServer<T> {
336        fn clone(&self) -> Self {
337            let inner = self.inner.clone();
338            Self {
339                inner,
340                accept_compression_encodings: self.accept_compression_encodings,
341                send_compression_encodings: self.send_compression_encodings,
342                max_decoding_message_size: self.max_decoding_message_size,
343                max_encoding_message_size: self.max_encoding_message_size,
344            }
345        }
346    }
347    /// Generated gRPC service name
348    pub const SERVICE_NAME: &str = "stride.interchainquery.v1.Msg";
349    impl<T> tonic::server::NamedService for MsgServer<T> {
350        const NAME: &'static str = SERVICE_NAME;
351    }
352}