1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct BlsPublicKey {
4 #[prost(string, tag = "1")]
6 pub key: ::prost::alloc::string::String,
7}
8#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9pub struct SchnorrPublicKey {
10 #[prost(string, tag = "1")]
12 pub key: ::prost::alloc::string::String,
13}
14#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
15pub struct GetBlockHeightRequest {}
16#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
17pub struct BlockHeightResponse {
18 #[prost(uint64, tag = "1")]
20 pub height: u64,
21}
22#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
23pub struct GetSuccessRateRequest {}
24#[derive(Clone, Copy, PartialEq, ::prost::Message)]
25pub struct SuccessRateResponse {
26 #[prost(double, tag = "1")]
30 pub rate: f64,
31}
32#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
33pub struct GetTimeSinceLastDecideRequest {}
34#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
35pub struct TimeSinceLastDecideResponse {
36 #[prost(uint64, tag = "1")]
38 pub seconds: u64,
39}
40#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
41pub struct GetNodeKeysRequest {}
42#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
43pub struct NodeKeysResponse {
44 #[prost(string, optional, tag = "1")]
46 pub eth_account: ::core::option::Option<::prost::alloc::string::String>,
47 #[prost(message, optional, tag = "2")]
48 pub consensus_key: ::core::option::Option<BlsPublicKey>,
49 #[prost(message, optional, tag = "3")]
50 pub state_ver_key: ::core::option::Option<SchnorrPublicKey>,
51 #[prost(string, optional, tag = "4")]
53 pub x25519_key: ::core::option::Option<::prost::alloc::string::String>,
54}
55pub mod status_service_server {
57 #![allow(
58 unused_variables,
59 dead_code,
60 missing_docs,
61 clippy::wildcard_imports,
62 clippy::let_unit_value,
63 )]
64 use tonic::codegen::*;
65 #[async_trait]
67 pub trait StatusService: std::marker::Send + std::marker::Sync + 'static {
68 async fn get_block_height(
70 &self,
71 request: tonic::Request<super::GetBlockHeightRequest>,
72 ) -> std::result::Result<
73 tonic::Response<super::BlockHeightResponse>,
74 tonic::Status,
75 >;
76 async fn get_success_rate(
78 &self,
79 request: tonic::Request<super::GetSuccessRateRequest>,
80 ) -> std::result::Result<
81 tonic::Response<super::SuccessRateResponse>,
82 tonic::Status,
83 >;
84 async fn get_time_since_last_decide(
86 &self,
87 request: tonic::Request<super::GetTimeSinceLastDecideRequest>,
88 ) -> std::result::Result<
89 tonic::Response<super::TimeSinceLastDecideResponse>,
90 tonic::Status,
91 >;
92 async fn get_node_keys(
94 &self,
95 request: tonic::Request<super::GetNodeKeysRequest>,
96 ) -> std::result::Result<
97 tonic::Response<super::NodeKeysResponse>,
98 tonic::Status,
99 >;
100 }
101 #[derive(Debug)]
102 pub struct StatusServiceServer<T> {
103 inner: Arc<T>,
104 accept_compression_encodings: EnabledCompressionEncodings,
105 send_compression_encodings: EnabledCompressionEncodings,
106 max_decoding_message_size: Option<usize>,
107 max_encoding_message_size: Option<usize>,
108 }
109 impl<T> StatusServiceServer<T> {
110 pub fn new(inner: T) -> Self {
111 Self::from_arc(Arc::new(inner))
112 }
113 pub fn from_arc(inner: Arc<T>) -> Self {
114 Self {
115 inner,
116 accept_compression_encodings: Default::default(),
117 send_compression_encodings: Default::default(),
118 max_decoding_message_size: None,
119 max_encoding_message_size: None,
120 }
121 }
122 pub fn with_interceptor<F>(
123 inner: T,
124 interceptor: F,
125 ) -> InterceptedService<Self, F>
126 where
127 F: tonic::service::Interceptor,
128 {
129 InterceptedService::new(Self::new(inner), interceptor)
130 }
131 #[must_use]
133 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
134 self.accept_compression_encodings.enable(encoding);
135 self
136 }
137 #[must_use]
139 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
140 self.send_compression_encodings.enable(encoding);
141 self
142 }
143 #[must_use]
147 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
148 self.max_decoding_message_size = Some(limit);
149 self
150 }
151 #[must_use]
155 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
156 self.max_encoding_message_size = Some(limit);
157 self
158 }
159 }
160 impl<T, B> tonic::codegen::Service<http::Request<B>> for StatusServiceServer<T>
161 where
162 T: StatusService,
163 B: Body + std::marker::Send + 'static,
164 B::Error: Into<StdError> + std::marker::Send + 'static,
165 {
166 type Response = http::Response<tonic::body::Body>;
167 type Error = std::convert::Infallible;
168 type Future = BoxFuture<Self::Response, Self::Error>;
169 fn poll_ready(
170 &mut self,
171 _cx: &mut Context<'_>,
172 ) -> Poll<std::result::Result<(), Self::Error>> {
173 Poll::Ready(Ok(()))
174 }
175 fn call(&mut self, req: http::Request<B>) -> Self::Future {
176 match req.uri().path() {
177 "/espresso.api.v2.StatusService/GetBlockHeight" => {
178 #[allow(non_camel_case_types)]
179 struct GetBlockHeightSvc<T: StatusService>(pub Arc<T>);
180 impl<
181 T: StatusService,
182 > tonic::server::UnaryService<super::GetBlockHeightRequest>
183 for GetBlockHeightSvc<T> {
184 type Response = super::BlockHeightResponse;
185 type Future = BoxFuture<
186 tonic::Response<Self::Response>,
187 tonic::Status,
188 >;
189 fn call(
190 &mut self,
191 request: tonic::Request<super::GetBlockHeightRequest>,
192 ) -> Self::Future {
193 let inner = Arc::clone(&self.0);
194 let fut = async move {
195 <T as StatusService>::get_block_height(&inner, request)
196 .await
197 };
198 Box::pin(fut)
199 }
200 }
201 let accept_compression_encodings = self.accept_compression_encodings;
202 let send_compression_encodings = self.send_compression_encodings;
203 let max_decoding_message_size = self.max_decoding_message_size;
204 let max_encoding_message_size = self.max_encoding_message_size;
205 let inner = self.inner.clone();
206 let fut = async move {
207 let method = GetBlockHeightSvc(inner);
208 let codec = tonic_prost::ProstCodec::default();
209 let mut grpc = tonic::server::Grpc::new(codec)
210 .apply_compression_config(
211 accept_compression_encodings,
212 send_compression_encodings,
213 )
214 .apply_max_message_size_config(
215 max_decoding_message_size,
216 max_encoding_message_size,
217 );
218 let res = grpc.unary(method, req).await;
219 Ok(res)
220 };
221 Box::pin(fut)
222 }
223 "/espresso.api.v2.StatusService/GetSuccessRate" => {
224 #[allow(non_camel_case_types)]
225 struct GetSuccessRateSvc<T: StatusService>(pub Arc<T>);
226 impl<
227 T: StatusService,
228 > tonic::server::UnaryService<super::GetSuccessRateRequest>
229 for GetSuccessRateSvc<T> {
230 type Response = super::SuccessRateResponse;
231 type Future = BoxFuture<
232 tonic::Response<Self::Response>,
233 tonic::Status,
234 >;
235 fn call(
236 &mut self,
237 request: tonic::Request<super::GetSuccessRateRequest>,
238 ) -> Self::Future {
239 let inner = Arc::clone(&self.0);
240 let fut = async move {
241 <T as StatusService>::get_success_rate(&inner, request)
242 .await
243 };
244 Box::pin(fut)
245 }
246 }
247 let accept_compression_encodings = self.accept_compression_encodings;
248 let send_compression_encodings = self.send_compression_encodings;
249 let max_decoding_message_size = self.max_decoding_message_size;
250 let max_encoding_message_size = self.max_encoding_message_size;
251 let inner = self.inner.clone();
252 let fut = async move {
253 let method = GetSuccessRateSvc(inner);
254 let codec = tonic_prost::ProstCodec::default();
255 let mut grpc = tonic::server::Grpc::new(codec)
256 .apply_compression_config(
257 accept_compression_encodings,
258 send_compression_encodings,
259 )
260 .apply_max_message_size_config(
261 max_decoding_message_size,
262 max_encoding_message_size,
263 );
264 let res = grpc.unary(method, req).await;
265 Ok(res)
266 };
267 Box::pin(fut)
268 }
269 "/espresso.api.v2.StatusService/GetTimeSinceLastDecide" => {
270 #[allow(non_camel_case_types)]
271 struct GetTimeSinceLastDecideSvc<T: StatusService>(pub Arc<T>);
272 impl<
273 T: StatusService,
274 > tonic::server::UnaryService<super::GetTimeSinceLastDecideRequest>
275 for GetTimeSinceLastDecideSvc<T> {
276 type Response = super::TimeSinceLastDecideResponse;
277 type Future = BoxFuture<
278 tonic::Response<Self::Response>,
279 tonic::Status,
280 >;
281 fn call(
282 &mut self,
283 request: tonic::Request<super::GetTimeSinceLastDecideRequest>,
284 ) -> Self::Future {
285 let inner = Arc::clone(&self.0);
286 let fut = async move {
287 <T as StatusService>::get_time_since_last_decide(
288 &inner,
289 request,
290 )
291 .await
292 };
293 Box::pin(fut)
294 }
295 }
296 let accept_compression_encodings = self.accept_compression_encodings;
297 let send_compression_encodings = self.send_compression_encodings;
298 let max_decoding_message_size = self.max_decoding_message_size;
299 let max_encoding_message_size = self.max_encoding_message_size;
300 let inner = self.inner.clone();
301 let fut = async move {
302 let method = GetTimeSinceLastDecideSvc(inner);
303 let codec = tonic_prost::ProstCodec::default();
304 let mut grpc = tonic::server::Grpc::new(codec)
305 .apply_compression_config(
306 accept_compression_encodings,
307 send_compression_encodings,
308 )
309 .apply_max_message_size_config(
310 max_decoding_message_size,
311 max_encoding_message_size,
312 );
313 let res = grpc.unary(method, req).await;
314 Ok(res)
315 };
316 Box::pin(fut)
317 }
318 "/espresso.api.v2.StatusService/GetNodeKeys" => {
319 #[allow(non_camel_case_types)]
320 struct GetNodeKeysSvc<T: StatusService>(pub Arc<T>);
321 impl<
322 T: StatusService,
323 > tonic::server::UnaryService<super::GetNodeKeysRequest>
324 for GetNodeKeysSvc<T> {
325 type Response = super::NodeKeysResponse;
326 type Future = BoxFuture<
327 tonic::Response<Self::Response>,
328 tonic::Status,
329 >;
330 fn call(
331 &mut self,
332 request: tonic::Request<super::GetNodeKeysRequest>,
333 ) -> Self::Future {
334 let inner = Arc::clone(&self.0);
335 let fut = async move {
336 <T as StatusService>::get_node_keys(&inner, request).await
337 };
338 Box::pin(fut)
339 }
340 }
341 let accept_compression_encodings = self.accept_compression_encodings;
342 let send_compression_encodings = self.send_compression_encodings;
343 let max_decoding_message_size = self.max_decoding_message_size;
344 let max_encoding_message_size = self.max_encoding_message_size;
345 let inner = self.inner.clone();
346 let fut = async move {
347 let method = GetNodeKeysSvc(inner);
348 let codec = tonic_prost::ProstCodec::default();
349 let mut grpc = tonic::server::Grpc::new(codec)
350 .apply_compression_config(
351 accept_compression_encodings,
352 send_compression_encodings,
353 )
354 .apply_max_message_size_config(
355 max_decoding_message_size,
356 max_encoding_message_size,
357 );
358 let res = grpc.unary(method, req).await;
359 Ok(res)
360 };
361 Box::pin(fut)
362 }
363 _ => {
364 Box::pin(async move {
365 let mut response = http::Response::new(
366 tonic::body::Body::default(),
367 );
368 let headers = response.headers_mut();
369 headers
370 .insert(
371 tonic::Status::GRPC_STATUS,
372 (tonic::Code::Unimplemented as i32).into(),
373 );
374 headers
375 .insert(
376 http::header::CONTENT_TYPE,
377 tonic::metadata::GRPC_CONTENT_TYPE,
378 );
379 Ok(response)
380 })
381 }
382 }
383 }
384 }
385 impl<T> Clone for StatusServiceServer<T> {
386 fn clone(&self) -> Self {
387 let inner = self.inner.clone();
388 Self {
389 inner,
390 accept_compression_encodings: self.accept_compression_encodings,
391 send_compression_encodings: self.send_compression_encodings,
392 max_decoding_message_size: self.max_decoding_message_size,
393 max_encoding_message_size: self.max_encoding_message_size,
394 }
395 }
396 }
397 pub const SERVICE_NAME: &str = "espresso.api.v2.StatusService";
399 impl<T> tonic::server::NamedService for StatusServiceServer<T> {
400 const NAME: &'static str = SERVICE_NAME;
401 }
402}
403#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
404pub struct GetTotalMintedSupplyRequest {}
405#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
406pub struct TotalMintedSupplyResponse {
407 #[prost(string, tag = "1")]
410 pub amount: ::prost::alloc::string::String,
411}
412#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
413pub struct GetCirculatingSupplyRequest {}
414#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
415pub struct CirculatingSupplyResponse {
416 #[prost(string, tag = "1")]
419 pub amount: ::prost::alloc::string::String,
420}
421#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
422pub struct GetCirculatingSupplyEthereumRequest {}
423#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
424pub struct CirculatingSupplyEthereumResponse {
425 #[prost(string, tag = "1")]
428 pub amount: ::prost::alloc::string::String,
429}
430#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
431pub struct GetTotalIssuedSupplyRequest {}
432#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
433pub struct TotalIssuedSupplyResponse {
434 #[prost(string, tag = "1")]
437 pub amount: ::prost::alloc::string::String,
438}
439#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
440pub struct GetTotalRewardDistributedRequest {}
441#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
442pub struct TotalRewardDistributedResponse {
443 #[prost(string, tag = "1")]
446 pub amount: ::prost::alloc::string::String,
447}
448pub mod token_service_server {
450 #![allow(
451 unused_variables,
452 dead_code,
453 missing_docs,
454 clippy::wildcard_imports,
455 clippy::let_unit_value,
456 )]
457 use tonic::codegen::*;
458 #[async_trait]
460 pub trait TokenService: std::marker::Send + std::marker::Sync + 'static {
461 async fn get_total_minted_supply(
463 &self,
464 request: tonic::Request<super::GetTotalMintedSupplyRequest>,
465 ) -> std::result::Result<
466 tonic::Response<super::TotalMintedSupplyResponse>,
467 tonic::Status,
468 >;
469 async fn get_circulating_supply(
471 &self,
472 request: tonic::Request<super::GetCirculatingSupplyRequest>,
473 ) -> std::result::Result<
474 tonic::Response<super::CirculatingSupplyResponse>,
475 tonic::Status,
476 >;
477 async fn get_circulating_supply_ethereum(
479 &self,
480 request: tonic::Request<super::GetCirculatingSupplyEthereumRequest>,
481 ) -> std::result::Result<
482 tonic::Response<super::CirculatingSupplyEthereumResponse>,
483 tonic::Status,
484 >;
485 async fn get_total_issued_supply(
487 &self,
488 request: tonic::Request<super::GetTotalIssuedSupplyRequest>,
489 ) -> std::result::Result<
490 tonic::Response<super::TotalIssuedSupplyResponse>,
491 tonic::Status,
492 >;
493 async fn get_total_reward_distributed(
495 &self,
496 request: tonic::Request<super::GetTotalRewardDistributedRequest>,
497 ) -> std::result::Result<
498 tonic::Response<super::TotalRewardDistributedResponse>,
499 tonic::Status,
500 >;
501 }
502 #[derive(Debug)]
503 pub struct TokenServiceServer<T> {
504 inner: Arc<T>,
505 accept_compression_encodings: EnabledCompressionEncodings,
506 send_compression_encodings: EnabledCompressionEncodings,
507 max_decoding_message_size: Option<usize>,
508 max_encoding_message_size: Option<usize>,
509 }
510 impl<T> TokenServiceServer<T> {
511 pub fn new(inner: T) -> Self {
512 Self::from_arc(Arc::new(inner))
513 }
514 pub fn from_arc(inner: Arc<T>) -> Self {
515 Self {
516 inner,
517 accept_compression_encodings: Default::default(),
518 send_compression_encodings: Default::default(),
519 max_decoding_message_size: None,
520 max_encoding_message_size: None,
521 }
522 }
523 pub fn with_interceptor<F>(
524 inner: T,
525 interceptor: F,
526 ) -> InterceptedService<Self, F>
527 where
528 F: tonic::service::Interceptor,
529 {
530 InterceptedService::new(Self::new(inner), interceptor)
531 }
532 #[must_use]
534 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
535 self.accept_compression_encodings.enable(encoding);
536 self
537 }
538 #[must_use]
540 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
541 self.send_compression_encodings.enable(encoding);
542 self
543 }
544 #[must_use]
548 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
549 self.max_decoding_message_size = Some(limit);
550 self
551 }
552 #[must_use]
556 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
557 self.max_encoding_message_size = Some(limit);
558 self
559 }
560 }
561 impl<T, B> tonic::codegen::Service<http::Request<B>> for TokenServiceServer<T>
562 where
563 T: TokenService,
564 B: Body + std::marker::Send + 'static,
565 B::Error: Into<StdError> + std::marker::Send + 'static,
566 {
567 type Response = http::Response<tonic::body::Body>;
568 type Error = std::convert::Infallible;
569 type Future = BoxFuture<Self::Response, Self::Error>;
570 fn poll_ready(
571 &mut self,
572 _cx: &mut Context<'_>,
573 ) -> Poll<std::result::Result<(), Self::Error>> {
574 Poll::Ready(Ok(()))
575 }
576 fn call(&mut self, req: http::Request<B>) -> Self::Future {
577 match req.uri().path() {
578 "/espresso.api.v2.TokenService/GetTotalMintedSupply" => {
579 #[allow(non_camel_case_types)]
580 struct GetTotalMintedSupplySvc<T: TokenService>(pub Arc<T>);
581 impl<
582 T: TokenService,
583 > tonic::server::UnaryService<super::GetTotalMintedSupplyRequest>
584 for GetTotalMintedSupplySvc<T> {
585 type Response = super::TotalMintedSupplyResponse;
586 type Future = BoxFuture<
587 tonic::Response<Self::Response>,
588 tonic::Status,
589 >;
590 fn call(
591 &mut self,
592 request: tonic::Request<super::GetTotalMintedSupplyRequest>,
593 ) -> Self::Future {
594 let inner = Arc::clone(&self.0);
595 let fut = async move {
596 <T as TokenService>::get_total_minted_supply(
597 &inner,
598 request,
599 )
600 .await
601 };
602 Box::pin(fut)
603 }
604 }
605 let accept_compression_encodings = self.accept_compression_encodings;
606 let send_compression_encodings = self.send_compression_encodings;
607 let max_decoding_message_size = self.max_decoding_message_size;
608 let max_encoding_message_size = self.max_encoding_message_size;
609 let inner = self.inner.clone();
610 let fut = async move {
611 let method = GetTotalMintedSupplySvc(inner);
612 let codec = tonic_prost::ProstCodec::default();
613 let mut grpc = tonic::server::Grpc::new(codec)
614 .apply_compression_config(
615 accept_compression_encodings,
616 send_compression_encodings,
617 )
618 .apply_max_message_size_config(
619 max_decoding_message_size,
620 max_encoding_message_size,
621 );
622 let res = grpc.unary(method, req).await;
623 Ok(res)
624 };
625 Box::pin(fut)
626 }
627 "/espresso.api.v2.TokenService/GetCirculatingSupply" => {
628 #[allow(non_camel_case_types)]
629 struct GetCirculatingSupplySvc<T: TokenService>(pub Arc<T>);
630 impl<
631 T: TokenService,
632 > tonic::server::UnaryService<super::GetCirculatingSupplyRequest>
633 for GetCirculatingSupplySvc<T> {
634 type Response = super::CirculatingSupplyResponse;
635 type Future = BoxFuture<
636 tonic::Response<Self::Response>,
637 tonic::Status,
638 >;
639 fn call(
640 &mut self,
641 request: tonic::Request<super::GetCirculatingSupplyRequest>,
642 ) -> Self::Future {
643 let inner = Arc::clone(&self.0);
644 let fut = async move {
645 <T as TokenService>::get_circulating_supply(&inner, request)
646 .await
647 };
648 Box::pin(fut)
649 }
650 }
651 let accept_compression_encodings = self.accept_compression_encodings;
652 let send_compression_encodings = self.send_compression_encodings;
653 let max_decoding_message_size = self.max_decoding_message_size;
654 let max_encoding_message_size = self.max_encoding_message_size;
655 let inner = self.inner.clone();
656 let fut = async move {
657 let method = GetCirculatingSupplySvc(inner);
658 let codec = tonic_prost::ProstCodec::default();
659 let mut grpc = tonic::server::Grpc::new(codec)
660 .apply_compression_config(
661 accept_compression_encodings,
662 send_compression_encodings,
663 )
664 .apply_max_message_size_config(
665 max_decoding_message_size,
666 max_encoding_message_size,
667 );
668 let res = grpc.unary(method, req).await;
669 Ok(res)
670 };
671 Box::pin(fut)
672 }
673 "/espresso.api.v2.TokenService/GetCirculatingSupplyEthereum" => {
674 #[allow(non_camel_case_types)]
675 struct GetCirculatingSupplyEthereumSvc<T: TokenService>(pub Arc<T>);
676 impl<
677 T: TokenService,
678 > tonic::server::UnaryService<
679 super::GetCirculatingSupplyEthereumRequest,
680 > for GetCirculatingSupplyEthereumSvc<T> {
681 type Response = super::CirculatingSupplyEthereumResponse;
682 type Future = BoxFuture<
683 tonic::Response<Self::Response>,
684 tonic::Status,
685 >;
686 fn call(
687 &mut self,
688 request: tonic::Request<
689 super::GetCirculatingSupplyEthereumRequest,
690 >,
691 ) -> Self::Future {
692 let inner = Arc::clone(&self.0);
693 let fut = async move {
694 <T as TokenService>::get_circulating_supply_ethereum(
695 &inner,
696 request,
697 )
698 .await
699 };
700 Box::pin(fut)
701 }
702 }
703 let accept_compression_encodings = self.accept_compression_encodings;
704 let send_compression_encodings = self.send_compression_encodings;
705 let max_decoding_message_size = self.max_decoding_message_size;
706 let max_encoding_message_size = self.max_encoding_message_size;
707 let inner = self.inner.clone();
708 let fut = async move {
709 let method = GetCirculatingSupplyEthereumSvc(inner);
710 let codec = tonic_prost::ProstCodec::default();
711 let mut grpc = tonic::server::Grpc::new(codec)
712 .apply_compression_config(
713 accept_compression_encodings,
714 send_compression_encodings,
715 )
716 .apply_max_message_size_config(
717 max_decoding_message_size,
718 max_encoding_message_size,
719 );
720 let res = grpc.unary(method, req).await;
721 Ok(res)
722 };
723 Box::pin(fut)
724 }
725 "/espresso.api.v2.TokenService/GetTotalIssuedSupply" => {
726 #[allow(non_camel_case_types)]
727 struct GetTotalIssuedSupplySvc<T: TokenService>(pub Arc<T>);
728 impl<
729 T: TokenService,
730 > tonic::server::UnaryService<super::GetTotalIssuedSupplyRequest>
731 for GetTotalIssuedSupplySvc<T> {
732 type Response = super::TotalIssuedSupplyResponse;
733 type Future = BoxFuture<
734 tonic::Response<Self::Response>,
735 tonic::Status,
736 >;
737 fn call(
738 &mut self,
739 request: tonic::Request<super::GetTotalIssuedSupplyRequest>,
740 ) -> Self::Future {
741 let inner = Arc::clone(&self.0);
742 let fut = async move {
743 <T as TokenService>::get_total_issued_supply(
744 &inner,
745 request,
746 )
747 .await
748 };
749 Box::pin(fut)
750 }
751 }
752 let accept_compression_encodings = self.accept_compression_encodings;
753 let send_compression_encodings = self.send_compression_encodings;
754 let max_decoding_message_size = self.max_decoding_message_size;
755 let max_encoding_message_size = self.max_encoding_message_size;
756 let inner = self.inner.clone();
757 let fut = async move {
758 let method = GetTotalIssuedSupplySvc(inner);
759 let codec = tonic_prost::ProstCodec::default();
760 let mut grpc = tonic::server::Grpc::new(codec)
761 .apply_compression_config(
762 accept_compression_encodings,
763 send_compression_encodings,
764 )
765 .apply_max_message_size_config(
766 max_decoding_message_size,
767 max_encoding_message_size,
768 );
769 let res = grpc.unary(method, req).await;
770 Ok(res)
771 };
772 Box::pin(fut)
773 }
774 "/espresso.api.v2.TokenService/GetTotalRewardDistributed" => {
775 #[allow(non_camel_case_types)]
776 struct GetTotalRewardDistributedSvc<T: TokenService>(pub Arc<T>);
777 impl<
778 T: TokenService,
779 > tonic::server::UnaryService<
780 super::GetTotalRewardDistributedRequest,
781 > for GetTotalRewardDistributedSvc<T> {
782 type Response = super::TotalRewardDistributedResponse;
783 type Future = BoxFuture<
784 tonic::Response<Self::Response>,
785 tonic::Status,
786 >;
787 fn call(
788 &mut self,
789 request: tonic::Request<
790 super::GetTotalRewardDistributedRequest,
791 >,
792 ) -> Self::Future {
793 let inner = Arc::clone(&self.0);
794 let fut = async move {
795 <T as TokenService>::get_total_reward_distributed(
796 &inner,
797 request,
798 )
799 .await
800 };
801 Box::pin(fut)
802 }
803 }
804 let accept_compression_encodings = self.accept_compression_encodings;
805 let send_compression_encodings = self.send_compression_encodings;
806 let max_decoding_message_size = self.max_decoding_message_size;
807 let max_encoding_message_size = self.max_encoding_message_size;
808 let inner = self.inner.clone();
809 let fut = async move {
810 let method = GetTotalRewardDistributedSvc(inner);
811 let codec = tonic_prost::ProstCodec::default();
812 let mut grpc = tonic::server::Grpc::new(codec)
813 .apply_compression_config(
814 accept_compression_encodings,
815 send_compression_encodings,
816 )
817 .apply_max_message_size_config(
818 max_decoding_message_size,
819 max_encoding_message_size,
820 );
821 let res = grpc.unary(method, req).await;
822 Ok(res)
823 };
824 Box::pin(fut)
825 }
826 _ => {
827 Box::pin(async move {
828 let mut response = http::Response::new(
829 tonic::body::Body::default(),
830 );
831 let headers = response.headers_mut();
832 headers
833 .insert(
834 tonic::Status::GRPC_STATUS,
835 (tonic::Code::Unimplemented as i32).into(),
836 );
837 headers
838 .insert(
839 http::header::CONTENT_TYPE,
840 tonic::metadata::GRPC_CONTENT_TYPE,
841 );
842 Ok(response)
843 })
844 }
845 }
846 }
847 }
848 impl<T> Clone for TokenServiceServer<T> {
849 fn clone(&self) -> Self {
850 let inner = self.inner.clone();
851 Self {
852 inner,
853 accept_compression_encodings: self.accept_compression_encodings,
854 send_compression_encodings: self.send_compression_encodings,
855 max_decoding_message_size: self.max_decoding_message_size,
856 max_encoding_message_size: self.max_encoding_message_size,
857 }
858 }
859 }
860 pub const SERVICE_NAME: &str = "espresso.api.v2.TokenService";
862 impl<T> tonic::server::NamedService for TokenServiceServer<T> {
863 const NAME: &'static str = SERVICE_NAME;
864 }
865}