side_proto/prost/side/
side.oracle.tonic.rs

1// @generated
2/// Generated client implementations.
3#[cfg(feature = "grpc")]
4pub mod query_client {
5    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
6    use tonic::codegen::http::Uri;
7    use tonic::codegen::*;
8    #[derive(Debug, Clone)]
9    pub struct QueryClient<T> {
10        inner: tonic::client::Grpc<T>,
11    }
12    #[cfg(feature = "grpc-transport")]
13    impl QueryClient<tonic::transport::Channel> {
14        /// Attempt to create a new client by connecting to a given endpoint.
15        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
16        where
17            D: TryInto<tonic::transport::Endpoint>,
18            D::Error: Into<StdError>,
19        {
20            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
21            Ok(Self::new(conn))
22        }
23    }
24    impl<T> QueryClient<T>
25    where
26        T: tonic::client::GrpcService<tonic::body::BoxBody>,
27        T::Error: Into<StdError>,
28        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
29        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
30    {
31        pub fn new(inner: T) -> Self {
32            let inner = tonic::client::Grpc::new(inner);
33            Self { inner }
34        }
35        pub fn with_origin(inner: T, origin: Uri) -> Self {
36            let inner = tonic::client::Grpc::with_origin(inner, origin);
37            Self { inner }
38        }
39        pub fn with_interceptor<F>(
40            inner: T,
41            interceptor: F,
42        ) -> QueryClient<InterceptedService<T, F>>
43        where
44            F: tonic::service::Interceptor,
45            T::ResponseBody: Default,
46            T: tonic::codegen::Service<
47                http::Request<tonic::body::BoxBody>,
48                Response = http::Response<
49                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
50                >,
51            >,
52            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
53                Into<StdError> + Send + Sync,
54        {
55            QueryClient::new(InterceptedService::new(inner, interceptor))
56        }
57        /// Compress requests with the given encoding.
58        ///
59        /// This requires the server to support it otherwise it might respond with an
60        /// error.
61        #[must_use]
62        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
63            self.inner = self.inner.send_compressed(encoding);
64            self
65        }
66        /// Enable decompressing responses.
67        #[must_use]
68        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
69            self.inner = self.inner.accept_compressed(encoding);
70            self
71        }
72        /// Limits the maximum size of a decoded message.
73        ///
74        /// Default: `4MB`
75        #[must_use]
76        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
77            self.inner = self.inner.max_decoding_message_size(limit);
78            self
79        }
80        /// Limits the maximum size of an encoded message.
81        ///
82        /// Default: `usize::MAX`
83        #[must_use]
84        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
85            self.inner = self.inner.max_encoding_message_size(limit);
86            self
87        }
88        pub async fn params(
89            &mut self,
90            request: impl tonic::IntoRequest<super::QueryParamsRequest>,
91        ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>
92        {
93            self.inner.ready().await.map_err(|e| {
94                tonic::Status::new(
95                    tonic::Code::Unknown,
96                    alloc::format!("Service was not ready: {}", e.into()),
97                )
98            })?;
99            let codec = tonic::codec::ProstCodec::default();
100            let path = http::uri::PathAndQuery::from_static("/side.oracle.Query/Params");
101            let mut req = request.into_request();
102            req.extensions_mut()
103                .insert(GrpcMethod::new("side.oracle.Query", "Params"));
104            self.inner.unary(req, path, codec).await
105        }
106        pub async fn list_prices(
107            &mut self,
108            request: impl tonic::IntoRequest<super::QueryListPricesRequest>,
109        ) -> core::result::Result<tonic::Response<super::QueryListPricesResponse>, tonic::Status>
110        {
111            self.inner.ready().await.map_err(|e| {
112                tonic::Status::new(
113                    tonic::Code::Unknown,
114                    alloc::format!("Service was not ready: {}", e.into()),
115                )
116            })?;
117            let codec = tonic::codec::ProstCodec::default();
118            let path = http::uri::PathAndQuery::from_static("/side.oracle.Query/ListPrices");
119            let mut req = request.into_request();
120            req.extensions_mut()
121                .insert(GrpcMethod::new("side.oracle.Query", "ListPrices"));
122            self.inner.unary(req, path, codec).await
123        }
124        pub async fn get_price_by_symbol(
125            &mut self,
126            request: impl tonic::IntoRequest<super::QueryGetPriceBySymbolRequest>,
127        ) -> core::result::Result<
128            tonic::Response<super::QueryGetPriceBySymbolResponse>,
129            tonic::Status,
130        > {
131            self.inner.ready().await.map_err(|e| {
132                tonic::Status::new(
133                    tonic::Code::Unknown,
134                    alloc::format!("Service was not ready: {}", e.into()),
135                )
136            })?;
137            let codec = tonic::codec::ProstCodec::default();
138            let path = http::uri::PathAndQuery::from_static("/side.oracle.Query/GetPriceBySymbol");
139            let mut req = request.into_request();
140            req.extensions_mut()
141                .insert(GrpcMethod::new("side.oracle.Query", "GetPriceBySymbol"));
142            self.inner.unary(req, path, codec).await
143        }
144        pub async fn query_chain_tip(
145            &mut self,
146            request: impl tonic::IntoRequest<super::QueryChainTipRequest>,
147        ) -> core::result::Result<tonic::Response<super::QueryChainTipResponse>, tonic::Status>
148        {
149            self.inner.ready().await.map_err(|e| {
150                tonic::Status::new(
151                    tonic::Code::Unknown,
152                    alloc::format!("Service was not ready: {}", e.into()),
153                )
154            })?;
155            let codec = tonic::codec::ProstCodec::default();
156            let path = http::uri::PathAndQuery::from_static("/side.oracle.Query/QueryChainTip");
157            let mut req = request.into_request();
158            req.extensions_mut()
159                .insert(GrpcMethod::new("side.oracle.Query", "QueryChainTip"));
160            self.inner.unary(req, path, codec).await
161        }
162        pub async fn query_block_header_by_height(
163            &mut self,
164            request: impl tonic::IntoRequest<super::QueryBlockHeaderByHeightRequest>,
165        ) -> core::result::Result<
166            tonic::Response<super::QueryBlockHeaderByHeightResponse>,
167            tonic::Status,
168        > {
169            self.inner.ready().await.map_err(|e| {
170                tonic::Status::new(
171                    tonic::Code::Unknown,
172                    alloc::format!("Service was not ready: {}", e.into()),
173                )
174            })?;
175            let codec = tonic::codec::ProstCodec::default();
176            let path =
177                http::uri::PathAndQuery::from_static("/side.oracle.Query/QueryBlockHeaderByHeight");
178            let mut req = request.into_request();
179            req.extensions_mut().insert(GrpcMethod::new(
180                "side.oracle.Query",
181                "QueryBlockHeaderByHeight",
182            ));
183            self.inner.unary(req, path, codec).await
184        }
185        pub async fn query_block_header_by_hash(
186            &mut self,
187            request: impl tonic::IntoRequest<super::QueryBlockHeaderByHashRequest>,
188        ) -> core::result::Result<
189            tonic::Response<super::QueryBlockHeaderByHashResponse>,
190            tonic::Status,
191        > {
192            self.inner.ready().await.map_err(|e| {
193                tonic::Status::new(
194                    tonic::Code::Unknown,
195                    alloc::format!("Service was not ready: {}", e.into()),
196                )
197            })?;
198            let codec = tonic::codec::ProstCodec::default();
199            let path =
200                http::uri::PathAndQuery::from_static("/side.oracle.Query/QueryBlockHeaderByHash");
201            let mut req = request.into_request();
202            req.extensions_mut().insert(GrpcMethod::new(
203                "side.oracle.Query",
204                "QueryBlockHeaderByHash",
205            ));
206            self.inner.unary(req, path, codec).await
207        }
208        pub async fn query_best_block_header(
209            &mut self,
210            request: impl tonic::IntoRequest<super::QueryBestBlockHeaderRequest>,
211        ) -> core::result::Result<tonic::Response<super::QueryBestBlockHeaderResponse>, tonic::Status>
212        {
213            self.inner.ready().await.map_err(|e| {
214                tonic::Status::new(
215                    tonic::Code::Unknown,
216                    alloc::format!("Service was not ready: {}", e.into()),
217                )
218            })?;
219            let codec = tonic::codec::ProstCodec::default();
220            let path =
221                http::uri::PathAndQuery::from_static("/side.oracle.Query/QueryBestBlockHeader");
222            let mut req = request.into_request();
223            req.extensions_mut()
224                .insert(GrpcMethod::new("side.oracle.Query", "QueryBestBlockHeader"));
225            self.inner.unary(req, path, codec).await
226        }
227    }
228}
229/// Generated server implementations.
230#[cfg(feature = "grpc")]
231pub mod query_server {
232    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
233    use tonic::codegen::*;
234    /// Generated trait containing gRPC methods that should be implemented for use with QueryServer.
235    #[async_trait]
236    pub trait Query: Send + Sync + 'static {
237        async fn params(
238            &self,
239            request: tonic::Request<super::QueryParamsRequest>,
240        ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>;
241        async fn list_prices(
242            &self,
243            request: tonic::Request<super::QueryListPricesRequest>,
244        ) -> core::result::Result<tonic::Response<super::QueryListPricesResponse>, tonic::Status>;
245        async fn get_price_by_symbol(
246            &self,
247            request: tonic::Request<super::QueryGetPriceBySymbolRequest>,
248        ) -> core::result::Result<
249            tonic::Response<super::QueryGetPriceBySymbolResponse>,
250            tonic::Status,
251        >;
252        async fn query_chain_tip(
253            &self,
254            request: tonic::Request<super::QueryChainTipRequest>,
255        ) -> core::result::Result<tonic::Response<super::QueryChainTipResponse>, tonic::Status>;
256        async fn query_block_header_by_height(
257            &self,
258            request: tonic::Request<super::QueryBlockHeaderByHeightRequest>,
259        ) -> core::result::Result<
260            tonic::Response<super::QueryBlockHeaderByHeightResponse>,
261            tonic::Status,
262        >;
263        async fn query_block_header_by_hash(
264            &self,
265            request: tonic::Request<super::QueryBlockHeaderByHashRequest>,
266        ) -> core::result::Result<
267            tonic::Response<super::QueryBlockHeaderByHashResponse>,
268            tonic::Status,
269        >;
270        async fn query_best_block_header(
271            &self,
272            request: tonic::Request<super::QueryBestBlockHeaderRequest>,
273        ) -> core::result::Result<tonic::Response<super::QueryBestBlockHeaderResponse>, tonic::Status>;
274    }
275    #[derive(Debug)]
276    pub struct QueryServer<T: Query> {
277        inner: _Inner<T>,
278        accept_compression_encodings: EnabledCompressionEncodings,
279        send_compression_encodings: EnabledCompressionEncodings,
280        max_decoding_message_size: Option<usize>,
281        max_encoding_message_size: Option<usize>,
282    }
283    struct _Inner<T>(Arc<T>);
284    impl<T: Query> QueryServer<T> {
285        pub fn new(inner: T) -> Self {
286            Self::from_arc(Arc::new(inner))
287        }
288        pub fn from_arc(inner: Arc<T>) -> Self {
289            let inner = _Inner(inner);
290            Self {
291                inner,
292                accept_compression_encodings: Default::default(),
293                send_compression_encodings: Default::default(),
294                max_decoding_message_size: None,
295                max_encoding_message_size: None,
296            }
297        }
298        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
299        where
300            F: tonic::service::Interceptor,
301        {
302            InterceptedService::new(Self::new(inner), interceptor)
303        }
304        /// Enable decompressing requests with the given encoding.
305        #[must_use]
306        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
307            self.accept_compression_encodings.enable(encoding);
308            self
309        }
310        /// Compress responses with the given encoding, if the client supports it.
311        #[must_use]
312        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
313            self.send_compression_encodings.enable(encoding);
314            self
315        }
316        /// Limits the maximum size of a decoded message.
317        ///
318        /// Default: `4MB`
319        #[must_use]
320        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
321            self.max_decoding_message_size = Some(limit);
322            self
323        }
324        /// Limits the maximum size of an encoded message.
325        ///
326        /// Default: `usize::MAX`
327        #[must_use]
328        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
329            self.max_encoding_message_size = Some(limit);
330            self
331        }
332    }
333    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
334    where
335        T: Query,
336        B: Body + Send + 'static,
337        B::Error: Into<StdError> + Send + 'static,
338    {
339        type Response = http::Response<tonic::body::BoxBody>;
340        type Error = std::convert::Infallible;
341        type Future = BoxFuture<Self::Response, Self::Error>;
342        fn poll_ready(
343            &mut self,
344            _cx: &mut Context<'_>,
345        ) -> Poll<core::result::Result<(), Self::Error>> {
346            Poll::Ready(Ok(()))
347        }
348        fn call(&mut self, req: http::Request<B>) -> Self::Future {
349            let inner = self.inner.clone();
350            match req.uri().path() {
351                "/side.oracle.Query/Params" => {
352                    #[allow(non_camel_case_types)]
353                    struct ParamsSvc<T: Query>(pub Arc<T>);
354                    impl<T: Query> tonic::server::UnaryService<super::QueryParamsRequest> for ParamsSvc<T> {
355                        type Response = super::QueryParamsResponse;
356                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
357                        fn call(
358                            &mut self,
359                            request: tonic::Request<super::QueryParamsRequest>,
360                        ) -> Self::Future {
361                            let inner = Arc::clone(&self.0);
362                            let fut = async move { (*inner).params(request).await };
363                            Box::pin(fut)
364                        }
365                    }
366                    let accept_compression_encodings = self.accept_compression_encodings;
367                    let send_compression_encodings = self.send_compression_encodings;
368                    let max_decoding_message_size = self.max_decoding_message_size;
369                    let max_encoding_message_size = self.max_encoding_message_size;
370                    let inner = self.inner.clone();
371                    let fut = async move {
372                        let inner = inner.0;
373                        let method = ParamsSvc(inner);
374                        let codec = tonic::codec::ProstCodec::default();
375                        let mut grpc = tonic::server::Grpc::new(codec)
376                            .apply_compression_config(
377                                accept_compression_encodings,
378                                send_compression_encodings,
379                            )
380                            .apply_max_message_size_config(
381                                max_decoding_message_size,
382                                max_encoding_message_size,
383                            );
384                        let res = grpc.unary(method, req).await;
385                        Ok(res)
386                    };
387                    Box::pin(fut)
388                }
389                "/side.oracle.Query/ListPrices" => {
390                    #[allow(non_camel_case_types)]
391                    struct ListPricesSvc<T: Query>(pub Arc<T>);
392                    impl<T: Query> tonic::server::UnaryService<super::QueryListPricesRequest> for ListPricesSvc<T> {
393                        type Response = super::QueryListPricesResponse;
394                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
395                        fn call(
396                            &mut self,
397                            request: tonic::Request<super::QueryListPricesRequest>,
398                        ) -> Self::Future {
399                            let inner = Arc::clone(&self.0);
400                            let fut = async move { (*inner).list_prices(request).await };
401                            Box::pin(fut)
402                        }
403                    }
404                    let accept_compression_encodings = self.accept_compression_encodings;
405                    let send_compression_encodings = self.send_compression_encodings;
406                    let max_decoding_message_size = self.max_decoding_message_size;
407                    let max_encoding_message_size = self.max_encoding_message_size;
408                    let inner = self.inner.clone();
409                    let fut = async move {
410                        let inner = inner.0;
411                        let method = ListPricesSvc(inner);
412                        let codec = tonic::codec::ProstCodec::default();
413                        let mut grpc = tonic::server::Grpc::new(codec)
414                            .apply_compression_config(
415                                accept_compression_encodings,
416                                send_compression_encodings,
417                            )
418                            .apply_max_message_size_config(
419                                max_decoding_message_size,
420                                max_encoding_message_size,
421                            );
422                        let res = grpc.unary(method, req).await;
423                        Ok(res)
424                    };
425                    Box::pin(fut)
426                }
427                "/side.oracle.Query/GetPriceBySymbol" => {
428                    #[allow(non_camel_case_types)]
429                    struct GetPriceBySymbolSvc<T: Query>(pub Arc<T>);
430                    impl<T: Query> tonic::server::UnaryService<super::QueryGetPriceBySymbolRequest>
431                        for GetPriceBySymbolSvc<T>
432                    {
433                        type Response = super::QueryGetPriceBySymbolResponse;
434                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
435                        fn call(
436                            &mut self,
437                            request: tonic::Request<super::QueryGetPriceBySymbolRequest>,
438                        ) -> Self::Future {
439                            let inner = Arc::clone(&self.0);
440                            let fut = async move { (*inner).get_price_by_symbol(request).await };
441                            Box::pin(fut)
442                        }
443                    }
444                    let accept_compression_encodings = self.accept_compression_encodings;
445                    let send_compression_encodings = self.send_compression_encodings;
446                    let max_decoding_message_size = self.max_decoding_message_size;
447                    let max_encoding_message_size = self.max_encoding_message_size;
448                    let inner = self.inner.clone();
449                    let fut = async move {
450                        let inner = inner.0;
451                        let method = GetPriceBySymbolSvc(inner);
452                        let codec = tonic::codec::ProstCodec::default();
453                        let mut grpc = tonic::server::Grpc::new(codec)
454                            .apply_compression_config(
455                                accept_compression_encodings,
456                                send_compression_encodings,
457                            )
458                            .apply_max_message_size_config(
459                                max_decoding_message_size,
460                                max_encoding_message_size,
461                            );
462                        let res = grpc.unary(method, req).await;
463                        Ok(res)
464                    };
465                    Box::pin(fut)
466                }
467                "/side.oracle.Query/QueryChainTip" => {
468                    #[allow(non_camel_case_types)]
469                    struct QueryChainTipSvc<T: Query>(pub Arc<T>);
470                    impl<T: Query> tonic::server::UnaryService<super::QueryChainTipRequest> for QueryChainTipSvc<T> {
471                        type Response = super::QueryChainTipResponse;
472                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
473                        fn call(
474                            &mut self,
475                            request: tonic::Request<super::QueryChainTipRequest>,
476                        ) -> Self::Future {
477                            let inner = Arc::clone(&self.0);
478                            let fut = async move { (*inner).query_chain_tip(request).await };
479                            Box::pin(fut)
480                        }
481                    }
482                    let accept_compression_encodings = self.accept_compression_encodings;
483                    let send_compression_encodings = self.send_compression_encodings;
484                    let max_decoding_message_size = self.max_decoding_message_size;
485                    let max_encoding_message_size = self.max_encoding_message_size;
486                    let inner = self.inner.clone();
487                    let fut = async move {
488                        let inner = inner.0;
489                        let method = QueryChainTipSvc(inner);
490                        let codec = tonic::codec::ProstCodec::default();
491                        let mut grpc = tonic::server::Grpc::new(codec)
492                            .apply_compression_config(
493                                accept_compression_encodings,
494                                send_compression_encodings,
495                            )
496                            .apply_max_message_size_config(
497                                max_decoding_message_size,
498                                max_encoding_message_size,
499                            );
500                        let res = grpc.unary(method, req).await;
501                        Ok(res)
502                    };
503                    Box::pin(fut)
504                }
505                "/side.oracle.Query/QueryBlockHeaderByHeight" => {
506                    #[allow(non_camel_case_types)]
507                    struct QueryBlockHeaderByHeightSvc<T: Query>(pub Arc<T>);
508                    impl<T: Query>
509                        tonic::server::UnaryService<super::QueryBlockHeaderByHeightRequest>
510                        for QueryBlockHeaderByHeightSvc<T>
511                    {
512                        type Response = super::QueryBlockHeaderByHeightResponse;
513                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
514                        fn call(
515                            &mut self,
516                            request: tonic::Request<super::QueryBlockHeaderByHeightRequest>,
517                        ) -> Self::Future {
518                            let inner = Arc::clone(&self.0);
519                            let fut =
520                                async move { (*inner).query_block_header_by_height(request).await };
521                            Box::pin(fut)
522                        }
523                    }
524                    let accept_compression_encodings = self.accept_compression_encodings;
525                    let send_compression_encodings = self.send_compression_encodings;
526                    let max_decoding_message_size = self.max_decoding_message_size;
527                    let max_encoding_message_size = self.max_encoding_message_size;
528                    let inner = self.inner.clone();
529                    let fut = async move {
530                        let inner = inner.0;
531                        let method = QueryBlockHeaderByHeightSvc(inner);
532                        let codec = tonic::codec::ProstCodec::default();
533                        let mut grpc = tonic::server::Grpc::new(codec)
534                            .apply_compression_config(
535                                accept_compression_encodings,
536                                send_compression_encodings,
537                            )
538                            .apply_max_message_size_config(
539                                max_decoding_message_size,
540                                max_encoding_message_size,
541                            );
542                        let res = grpc.unary(method, req).await;
543                        Ok(res)
544                    };
545                    Box::pin(fut)
546                }
547                "/side.oracle.Query/QueryBlockHeaderByHash" => {
548                    #[allow(non_camel_case_types)]
549                    struct QueryBlockHeaderByHashSvc<T: Query>(pub Arc<T>);
550                    impl<T: Query> tonic::server::UnaryService<super::QueryBlockHeaderByHashRequest>
551                        for QueryBlockHeaderByHashSvc<T>
552                    {
553                        type Response = super::QueryBlockHeaderByHashResponse;
554                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
555                        fn call(
556                            &mut self,
557                            request: tonic::Request<super::QueryBlockHeaderByHashRequest>,
558                        ) -> Self::Future {
559                            let inner = Arc::clone(&self.0);
560                            let fut =
561                                async move { (*inner).query_block_header_by_hash(request).await };
562                            Box::pin(fut)
563                        }
564                    }
565                    let accept_compression_encodings = self.accept_compression_encodings;
566                    let send_compression_encodings = self.send_compression_encodings;
567                    let max_decoding_message_size = self.max_decoding_message_size;
568                    let max_encoding_message_size = self.max_encoding_message_size;
569                    let inner = self.inner.clone();
570                    let fut = async move {
571                        let inner = inner.0;
572                        let method = QueryBlockHeaderByHashSvc(inner);
573                        let codec = tonic::codec::ProstCodec::default();
574                        let mut grpc = tonic::server::Grpc::new(codec)
575                            .apply_compression_config(
576                                accept_compression_encodings,
577                                send_compression_encodings,
578                            )
579                            .apply_max_message_size_config(
580                                max_decoding_message_size,
581                                max_encoding_message_size,
582                            );
583                        let res = grpc.unary(method, req).await;
584                        Ok(res)
585                    };
586                    Box::pin(fut)
587                }
588                "/side.oracle.Query/QueryBestBlockHeader" => {
589                    #[allow(non_camel_case_types)]
590                    struct QueryBestBlockHeaderSvc<T: Query>(pub Arc<T>);
591                    impl<T: Query> tonic::server::UnaryService<super::QueryBestBlockHeaderRequest>
592                        for QueryBestBlockHeaderSvc<T>
593                    {
594                        type Response = super::QueryBestBlockHeaderResponse;
595                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
596                        fn call(
597                            &mut self,
598                            request: tonic::Request<super::QueryBestBlockHeaderRequest>,
599                        ) -> Self::Future {
600                            let inner = Arc::clone(&self.0);
601                            let fut =
602                                async move { (*inner).query_best_block_header(request).await };
603                            Box::pin(fut)
604                        }
605                    }
606                    let accept_compression_encodings = self.accept_compression_encodings;
607                    let send_compression_encodings = self.send_compression_encodings;
608                    let max_decoding_message_size = self.max_decoding_message_size;
609                    let max_encoding_message_size = self.max_encoding_message_size;
610                    let inner = self.inner.clone();
611                    let fut = async move {
612                        let inner = inner.0;
613                        let method = QueryBestBlockHeaderSvc(inner);
614                        let codec = tonic::codec::ProstCodec::default();
615                        let mut grpc = tonic::server::Grpc::new(codec)
616                            .apply_compression_config(
617                                accept_compression_encodings,
618                                send_compression_encodings,
619                            )
620                            .apply_max_message_size_config(
621                                max_decoding_message_size,
622                                max_encoding_message_size,
623                            );
624                        let res = grpc.unary(method, req).await;
625                        Ok(res)
626                    };
627                    Box::pin(fut)
628                }
629                _ => Box::pin(async move {
630                    Ok(http::Response::builder()
631                        .status(200)
632                        .header("grpc-status", "12")
633                        .header("content-type", "application/grpc")
634                        .body(empty_body())
635                        .unwrap())
636                }),
637            }
638        }
639    }
640    impl<T: Query> Clone for QueryServer<T> {
641        fn clone(&self) -> Self {
642            let inner = self.inner.clone();
643            Self {
644                inner,
645                accept_compression_encodings: self.accept_compression_encodings,
646                send_compression_encodings: self.send_compression_encodings,
647                max_decoding_message_size: self.max_decoding_message_size,
648                max_encoding_message_size: self.max_encoding_message_size,
649            }
650        }
651    }
652    impl<T: Query> Clone for _Inner<T> {
653        fn clone(&self) -> Self {
654            Self(Arc::clone(&self.0))
655        }
656    }
657    impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
658        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
659            write!(f, "{:?}", self.0)
660        }
661    }
662    impl<T: Query> tonic::server::NamedService for QueryServer<T> {
663        const NAME: &'static str = "side.oracle.Query";
664    }
665}
666/// Generated client implementations.
667#[cfg(feature = "grpc")]
668pub mod msg_client {
669    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
670    use tonic::codegen::http::Uri;
671    use tonic::codegen::*;
672    #[derive(Debug, Clone)]
673    pub struct MsgClient<T> {
674        inner: tonic::client::Grpc<T>,
675    }
676    #[cfg(feature = "grpc-transport")]
677    impl MsgClient<tonic::transport::Channel> {
678        /// Attempt to create a new client by connecting to a given endpoint.
679        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
680        where
681            D: TryInto<tonic::transport::Endpoint>,
682            D::Error: Into<StdError>,
683        {
684            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
685            Ok(Self::new(conn))
686        }
687    }
688    impl<T> MsgClient<T>
689    where
690        T: tonic::client::GrpcService<tonic::body::BoxBody>,
691        T::Error: Into<StdError>,
692        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
693        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
694    {
695        pub fn new(inner: T) -> Self {
696            let inner = tonic::client::Grpc::new(inner);
697            Self { inner }
698        }
699        pub fn with_origin(inner: T, origin: Uri) -> Self {
700            let inner = tonic::client::Grpc::with_origin(inner, origin);
701            Self { inner }
702        }
703        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
704        where
705            F: tonic::service::Interceptor,
706            T::ResponseBody: Default,
707            T: tonic::codegen::Service<
708                http::Request<tonic::body::BoxBody>,
709                Response = http::Response<
710                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
711                >,
712            >,
713            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
714                Into<StdError> + Send + Sync,
715        {
716            MsgClient::new(InterceptedService::new(inner, interceptor))
717        }
718        /// Compress requests with the given encoding.
719        ///
720        /// This requires the server to support it otherwise it might respond with an
721        /// error.
722        #[must_use]
723        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
724            self.inner = self.inner.send_compressed(encoding);
725            self
726        }
727        /// Enable decompressing responses.
728        #[must_use]
729        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
730            self.inner = self.inner.accept_compressed(encoding);
731            self
732        }
733        /// Limits the maximum size of a decoded message.
734        ///
735        /// Default: `4MB`
736        #[must_use]
737        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
738            self.inner = self.inner.max_decoding_message_size(limit);
739            self
740        }
741        /// Limits the maximum size of an encoded message.
742        ///
743        /// Default: `usize::MAX`
744        #[must_use]
745        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
746            self.inner = self.inner.max_encoding_message_size(limit);
747            self
748        }
749        pub async fn update_params(
750            &mut self,
751            request: impl tonic::IntoRequest<super::MsgUpdateParams>,
752        ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>
753        {
754            self.inner.ready().await.map_err(|e| {
755                tonic::Status::new(
756                    tonic::Code::Unknown,
757                    alloc::format!("Service was not ready: {}", e.into()),
758                )
759            })?;
760            let codec = tonic::codec::ProstCodec::default();
761            let path = http::uri::PathAndQuery::from_static("/side.oracle.Msg/UpdateParams");
762            let mut req = request.into_request();
763            req.extensions_mut()
764                .insert(GrpcMethod::new("side.oracle.Msg", "UpdateParams"));
765            self.inner.unary(req, path, codec).await
766        }
767    }
768}
769/// Generated server implementations.
770#[cfg(feature = "grpc")]
771pub mod msg_server {
772    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
773    use tonic::codegen::*;
774    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
775    #[async_trait]
776    pub trait Msg: Send + Sync + 'static {
777        async fn update_params(
778            &self,
779            request: tonic::Request<super::MsgUpdateParams>,
780        ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>;
781    }
782    #[derive(Debug)]
783    pub struct MsgServer<T: Msg> {
784        inner: _Inner<T>,
785        accept_compression_encodings: EnabledCompressionEncodings,
786        send_compression_encodings: EnabledCompressionEncodings,
787        max_decoding_message_size: Option<usize>,
788        max_encoding_message_size: Option<usize>,
789    }
790    struct _Inner<T>(Arc<T>);
791    impl<T: Msg> MsgServer<T> {
792        pub fn new(inner: T) -> Self {
793            Self::from_arc(Arc::new(inner))
794        }
795        pub fn from_arc(inner: Arc<T>) -> Self {
796            let inner = _Inner(inner);
797            Self {
798                inner,
799                accept_compression_encodings: Default::default(),
800                send_compression_encodings: Default::default(),
801                max_decoding_message_size: None,
802                max_encoding_message_size: None,
803            }
804        }
805        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
806        where
807            F: tonic::service::Interceptor,
808        {
809            InterceptedService::new(Self::new(inner), interceptor)
810        }
811        /// Enable decompressing requests with the given encoding.
812        #[must_use]
813        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
814            self.accept_compression_encodings.enable(encoding);
815            self
816        }
817        /// Compress responses with the given encoding, if the client supports it.
818        #[must_use]
819        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
820            self.send_compression_encodings.enable(encoding);
821            self
822        }
823        /// Limits the maximum size of a decoded message.
824        ///
825        /// Default: `4MB`
826        #[must_use]
827        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
828            self.max_decoding_message_size = Some(limit);
829            self
830        }
831        /// Limits the maximum size of an encoded message.
832        ///
833        /// Default: `usize::MAX`
834        #[must_use]
835        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
836            self.max_encoding_message_size = Some(limit);
837            self
838        }
839    }
840    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
841    where
842        T: Msg,
843        B: Body + Send + 'static,
844        B::Error: Into<StdError> + Send + 'static,
845    {
846        type Response = http::Response<tonic::body::BoxBody>;
847        type Error = std::convert::Infallible;
848        type Future = BoxFuture<Self::Response, Self::Error>;
849        fn poll_ready(
850            &mut self,
851            _cx: &mut Context<'_>,
852        ) -> Poll<core::result::Result<(), Self::Error>> {
853            Poll::Ready(Ok(()))
854        }
855        fn call(&mut self, req: http::Request<B>) -> Self::Future {
856            let inner = self.inner.clone();
857            match req.uri().path() {
858                "/side.oracle.Msg/UpdateParams" => {
859                    #[allow(non_camel_case_types)]
860                    struct UpdateParamsSvc<T: Msg>(pub Arc<T>);
861                    impl<T: Msg> tonic::server::UnaryService<super::MsgUpdateParams> for UpdateParamsSvc<T> {
862                        type Response = super::MsgUpdateParamsResponse;
863                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
864                        fn call(
865                            &mut self,
866                            request: tonic::Request<super::MsgUpdateParams>,
867                        ) -> Self::Future {
868                            let inner = Arc::clone(&self.0);
869                            let fut = async move { (*inner).update_params(request).await };
870                            Box::pin(fut)
871                        }
872                    }
873                    let accept_compression_encodings = self.accept_compression_encodings;
874                    let send_compression_encodings = self.send_compression_encodings;
875                    let max_decoding_message_size = self.max_decoding_message_size;
876                    let max_encoding_message_size = self.max_encoding_message_size;
877                    let inner = self.inner.clone();
878                    let fut = async move {
879                        let inner = inner.0;
880                        let method = UpdateParamsSvc(inner);
881                        let codec = tonic::codec::ProstCodec::default();
882                        let mut grpc = tonic::server::Grpc::new(codec)
883                            .apply_compression_config(
884                                accept_compression_encodings,
885                                send_compression_encodings,
886                            )
887                            .apply_max_message_size_config(
888                                max_decoding_message_size,
889                                max_encoding_message_size,
890                            );
891                        let res = grpc.unary(method, req).await;
892                        Ok(res)
893                    };
894                    Box::pin(fut)
895                }
896                _ => Box::pin(async move {
897                    Ok(http::Response::builder()
898                        .status(200)
899                        .header("grpc-status", "12")
900                        .header("content-type", "application/grpc")
901                        .body(empty_body())
902                        .unwrap())
903                }),
904            }
905        }
906    }
907    impl<T: Msg> Clone for MsgServer<T> {
908        fn clone(&self) -> Self {
909            let inner = self.inner.clone();
910            Self {
911                inner,
912                accept_compression_encodings: self.accept_compression_encodings,
913                send_compression_encodings: self.send_compression_encodings,
914                max_decoding_message_size: self.max_decoding_message_size,
915                max_encoding_message_size: self.max_encoding_message_size,
916            }
917        }
918    }
919    impl<T: Msg> Clone for _Inner<T> {
920        fn clone(&self) -> Self {
921            Self(Arc::clone(&self.0))
922        }
923    }
924    impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
925        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
926            write!(f, "{:?}", self.0)
927        }
928    }
929    impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
930        const NAME: &'static str = "side.oracle.Msg";
931    }
932}