1#[cfg(feature = "grpc")]
4pub mod query_client {
5 #![allow(
6 unused_variables,
7 dead_code,
8 missing_docs,
9 clippy::wildcard_imports,
10 clippy::let_unit_value
11 )]
12 use tonic::codegen::http::Uri;
13 use tonic::codegen::*;
14 #[derive(Debug, Clone)]
15 pub struct QueryClient<T> {
16 inner: tonic::client::Grpc<T>,
17 }
18 #[cfg(feature = "grpc-transport")]
19 impl QueryClient<tonic::transport::Channel> {
20 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
22 where
23 D: TryInto<tonic::transport::Endpoint>,
24 D::Error: Into<StdError>,
25 {
26 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
27 Ok(Self::new(conn))
28 }
29 }
30 impl<T> QueryClient<T>
31 where
32 T: tonic::client::GrpcService<tonic::body::Body>,
33 T::Error: Into<StdError>,
34 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
35 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
36 {
37 pub fn new(inner: T) -> Self {
38 let inner = tonic::client::Grpc::new(inner);
39 Self { inner }
40 }
41 pub fn with_origin(inner: T, origin: Uri) -> Self {
42 let inner = tonic::client::Grpc::with_origin(inner, origin);
43 Self { inner }
44 }
45 pub fn with_interceptor<F>(
46 inner: T,
47 interceptor: F,
48 ) -> QueryClient<InterceptedService<T, F>>
49 where
50 F: tonic::service::Interceptor,
51 T::ResponseBody: Default,
52 T: tonic::codegen::Service<
53 http::Request<tonic::body::Body>,
54 Response = http::Response<
55 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
56 >,
57 >,
58 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
59 Into<StdError> + std::marker::Send + std::marker::Sync,
60 {
61 QueryClient::new(InterceptedService::new(inner, interceptor))
62 }
63 #[must_use]
68 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
69 self.inner = self.inner.send_compressed(encoding);
70 self
71 }
72 #[must_use]
74 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
75 self.inner = self.inner.accept_compressed(encoding);
76 self
77 }
78 #[must_use]
82 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
83 self.inner = self.inner.max_decoding_message_size(limit);
84 self
85 }
86 #[must_use]
90 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
91 self.inner = self.inner.max_encoding_message_size(limit);
92 self
93 }
94 pub async fn params(
95 &mut self,
96 request: impl tonic::IntoRequest<super::QueryParamsRequest>,
97 ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>
98 {
99 self.inner.ready().await.map_err(|e| {
100 tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
101 })?;
102 let codec = tonic::codec::ProstCodec::default();
103 let path = http::uri::PathAndQuery::from_static("/cosmos.mint.v1beta1.Query/Params");
104 let mut req = request.into_request();
105 req.extensions_mut()
106 .insert(GrpcMethod::new("cosmos.mint.v1beta1.Query", "Params"));
107 self.inner.unary(req, path, codec).await
108 }
109 pub async fn inflation(
110 &mut self,
111 request: impl tonic::IntoRequest<super::QueryInflationRequest>,
112 ) -> core::result::Result<tonic::Response<super::QueryInflationResponse>, tonic::Status>
113 {
114 self.inner.ready().await.map_err(|e| {
115 tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
116 })?;
117 let codec = tonic::codec::ProstCodec::default();
118 let path = http::uri::PathAndQuery::from_static("/cosmos.mint.v1beta1.Query/Inflation");
119 let mut req = request.into_request();
120 req.extensions_mut()
121 .insert(GrpcMethod::new("cosmos.mint.v1beta1.Query", "Inflation"));
122 self.inner.unary(req, path, codec).await
123 }
124 pub async fn annual_provisions(
125 &mut self,
126 request: impl tonic::IntoRequest<super::QueryAnnualProvisionsRequest>,
127 ) -> core::result::Result<
128 tonic::Response<super::QueryAnnualProvisionsResponse>,
129 tonic::Status,
130 > {
131 self.inner.ready().await.map_err(|e| {
132 tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
133 })?;
134 let codec = tonic::codec::ProstCodec::default();
135 let path =
136 http::uri::PathAndQuery::from_static("/cosmos.mint.v1beta1.Query/AnnualProvisions");
137 let mut req = request.into_request();
138 req.extensions_mut().insert(GrpcMethod::new(
139 "cosmos.mint.v1beta1.Query",
140 "AnnualProvisions",
141 ));
142 self.inner.unary(req, path, codec).await
143 }
144 }
145}
146#[cfg(feature = "grpc")]
148pub mod query_server {
149 #![allow(
150 unused_variables,
151 dead_code,
152 missing_docs,
153 clippy::wildcard_imports,
154 clippy::let_unit_value
155 )]
156 use tonic::codegen::*;
157 #[async_trait]
159 pub trait Query: std::marker::Send + std::marker::Sync + 'static {
160 async fn params(
161 &self,
162 request: tonic::Request<super::QueryParamsRequest>,
163 ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>;
164 async fn inflation(
165 &self,
166 request: tonic::Request<super::QueryInflationRequest>,
167 ) -> core::result::Result<tonic::Response<super::QueryInflationResponse>, tonic::Status>;
168 async fn annual_provisions(
169 &self,
170 request: tonic::Request<super::QueryAnnualProvisionsRequest>,
171 ) -> core::result::Result<
172 tonic::Response<super::QueryAnnualProvisionsResponse>,
173 tonic::Status,
174 >;
175 }
176 #[derive(Debug)]
177 pub struct QueryServer<T> {
178 inner: Arc<T>,
179 accept_compression_encodings: EnabledCompressionEncodings,
180 send_compression_encodings: EnabledCompressionEncodings,
181 max_decoding_message_size: Option<usize>,
182 max_encoding_message_size: Option<usize>,
183 }
184 impl<T> QueryServer<T> {
185 pub fn new(inner: T) -> Self {
186 Self::from_arc(Arc::new(inner))
187 }
188 pub fn from_arc(inner: Arc<T>) -> Self {
189 Self {
190 inner,
191 accept_compression_encodings: Default::default(),
192 send_compression_encodings: Default::default(),
193 max_decoding_message_size: None,
194 max_encoding_message_size: None,
195 }
196 }
197 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
198 where
199 F: tonic::service::Interceptor,
200 {
201 InterceptedService::new(Self::new(inner), interceptor)
202 }
203 #[must_use]
205 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
206 self.accept_compression_encodings.enable(encoding);
207 self
208 }
209 #[must_use]
211 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
212 self.send_compression_encodings.enable(encoding);
213 self
214 }
215 #[must_use]
219 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
220 self.max_decoding_message_size = Some(limit);
221 self
222 }
223 #[must_use]
227 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
228 self.max_encoding_message_size = Some(limit);
229 self
230 }
231 }
232 impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
233 where
234 T: Query,
235 B: Body + std::marker::Send + 'static,
236 B::Error: Into<StdError> + std::marker::Send + 'static,
237 {
238 type Response = http::Response<tonic::body::Body>;
239 type Error = std::convert::Infallible;
240 type Future = BoxFuture<Self::Response, Self::Error>;
241 fn poll_ready(
242 &mut self,
243 _cx: &mut Context<'_>,
244 ) -> Poll<core::result::Result<(), Self::Error>> {
245 Poll::Ready(Ok(()))
246 }
247 fn call(&mut self, req: http::Request<B>) -> Self::Future {
248 match req.uri().path() {
249 "/cosmos.mint.v1beta1.Query/Params" => {
250 #[allow(non_camel_case_types)]
251 struct ParamsSvc<T: Query>(pub Arc<T>);
252 impl<T: Query> tonic::server::UnaryService<super::QueryParamsRequest> for ParamsSvc<T> {
253 type Response = super::QueryParamsResponse;
254 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
255 fn call(
256 &mut self,
257 request: tonic::Request<super::QueryParamsRequest>,
258 ) -> Self::Future {
259 let inner = Arc::clone(&self.0);
260 let fut = async move { <T as Query>::params(&inner, request).await };
261 Box::pin(fut)
262 }
263 }
264 let accept_compression_encodings = self.accept_compression_encodings;
265 let send_compression_encodings = self.send_compression_encodings;
266 let max_decoding_message_size = self.max_decoding_message_size;
267 let max_encoding_message_size = self.max_encoding_message_size;
268 let inner = self.inner.clone();
269 let fut = async move {
270 let method = ParamsSvc(inner);
271 let codec = tonic::codec::ProstCodec::default();
272 let mut grpc = tonic::server::Grpc::new(codec)
273 .apply_compression_config(
274 accept_compression_encodings,
275 send_compression_encodings,
276 )
277 .apply_max_message_size_config(
278 max_decoding_message_size,
279 max_encoding_message_size,
280 );
281 let res = grpc.unary(method, req).await;
282 Ok(res)
283 };
284 Box::pin(fut)
285 }
286 "/cosmos.mint.v1beta1.Query/Inflation" => {
287 #[allow(non_camel_case_types)]
288 struct InflationSvc<T: Query>(pub Arc<T>);
289 impl<T: Query> tonic::server::UnaryService<super::QueryInflationRequest> for InflationSvc<T> {
290 type Response = super::QueryInflationResponse;
291 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
292 fn call(
293 &mut self,
294 request: tonic::Request<super::QueryInflationRequest>,
295 ) -> Self::Future {
296 let inner = Arc::clone(&self.0);
297 let fut = async move { <T as Query>::inflation(&inner, request).await };
298 Box::pin(fut)
299 }
300 }
301 let accept_compression_encodings = self.accept_compression_encodings;
302 let send_compression_encodings = self.send_compression_encodings;
303 let max_decoding_message_size = self.max_decoding_message_size;
304 let max_encoding_message_size = self.max_encoding_message_size;
305 let inner = self.inner.clone();
306 let fut = async move {
307 let method = InflationSvc(inner);
308 let codec = tonic::codec::ProstCodec::default();
309 let mut grpc = tonic::server::Grpc::new(codec)
310 .apply_compression_config(
311 accept_compression_encodings,
312 send_compression_encodings,
313 )
314 .apply_max_message_size_config(
315 max_decoding_message_size,
316 max_encoding_message_size,
317 );
318 let res = grpc.unary(method, req).await;
319 Ok(res)
320 };
321 Box::pin(fut)
322 }
323 "/cosmos.mint.v1beta1.Query/AnnualProvisions" => {
324 #[allow(non_camel_case_types)]
325 struct AnnualProvisionsSvc<T: Query>(pub Arc<T>);
326 impl<T: Query> tonic::server::UnaryService<super::QueryAnnualProvisionsRequest>
327 for AnnualProvisionsSvc<T>
328 {
329 type Response = super::QueryAnnualProvisionsResponse;
330 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
331 fn call(
332 &mut self,
333 request: tonic::Request<super::QueryAnnualProvisionsRequest>,
334 ) -> Self::Future {
335 let inner = Arc::clone(&self.0);
336 let fut = async move {
337 <T as Query>::annual_provisions(&inner, request).await
338 };
339 Box::pin(fut)
340 }
341 }
342 let accept_compression_encodings = self.accept_compression_encodings;
343 let send_compression_encodings = self.send_compression_encodings;
344 let max_decoding_message_size = self.max_decoding_message_size;
345 let max_encoding_message_size = self.max_encoding_message_size;
346 let inner = self.inner.clone();
347 let fut = async move {
348 let method = AnnualProvisionsSvc(inner);
349 let codec = tonic::codec::ProstCodec::default();
350 let mut grpc = tonic::server::Grpc::new(codec)
351 .apply_compression_config(
352 accept_compression_encodings,
353 send_compression_encodings,
354 )
355 .apply_max_message_size_config(
356 max_decoding_message_size,
357 max_encoding_message_size,
358 );
359 let res = grpc.unary(method, req).await;
360 Ok(res)
361 };
362 Box::pin(fut)
363 }
364 _ => Box::pin(async move {
365 let mut response = http::Response::new(tonic::body::Body::default());
366 let headers = response.headers_mut();
367 headers.insert(
368 tonic::Status::GRPC_STATUS,
369 (tonic::Code::Unimplemented as i32).into(),
370 );
371 headers.insert(
372 http::header::CONTENT_TYPE,
373 tonic::metadata::GRPC_CONTENT_TYPE,
374 );
375 Ok(response)
376 }),
377 }
378 }
379 }
380 impl<T> Clone for QueryServer<T> {
381 fn clone(&self) -> Self {
382 let inner = self.inner.clone();
383 Self {
384 inner,
385 accept_compression_encodings: self.accept_compression_encodings,
386 send_compression_encodings: self.send_compression_encodings,
387 max_decoding_message_size: self.max_decoding_message_size,
388 max_encoding_message_size: self.max_encoding_message_size,
389 }
390 }
391 }
392 pub const SERVICE_NAME: &str = "cosmos.mint.v1beta1.Query";
394 impl<T> tonic::server::NamedService for QueryServer<T> {
395 const NAME: &'static str = SERVICE_NAME;
396 }
397}
398#[cfg(feature = "grpc")]
400pub mod msg_client {
401 #![allow(
402 unused_variables,
403 dead_code,
404 missing_docs,
405 clippy::wildcard_imports,
406 clippy::let_unit_value
407 )]
408 use tonic::codegen::http::Uri;
409 use tonic::codegen::*;
410 #[derive(Debug, Clone)]
411 pub struct MsgClient<T> {
412 inner: tonic::client::Grpc<T>,
413 }
414 #[cfg(feature = "grpc-transport")]
415 impl MsgClient<tonic::transport::Channel> {
416 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
418 where
419 D: TryInto<tonic::transport::Endpoint>,
420 D::Error: Into<StdError>,
421 {
422 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
423 Ok(Self::new(conn))
424 }
425 }
426 impl<T> MsgClient<T>
427 where
428 T: tonic::client::GrpcService<tonic::body::Body>,
429 T::Error: Into<StdError>,
430 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
431 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
432 {
433 pub fn new(inner: T) -> Self {
434 let inner = tonic::client::Grpc::new(inner);
435 Self { inner }
436 }
437 pub fn with_origin(inner: T, origin: Uri) -> Self {
438 let inner = tonic::client::Grpc::with_origin(inner, origin);
439 Self { inner }
440 }
441 pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
442 where
443 F: tonic::service::Interceptor,
444 T::ResponseBody: Default,
445 T: tonic::codegen::Service<
446 http::Request<tonic::body::Body>,
447 Response = http::Response<
448 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
449 >,
450 >,
451 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
452 Into<StdError> + std::marker::Send + std::marker::Sync,
453 {
454 MsgClient::new(InterceptedService::new(inner, interceptor))
455 }
456 #[must_use]
461 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
462 self.inner = self.inner.send_compressed(encoding);
463 self
464 }
465 #[must_use]
467 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
468 self.inner = self.inner.accept_compressed(encoding);
469 self
470 }
471 #[must_use]
475 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
476 self.inner = self.inner.max_decoding_message_size(limit);
477 self
478 }
479 #[must_use]
483 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
484 self.inner = self.inner.max_encoding_message_size(limit);
485 self
486 }
487 pub async fn update_params(
488 &mut self,
489 request: impl tonic::IntoRequest<super::MsgUpdateParams>,
490 ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>
491 {
492 self.inner.ready().await.map_err(|e| {
493 tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
494 })?;
495 let codec = tonic::codec::ProstCodec::default();
496 let path =
497 http::uri::PathAndQuery::from_static("/cosmos.mint.v1beta1.Msg/UpdateParams");
498 let mut req = request.into_request();
499 req.extensions_mut()
500 .insert(GrpcMethod::new("cosmos.mint.v1beta1.Msg", "UpdateParams"));
501 self.inner.unary(req, path, codec).await
502 }
503 }
504}
505#[cfg(feature = "grpc")]
507pub mod msg_server {
508 #![allow(
509 unused_variables,
510 dead_code,
511 missing_docs,
512 clippy::wildcard_imports,
513 clippy::let_unit_value
514 )]
515 use tonic::codegen::*;
516 #[async_trait]
518 pub trait Msg: std::marker::Send + std::marker::Sync + 'static {
519 async fn update_params(
520 &self,
521 request: tonic::Request<super::MsgUpdateParams>,
522 ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>;
523 }
524 #[derive(Debug)]
525 pub struct MsgServer<T> {
526 inner: Arc<T>,
527 accept_compression_encodings: EnabledCompressionEncodings,
528 send_compression_encodings: EnabledCompressionEncodings,
529 max_decoding_message_size: Option<usize>,
530 max_encoding_message_size: Option<usize>,
531 }
532 impl<T> MsgServer<T> {
533 pub fn new(inner: T) -> Self {
534 Self::from_arc(Arc::new(inner))
535 }
536 pub fn from_arc(inner: Arc<T>) -> Self {
537 Self {
538 inner,
539 accept_compression_encodings: Default::default(),
540 send_compression_encodings: Default::default(),
541 max_decoding_message_size: None,
542 max_encoding_message_size: None,
543 }
544 }
545 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
546 where
547 F: tonic::service::Interceptor,
548 {
549 InterceptedService::new(Self::new(inner), interceptor)
550 }
551 #[must_use]
553 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
554 self.accept_compression_encodings.enable(encoding);
555 self
556 }
557 #[must_use]
559 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
560 self.send_compression_encodings.enable(encoding);
561 self
562 }
563 #[must_use]
567 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
568 self.max_decoding_message_size = Some(limit);
569 self
570 }
571 #[must_use]
575 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
576 self.max_encoding_message_size = Some(limit);
577 self
578 }
579 }
580 impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
581 where
582 T: Msg,
583 B: Body + std::marker::Send + 'static,
584 B::Error: Into<StdError> + std::marker::Send + 'static,
585 {
586 type Response = http::Response<tonic::body::Body>;
587 type Error = std::convert::Infallible;
588 type Future = BoxFuture<Self::Response, Self::Error>;
589 fn poll_ready(
590 &mut self,
591 _cx: &mut Context<'_>,
592 ) -> Poll<core::result::Result<(), Self::Error>> {
593 Poll::Ready(Ok(()))
594 }
595 fn call(&mut self, req: http::Request<B>) -> Self::Future {
596 match req.uri().path() {
597 "/cosmos.mint.v1beta1.Msg/UpdateParams" => {
598 #[allow(non_camel_case_types)]
599 struct UpdateParamsSvc<T: Msg>(pub Arc<T>);
600 impl<T: Msg> tonic::server::UnaryService<super::MsgUpdateParams> for UpdateParamsSvc<T> {
601 type Response = super::MsgUpdateParamsResponse;
602 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
603 fn call(
604 &mut self,
605 request: tonic::Request<super::MsgUpdateParams>,
606 ) -> Self::Future {
607 let inner = Arc::clone(&self.0);
608 let fut =
609 async move { <T as Msg>::update_params(&inner, request).await };
610 Box::pin(fut)
611 }
612 }
613 let accept_compression_encodings = self.accept_compression_encodings;
614 let send_compression_encodings = self.send_compression_encodings;
615 let max_decoding_message_size = self.max_decoding_message_size;
616 let max_encoding_message_size = self.max_encoding_message_size;
617 let inner = self.inner.clone();
618 let fut = async move {
619 let method = UpdateParamsSvc(inner);
620 let codec = tonic::codec::ProstCodec::default();
621 let mut grpc = tonic::server::Grpc::new(codec)
622 .apply_compression_config(
623 accept_compression_encodings,
624 send_compression_encodings,
625 )
626 .apply_max_message_size_config(
627 max_decoding_message_size,
628 max_encoding_message_size,
629 );
630 let res = grpc.unary(method, req).await;
631 Ok(res)
632 };
633 Box::pin(fut)
634 }
635 _ => Box::pin(async move {
636 let mut response = http::Response::new(tonic::body::Body::default());
637 let headers = response.headers_mut();
638 headers.insert(
639 tonic::Status::GRPC_STATUS,
640 (tonic::Code::Unimplemented as i32).into(),
641 );
642 headers.insert(
643 http::header::CONTENT_TYPE,
644 tonic::metadata::GRPC_CONTENT_TYPE,
645 );
646 Ok(response)
647 }),
648 }
649 }
650 }
651 impl<T> Clone for MsgServer<T> {
652 fn clone(&self) -> Self {
653 let inner = self.inner.clone();
654 Self {
655 inner,
656 accept_compression_encodings: self.accept_compression_encodings,
657 send_compression_encodings: self.send_compression_encodings,
658 max_decoding_message_size: self.max_decoding_message_size,
659 max_encoding_message_size: self.max_encoding_message_size,
660 }
661 }
662 }
663 pub const SERVICE_NAME: &str = "cosmos.mint.v1beta1.Msg";
665 impl<T> tonic::server::NamedService for MsgServer<T> {
666 const NAME: &'static str = SERVICE_NAME;
667 }
668}