1pub mod reward_service_client {
4 #![allow(
5 unused_variables,
6 dead_code,
7 missing_docs,
8 clippy::wildcard_imports,
9 clippy::let_unit_value,
10 )]
11 use tonic::codegen::*;
12 use tonic::codegen::http::Uri;
13 #[derive(Debug, Clone)]
15 pub struct RewardServiceClient<T> {
16 inner: tonic::client::Grpc<T>,
17 }
18 impl RewardServiceClient<tonic::transport::Channel> {
19 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
21 where
22 D: TryInto<tonic::transport::Endpoint>,
23 D::Error: Into<StdError>,
24 {
25 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
26 Ok(Self::new(conn))
27 }
28 }
29 impl<T> RewardServiceClient<T>
30 where
31 T: tonic::client::GrpcService<tonic::body::Body>,
32 T::Error: Into<StdError>,
33 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
34 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
35 {
36 pub fn new(inner: T) -> Self {
37 let inner = tonic::client::Grpc::new(inner);
38 Self { inner }
39 }
40 pub fn with_origin(inner: T, origin: Uri) -> Self {
41 let inner = tonic::client::Grpc::with_origin(inner, origin);
42 Self { inner }
43 }
44 pub fn with_interceptor<F>(
45 inner: T,
46 interceptor: F,
47 ) -> RewardServiceClient<InterceptedService<T, F>>
48 where
49 F: tonic::service::Interceptor,
50 T::ResponseBody: Default,
51 T: tonic::codegen::Service<
52 http::Request<tonic::body::Body>,
53 Response = http::Response<
54 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
55 >,
56 >,
57 <T as tonic::codegen::Service<
58 http::Request<tonic::body::Body>,
59 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
60 {
61 RewardServiceClient::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 get_reward_claim_input(
96 &mut self,
97 request: impl tonic::IntoRequest<
98 ::serialization_api::v2::GetRewardClaimInputRequest,
99 >,
100 ) -> std::result::Result<
101 tonic::Response<::serialization_api::v2::RewardClaimInput>,
102 tonic::Status,
103 > {
104 self.inner
105 .ready()
106 .await
107 .map_err(|e| {
108 tonic::Status::unknown(
109 format!("Service was not ready: {}", e.into()),
110 )
111 })?;
112 let codec = tonic_prost::ProstCodec::default();
113 let path = http::uri::PathAndQuery::from_static(
114 "/espresso.api.v2.RewardService/GetRewardClaimInput",
115 );
116 let mut req = request.into_request();
117 req.extensions_mut()
118 .insert(
119 GrpcMethod::new(
120 "espresso.api.v2.RewardService",
121 "GetRewardClaimInput",
122 ),
123 );
124 self.inner.unary(req, path, codec).await
125 }
126 pub async fn get_reward_balance(
128 &mut self,
129 request: impl tonic::IntoRequest<
130 ::serialization_api::v2::GetRewardBalanceRequest,
131 >,
132 ) -> std::result::Result<
133 tonic::Response<::serialization_api::v2::RewardBalance>,
134 tonic::Status,
135 > {
136 self.inner
137 .ready()
138 .await
139 .map_err(|e| {
140 tonic::Status::unknown(
141 format!("Service was not ready: {}", e.into()),
142 )
143 })?;
144 let codec = tonic_prost::ProstCodec::default();
145 let path = http::uri::PathAndQuery::from_static(
146 "/espresso.api.v2.RewardService/GetRewardBalance",
147 );
148 let mut req = request.into_request();
149 req.extensions_mut()
150 .insert(
151 GrpcMethod::new("espresso.api.v2.RewardService", "GetRewardBalance"),
152 );
153 self.inner.unary(req, path, codec).await
154 }
155 pub async fn get_reward_account_proof(
157 &mut self,
158 request: impl tonic::IntoRequest<
159 ::serialization_api::v2::GetRewardAccountProofRequest,
160 >,
161 ) -> std::result::Result<
162 tonic::Response<::serialization_api::v2::RewardAccountQueryDataV2>,
163 tonic::Status,
164 > {
165 self.inner
166 .ready()
167 .await
168 .map_err(|e| {
169 tonic::Status::unknown(
170 format!("Service was not ready: {}", e.into()),
171 )
172 })?;
173 let codec = tonic_prost::ProstCodec::default();
174 let path = http::uri::PathAndQuery::from_static(
175 "/espresso.api.v2.RewardService/GetRewardAccountProof",
176 );
177 let mut req = request.into_request();
178 req.extensions_mut()
179 .insert(
180 GrpcMethod::new(
181 "espresso.api.v2.RewardService",
182 "GetRewardAccountProof",
183 ),
184 );
185 self.inner.unary(req, path, codec).await
186 }
187 pub async fn get_reward_balances(
189 &mut self,
190 request: impl tonic::IntoRequest<
191 ::serialization_api::v2::GetRewardBalancesRequest,
192 >,
193 ) -> std::result::Result<
194 tonic::Response<::serialization_api::v2::RewardBalances>,
195 tonic::Status,
196 > {
197 self.inner
198 .ready()
199 .await
200 .map_err(|e| {
201 tonic::Status::unknown(
202 format!("Service was not ready: {}", e.into()),
203 )
204 })?;
205 let codec = tonic_prost::ProstCodec::default();
206 let path = http::uri::PathAndQuery::from_static(
207 "/espresso.api.v2.RewardService/GetRewardBalances",
208 );
209 let mut req = request.into_request();
210 req.extensions_mut()
211 .insert(
212 GrpcMethod::new("espresso.api.v2.RewardService", "GetRewardBalances"),
213 );
214 self.inner.unary(req, path, codec).await
215 }
216 pub async fn get_reward_merkle_tree_v2(
218 &mut self,
219 request: impl tonic::IntoRequest<
220 ::serialization_api::v2::GetRewardMerkleTreeRequest,
221 >,
222 ) -> std::result::Result<
223 tonic::Response<::serialization_api::v2::RewardMerkleTreeV2Data>,
224 tonic::Status,
225 > {
226 self.inner
227 .ready()
228 .await
229 .map_err(|e| {
230 tonic::Status::unknown(
231 format!("Service was not ready: {}", e.into()),
232 )
233 })?;
234 let codec = tonic_prost::ProstCodec::default();
235 let path = http::uri::PathAndQuery::from_static(
236 "/espresso.api.v2.RewardService/GetRewardMerkleTreeV2",
237 );
238 let mut req = request.into_request();
239 req.extensions_mut()
240 .insert(
241 GrpcMethod::new(
242 "espresso.api.v2.RewardService",
243 "GetRewardMerkleTreeV2",
244 ),
245 );
246 self.inner.unary(req, path, codec).await
247 }
248 }
249}
250pub mod reward_service_server {
252 #![allow(
253 unused_variables,
254 dead_code,
255 missing_docs,
256 clippy::wildcard_imports,
257 clippy::let_unit_value,
258 )]
259 use tonic::codegen::*;
260 #[async_trait]
262 pub trait RewardService: std::marker::Send + std::marker::Sync + 'static {
263 async fn get_reward_claim_input(
265 &self,
266 request: tonic::Request<::serialization_api::v2::GetRewardClaimInputRequest>,
267 ) -> std::result::Result<
268 tonic::Response<::serialization_api::v2::RewardClaimInput>,
269 tonic::Status,
270 >;
271 async fn get_reward_balance(
273 &self,
274 request: tonic::Request<::serialization_api::v2::GetRewardBalanceRequest>,
275 ) -> std::result::Result<
276 tonic::Response<::serialization_api::v2::RewardBalance>,
277 tonic::Status,
278 >;
279 async fn get_reward_account_proof(
281 &self,
282 request: tonic::Request<
283 ::serialization_api::v2::GetRewardAccountProofRequest,
284 >,
285 ) -> std::result::Result<
286 tonic::Response<::serialization_api::v2::RewardAccountQueryDataV2>,
287 tonic::Status,
288 >;
289 async fn get_reward_balances(
291 &self,
292 request: tonic::Request<::serialization_api::v2::GetRewardBalancesRequest>,
293 ) -> std::result::Result<
294 tonic::Response<::serialization_api::v2::RewardBalances>,
295 tonic::Status,
296 >;
297 async fn get_reward_merkle_tree_v2(
299 &self,
300 request: tonic::Request<::serialization_api::v2::GetRewardMerkleTreeRequest>,
301 ) -> std::result::Result<
302 tonic::Response<::serialization_api::v2::RewardMerkleTreeV2Data>,
303 tonic::Status,
304 >;
305 }
306 #[derive(Debug)]
308 pub struct RewardServiceServer<T> {
309 inner: Arc<T>,
310 accept_compression_encodings: EnabledCompressionEncodings,
311 send_compression_encodings: EnabledCompressionEncodings,
312 max_decoding_message_size: Option<usize>,
313 max_encoding_message_size: Option<usize>,
314 }
315 impl<T> RewardServiceServer<T> {
316 pub fn new(inner: T) -> Self {
317 Self::from_arc(Arc::new(inner))
318 }
319 pub fn from_arc(inner: Arc<T>) -> Self {
320 Self {
321 inner,
322 accept_compression_encodings: Default::default(),
323 send_compression_encodings: Default::default(),
324 max_decoding_message_size: None,
325 max_encoding_message_size: None,
326 }
327 }
328 pub fn with_interceptor<F>(
329 inner: T,
330 interceptor: F,
331 ) -> InterceptedService<Self, F>
332 where
333 F: tonic::service::Interceptor,
334 {
335 InterceptedService::new(Self::new(inner), interceptor)
336 }
337 #[must_use]
339 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
340 self.accept_compression_encodings.enable(encoding);
341 self
342 }
343 #[must_use]
345 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
346 self.send_compression_encodings.enable(encoding);
347 self
348 }
349 #[must_use]
353 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
354 self.max_decoding_message_size = Some(limit);
355 self
356 }
357 #[must_use]
361 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
362 self.max_encoding_message_size = Some(limit);
363 self
364 }
365 }
366 impl<T, B> tonic::codegen::Service<http::Request<B>> for RewardServiceServer<T>
367 where
368 T: RewardService,
369 B: Body + std::marker::Send + 'static,
370 B::Error: Into<StdError> + std::marker::Send + 'static,
371 {
372 type Response = http::Response<tonic::body::Body>;
373 type Error = std::convert::Infallible;
374 type Future = BoxFuture<Self::Response, Self::Error>;
375 fn poll_ready(
376 &mut self,
377 _cx: &mut Context<'_>,
378 ) -> Poll<std::result::Result<(), Self::Error>> {
379 Poll::Ready(Ok(()))
380 }
381 fn call(&mut self, req: http::Request<B>) -> Self::Future {
382 match req.uri().path() {
383 "/espresso.api.v2.RewardService/GetRewardClaimInput" => {
384 #[allow(non_camel_case_types)]
385 struct GetRewardClaimInputSvc<T: RewardService>(pub Arc<T>);
386 impl<
387 T: RewardService,
388 > tonic::server::UnaryService<
389 ::serialization_api::v2::GetRewardClaimInputRequest,
390 > for GetRewardClaimInputSvc<T> {
391 type Response = ::serialization_api::v2::RewardClaimInput;
392 type Future = BoxFuture<
393 tonic::Response<Self::Response>,
394 tonic::Status,
395 >;
396 fn call(
397 &mut self,
398 request: tonic::Request<
399 ::serialization_api::v2::GetRewardClaimInputRequest,
400 >,
401 ) -> Self::Future {
402 let inner = Arc::clone(&self.0);
403 let fut = async move {
404 <T as RewardService>::get_reward_claim_input(
405 &inner,
406 request,
407 )
408 .await
409 };
410 Box::pin(fut)
411 }
412 }
413 let accept_compression_encodings = self.accept_compression_encodings;
414 let send_compression_encodings = self.send_compression_encodings;
415 let max_decoding_message_size = self.max_decoding_message_size;
416 let max_encoding_message_size = self.max_encoding_message_size;
417 let inner = self.inner.clone();
418 let fut = async move {
419 let method = GetRewardClaimInputSvc(inner);
420 let codec = tonic_prost::ProstCodec::default();
421 let mut grpc = tonic::server::Grpc::new(codec)
422 .apply_compression_config(
423 accept_compression_encodings,
424 send_compression_encodings,
425 )
426 .apply_max_message_size_config(
427 max_decoding_message_size,
428 max_encoding_message_size,
429 );
430 let res = grpc.unary(method, req).await;
431 Ok(res)
432 };
433 Box::pin(fut)
434 }
435 "/espresso.api.v2.RewardService/GetRewardBalance" => {
436 #[allow(non_camel_case_types)]
437 struct GetRewardBalanceSvc<T: RewardService>(pub Arc<T>);
438 impl<
439 T: RewardService,
440 > tonic::server::UnaryService<
441 ::serialization_api::v2::GetRewardBalanceRequest,
442 > for GetRewardBalanceSvc<T> {
443 type Response = ::serialization_api::v2::RewardBalance;
444 type Future = BoxFuture<
445 tonic::Response<Self::Response>,
446 tonic::Status,
447 >;
448 fn call(
449 &mut self,
450 request: tonic::Request<
451 ::serialization_api::v2::GetRewardBalanceRequest,
452 >,
453 ) -> Self::Future {
454 let inner = Arc::clone(&self.0);
455 let fut = async move {
456 <T as RewardService>::get_reward_balance(&inner, request)
457 .await
458 };
459 Box::pin(fut)
460 }
461 }
462 let accept_compression_encodings = self.accept_compression_encodings;
463 let send_compression_encodings = self.send_compression_encodings;
464 let max_decoding_message_size = self.max_decoding_message_size;
465 let max_encoding_message_size = self.max_encoding_message_size;
466 let inner = self.inner.clone();
467 let fut = async move {
468 let method = GetRewardBalanceSvc(inner);
469 let codec = tonic_prost::ProstCodec::default();
470 let mut grpc = tonic::server::Grpc::new(codec)
471 .apply_compression_config(
472 accept_compression_encodings,
473 send_compression_encodings,
474 )
475 .apply_max_message_size_config(
476 max_decoding_message_size,
477 max_encoding_message_size,
478 );
479 let res = grpc.unary(method, req).await;
480 Ok(res)
481 };
482 Box::pin(fut)
483 }
484 "/espresso.api.v2.RewardService/GetRewardAccountProof" => {
485 #[allow(non_camel_case_types)]
486 struct GetRewardAccountProofSvc<T: RewardService>(pub Arc<T>);
487 impl<
488 T: RewardService,
489 > tonic::server::UnaryService<
490 ::serialization_api::v2::GetRewardAccountProofRequest,
491 > for GetRewardAccountProofSvc<T> {
492 type Response = ::serialization_api::v2::RewardAccountQueryDataV2;
493 type Future = BoxFuture<
494 tonic::Response<Self::Response>,
495 tonic::Status,
496 >;
497 fn call(
498 &mut self,
499 request: tonic::Request<
500 ::serialization_api::v2::GetRewardAccountProofRequest,
501 >,
502 ) -> Self::Future {
503 let inner = Arc::clone(&self.0);
504 let fut = async move {
505 <T as RewardService>::get_reward_account_proof(
506 &inner,
507 request,
508 )
509 .await
510 };
511 Box::pin(fut)
512 }
513 }
514 let accept_compression_encodings = self.accept_compression_encodings;
515 let send_compression_encodings = self.send_compression_encodings;
516 let max_decoding_message_size = self.max_decoding_message_size;
517 let max_encoding_message_size = self.max_encoding_message_size;
518 let inner = self.inner.clone();
519 let fut = async move {
520 let method = GetRewardAccountProofSvc(inner);
521 let codec = tonic_prost::ProstCodec::default();
522 let mut grpc = tonic::server::Grpc::new(codec)
523 .apply_compression_config(
524 accept_compression_encodings,
525 send_compression_encodings,
526 )
527 .apply_max_message_size_config(
528 max_decoding_message_size,
529 max_encoding_message_size,
530 );
531 let res = grpc.unary(method, req).await;
532 Ok(res)
533 };
534 Box::pin(fut)
535 }
536 "/espresso.api.v2.RewardService/GetRewardBalances" => {
537 #[allow(non_camel_case_types)]
538 struct GetRewardBalancesSvc<T: RewardService>(pub Arc<T>);
539 impl<
540 T: RewardService,
541 > tonic::server::UnaryService<
542 ::serialization_api::v2::GetRewardBalancesRequest,
543 > for GetRewardBalancesSvc<T> {
544 type Response = ::serialization_api::v2::RewardBalances;
545 type Future = BoxFuture<
546 tonic::Response<Self::Response>,
547 tonic::Status,
548 >;
549 fn call(
550 &mut self,
551 request: tonic::Request<
552 ::serialization_api::v2::GetRewardBalancesRequest,
553 >,
554 ) -> Self::Future {
555 let inner = Arc::clone(&self.0);
556 let fut = async move {
557 <T as RewardService>::get_reward_balances(&inner, request)
558 .await
559 };
560 Box::pin(fut)
561 }
562 }
563 let accept_compression_encodings = self.accept_compression_encodings;
564 let send_compression_encodings = self.send_compression_encodings;
565 let max_decoding_message_size = self.max_decoding_message_size;
566 let max_encoding_message_size = self.max_encoding_message_size;
567 let inner = self.inner.clone();
568 let fut = async move {
569 let method = GetRewardBalancesSvc(inner);
570 let codec = tonic_prost::ProstCodec::default();
571 let mut grpc = tonic::server::Grpc::new(codec)
572 .apply_compression_config(
573 accept_compression_encodings,
574 send_compression_encodings,
575 )
576 .apply_max_message_size_config(
577 max_decoding_message_size,
578 max_encoding_message_size,
579 );
580 let res = grpc.unary(method, req).await;
581 Ok(res)
582 };
583 Box::pin(fut)
584 }
585 "/espresso.api.v2.RewardService/GetRewardMerkleTreeV2" => {
586 #[allow(non_camel_case_types)]
587 struct GetRewardMerkleTreeV2Svc<T: RewardService>(pub Arc<T>);
588 impl<
589 T: RewardService,
590 > tonic::server::UnaryService<
591 ::serialization_api::v2::GetRewardMerkleTreeRequest,
592 > for GetRewardMerkleTreeV2Svc<T> {
593 type Response = ::serialization_api::v2::RewardMerkleTreeV2Data;
594 type Future = BoxFuture<
595 tonic::Response<Self::Response>,
596 tonic::Status,
597 >;
598 fn call(
599 &mut self,
600 request: tonic::Request<
601 ::serialization_api::v2::GetRewardMerkleTreeRequest,
602 >,
603 ) -> Self::Future {
604 let inner = Arc::clone(&self.0);
605 let fut = async move {
606 <T as RewardService>::get_reward_merkle_tree_v2(
607 &inner,
608 request,
609 )
610 .await
611 };
612 Box::pin(fut)
613 }
614 }
615 let accept_compression_encodings = self.accept_compression_encodings;
616 let send_compression_encodings = self.send_compression_encodings;
617 let max_decoding_message_size = self.max_decoding_message_size;
618 let max_encoding_message_size = self.max_encoding_message_size;
619 let inner = self.inner.clone();
620 let fut = async move {
621 let method = GetRewardMerkleTreeV2Svc(inner);
622 let codec = tonic_prost::ProstCodec::default();
623 let mut grpc = tonic::server::Grpc::new(codec)
624 .apply_compression_config(
625 accept_compression_encodings,
626 send_compression_encodings,
627 )
628 .apply_max_message_size_config(
629 max_decoding_message_size,
630 max_encoding_message_size,
631 );
632 let res = grpc.unary(method, req).await;
633 Ok(res)
634 };
635 Box::pin(fut)
636 }
637 _ => {
638 Box::pin(async move {
639 let mut response = http::Response::new(
640 tonic::body::Body::default(),
641 );
642 let headers = response.headers_mut();
643 headers
644 .insert(
645 tonic::Status::GRPC_STATUS,
646 (tonic::Code::Unimplemented as i32).into(),
647 );
648 headers
649 .insert(
650 http::header::CONTENT_TYPE,
651 tonic::metadata::GRPC_CONTENT_TYPE,
652 );
653 Ok(response)
654 })
655 }
656 }
657 }
658 }
659 impl<T> Clone for RewardServiceServer<T> {
660 fn clone(&self) -> Self {
661 let inner = self.inner.clone();
662 Self {
663 inner,
664 accept_compression_encodings: self.accept_compression_encodings,
665 send_compression_encodings: self.send_compression_encodings,
666 max_decoding_message_size: self.max_decoding_message_size,
667 max_encoding_message_size: self.max_encoding_message_size,
668 }
669 }
670 }
671 pub const SERVICE_NAME: &str = "espresso.api.v2.RewardService";
673 impl<T> tonic::server::NamedService for RewardServiceServer<T> {
674 const NAME: &'static str = SERVICE_NAME;
675 }
676}
677pub mod data_service_client {
679 #![allow(
680 unused_variables,
681 dead_code,
682 missing_docs,
683 clippy::wildcard_imports,
684 clippy::let_unit_value,
685 )]
686 use tonic::codegen::*;
687 use tonic::codegen::http::Uri;
688 #[derive(Debug, Clone)]
690 pub struct DataServiceClient<T> {
691 inner: tonic::client::Grpc<T>,
692 }
693 impl DataServiceClient<tonic::transport::Channel> {
694 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
696 where
697 D: TryInto<tonic::transport::Endpoint>,
698 D::Error: Into<StdError>,
699 {
700 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
701 Ok(Self::new(conn))
702 }
703 }
704 impl<T> DataServiceClient<T>
705 where
706 T: tonic::client::GrpcService<tonic::body::Body>,
707 T::Error: Into<StdError>,
708 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
709 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
710 {
711 pub fn new(inner: T) -> Self {
712 let inner = tonic::client::Grpc::new(inner);
713 Self { inner }
714 }
715 pub fn with_origin(inner: T, origin: Uri) -> Self {
716 let inner = tonic::client::Grpc::with_origin(inner, origin);
717 Self { inner }
718 }
719 pub fn with_interceptor<F>(
720 inner: T,
721 interceptor: F,
722 ) -> DataServiceClient<InterceptedService<T, F>>
723 where
724 F: tonic::service::Interceptor,
725 T::ResponseBody: Default,
726 T: tonic::codegen::Service<
727 http::Request<tonic::body::Body>,
728 Response = http::Response<
729 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
730 >,
731 >,
732 <T as tonic::codegen::Service<
733 http::Request<tonic::body::Body>,
734 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
735 {
736 DataServiceClient::new(InterceptedService::new(inner, interceptor))
737 }
738 #[must_use]
743 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
744 self.inner = self.inner.send_compressed(encoding);
745 self
746 }
747 #[must_use]
749 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
750 self.inner = self.inner.accept_compressed(encoding);
751 self
752 }
753 #[must_use]
757 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
758 self.inner = self.inner.max_decoding_message_size(limit);
759 self
760 }
761 #[must_use]
765 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
766 self.inner = self.inner.max_encoding_message_size(limit);
767 self
768 }
769 pub async fn get_namespace_proof(
771 &mut self,
772 request: impl tonic::IntoRequest<
773 ::serialization_api::v2::GetNamespaceProofRequest,
774 >,
775 ) -> std::result::Result<
776 tonic::Response<::serialization_api::v2::GetNamespaceProofResponse>,
777 tonic::Status,
778 > {
779 self.inner
780 .ready()
781 .await
782 .map_err(|e| {
783 tonic::Status::unknown(
784 format!("Service was not ready: {}", e.into()),
785 )
786 })?;
787 let codec = tonic_prost::ProstCodec::default();
788 let path = http::uri::PathAndQuery::from_static(
789 "/espresso.api.v2.DataService/GetNamespaceProof",
790 );
791 let mut req = request.into_request();
792 req.extensions_mut()
793 .insert(
794 GrpcMethod::new("espresso.api.v2.DataService", "GetNamespaceProof"),
795 );
796 self.inner.unary(req, path, codec).await
797 }
798 pub async fn get_incorrect_encoding_proof(
800 &mut self,
801 request: impl tonic::IntoRequest<
802 ::serialization_api::v2::GetIncorrectEncodingProofRequest,
803 >,
804 ) -> std::result::Result<
805 tonic::Response<::serialization_api::v2::IncorrectEncodingProofResponse>,
806 tonic::Status,
807 > {
808 self.inner
809 .ready()
810 .await
811 .map_err(|e| {
812 tonic::Status::unknown(
813 format!("Service was not ready: {}", e.into()),
814 )
815 })?;
816 let codec = tonic_prost::ProstCodec::default();
817 let path = http::uri::PathAndQuery::from_static(
818 "/espresso.api.v2.DataService/GetIncorrectEncodingProof",
819 );
820 let mut req = request.into_request();
821 req.extensions_mut()
822 .insert(
823 GrpcMethod::new(
824 "espresso.api.v2.DataService",
825 "GetIncorrectEncodingProof",
826 ),
827 );
828 self.inner.unary(req, path, codec).await
829 }
830 }
831}
832pub mod data_service_server {
834 #![allow(
835 unused_variables,
836 dead_code,
837 missing_docs,
838 clippy::wildcard_imports,
839 clippy::let_unit_value,
840 )]
841 use tonic::codegen::*;
842 #[async_trait]
844 pub trait DataService: std::marker::Send + std::marker::Sync + 'static {
845 async fn get_namespace_proof(
847 &self,
848 request: tonic::Request<::serialization_api::v2::GetNamespaceProofRequest>,
849 ) -> std::result::Result<
850 tonic::Response<::serialization_api::v2::GetNamespaceProofResponse>,
851 tonic::Status,
852 >;
853 async fn get_incorrect_encoding_proof(
855 &self,
856 request: tonic::Request<
857 ::serialization_api::v2::GetIncorrectEncodingProofRequest,
858 >,
859 ) -> std::result::Result<
860 tonic::Response<::serialization_api::v2::IncorrectEncodingProofResponse>,
861 tonic::Status,
862 >;
863 }
864 #[derive(Debug)]
866 pub struct DataServiceServer<T> {
867 inner: Arc<T>,
868 accept_compression_encodings: EnabledCompressionEncodings,
869 send_compression_encodings: EnabledCompressionEncodings,
870 max_decoding_message_size: Option<usize>,
871 max_encoding_message_size: Option<usize>,
872 }
873 impl<T> DataServiceServer<T> {
874 pub fn new(inner: T) -> Self {
875 Self::from_arc(Arc::new(inner))
876 }
877 pub fn from_arc(inner: Arc<T>) -> Self {
878 Self {
879 inner,
880 accept_compression_encodings: Default::default(),
881 send_compression_encodings: Default::default(),
882 max_decoding_message_size: None,
883 max_encoding_message_size: None,
884 }
885 }
886 pub fn with_interceptor<F>(
887 inner: T,
888 interceptor: F,
889 ) -> InterceptedService<Self, F>
890 where
891 F: tonic::service::Interceptor,
892 {
893 InterceptedService::new(Self::new(inner), interceptor)
894 }
895 #[must_use]
897 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
898 self.accept_compression_encodings.enable(encoding);
899 self
900 }
901 #[must_use]
903 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
904 self.send_compression_encodings.enable(encoding);
905 self
906 }
907 #[must_use]
911 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
912 self.max_decoding_message_size = Some(limit);
913 self
914 }
915 #[must_use]
919 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
920 self.max_encoding_message_size = Some(limit);
921 self
922 }
923 }
924 impl<T, B> tonic::codegen::Service<http::Request<B>> for DataServiceServer<T>
925 where
926 T: DataService,
927 B: Body + std::marker::Send + 'static,
928 B::Error: Into<StdError> + std::marker::Send + 'static,
929 {
930 type Response = http::Response<tonic::body::Body>;
931 type Error = std::convert::Infallible;
932 type Future = BoxFuture<Self::Response, Self::Error>;
933 fn poll_ready(
934 &mut self,
935 _cx: &mut Context<'_>,
936 ) -> Poll<std::result::Result<(), Self::Error>> {
937 Poll::Ready(Ok(()))
938 }
939 fn call(&mut self, req: http::Request<B>) -> Self::Future {
940 match req.uri().path() {
941 "/espresso.api.v2.DataService/GetNamespaceProof" => {
942 #[allow(non_camel_case_types)]
943 struct GetNamespaceProofSvc<T: DataService>(pub Arc<T>);
944 impl<
945 T: DataService,
946 > tonic::server::UnaryService<
947 ::serialization_api::v2::GetNamespaceProofRequest,
948 > for GetNamespaceProofSvc<T> {
949 type Response = ::serialization_api::v2::GetNamespaceProofResponse;
950 type Future = BoxFuture<
951 tonic::Response<Self::Response>,
952 tonic::Status,
953 >;
954 fn call(
955 &mut self,
956 request: tonic::Request<
957 ::serialization_api::v2::GetNamespaceProofRequest,
958 >,
959 ) -> Self::Future {
960 let inner = Arc::clone(&self.0);
961 let fut = async move {
962 <T as DataService>::get_namespace_proof(&inner, request)
963 .await
964 };
965 Box::pin(fut)
966 }
967 }
968 let accept_compression_encodings = self.accept_compression_encodings;
969 let send_compression_encodings = self.send_compression_encodings;
970 let max_decoding_message_size = self.max_decoding_message_size;
971 let max_encoding_message_size = self.max_encoding_message_size;
972 let inner = self.inner.clone();
973 let fut = async move {
974 let method = GetNamespaceProofSvc(inner);
975 let codec = tonic_prost::ProstCodec::default();
976 let mut grpc = tonic::server::Grpc::new(codec)
977 .apply_compression_config(
978 accept_compression_encodings,
979 send_compression_encodings,
980 )
981 .apply_max_message_size_config(
982 max_decoding_message_size,
983 max_encoding_message_size,
984 );
985 let res = grpc.unary(method, req).await;
986 Ok(res)
987 };
988 Box::pin(fut)
989 }
990 "/espresso.api.v2.DataService/GetIncorrectEncodingProof" => {
991 #[allow(non_camel_case_types)]
992 struct GetIncorrectEncodingProofSvc<T: DataService>(pub Arc<T>);
993 impl<
994 T: DataService,
995 > tonic::server::UnaryService<
996 ::serialization_api::v2::GetIncorrectEncodingProofRequest,
997 > for GetIncorrectEncodingProofSvc<T> {
998 type Response = ::serialization_api::v2::IncorrectEncodingProofResponse;
999 type Future = BoxFuture<
1000 tonic::Response<Self::Response>,
1001 tonic::Status,
1002 >;
1003 fn call(
1004 &mut self,
1005 request: tonic::Request<
1006 ::serialization_api::v2::GetIncorrectEncodingProofRequest,
1007 >,
1008 ) -> Self::Future {
1009 let inner = Arc::clone(&self.0);
1010 let fut = async move {
1011 <T as DataService>::get_incorrect_encoding_proof(
1012 &inner,
1013 request,
1014 )
1015 .await
1016 };
1017 Box::pin(fut)
1018 }
1019 }
1020 let accept_compression_encodings = self.accept_compression_encodings;
1021 let send_compression_encodings = self.send_compression_encodings;
1022 let max_decoding_message_size = self.max_decoding_message_size;
1023 let max_encoding_message_size = self.max_encoding_message_size;
1024 let inner = self.inner.clone();
1025 let fut = async move {
1026 let method = GetIncorrectEncodingProofSvc(inner);
1027 let codec = tonic_prost::ProstCodec::default();
1028 let mut grpc = tonic::server::Grpc::new(codec)
1029 .apply_compression_config(
1030 accept_compression_encodings,
1031 send_compression_encodings,
1032 )
1033 .apply_max_message_size_config(
1034 max_decoding_message_size,
1035 max_encoding_message_size,
1036 );
1037 let res = grpc.unary(method, req).await;
1038 Ok(res)
1039 };
1040 Box::pin(fut)
1041 }
1042 _ => {
1043 Box::pin(async move {
1044 let mut response = http::Response::new(
1045 tonic::body::Body::default(),
1046 );
1047 let headers = response.headers_mut();
1048 headers
1049 .insert(
1050 tonic::Status::GRPC_STATUS,
1051 (tonic::Code::Unimplemented as i32).into(),
1052 );
1053 headers
1054 .insert(
1055 http::header::CONTENT_TYPE,
1056 tonic::metadata::GRPC_CONTENT_TYPE,
1057 );
1058 Ok(response)
1059 })
1060 }
1061 }
1062 }
1063 }
1064 impl<T> Clone for DataServiceServer<T> {
1065 fn clone(&self) -> Self {
1066 let inner = self.inner.clone();
1067 Self {
1068 inner,
1069 accept_compression_encodings: self.accept_compression_encodings,
1070 send_compression_encodings: self.send_compression_encodings,
1071 max_decoding_message_size: self.max_decoding_message_size,
1072 max_encoding_message_size: self.max_encoding_message_size,
1073 }
1074 }
1075 }
1076 pub const SERVICE_NAME: &str = "espresso.api.v2.DataService";
1078 impl<T> tonic::server::NamedService for DataServiceServer<T> {
1079 const NAME: &'static str = SERVICE_NAME;
1080 }
1081}
1082pub mod consensus_service_client {
1084 #![allow(
1085 unused_variables,
1086 dead_code,
1087 missing_docs,
1088 clippy::wildcard_imports,
1089 clippy::let_unit_value,
1090 )]
1091 use tonic::codegen::*;
1092 use tonic::codegen::http::Uri;
1093 #[derive(Debug, Clone)]
1095 pub struct ConsensusServiceClient<T> {
1096 inner: tonic::client::Grpc<T>,
1097 }
1098 impl ConsensusServiceClient<tonic::transport::Channel> {
1099 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1101 where
1102 D: TryInto<tonic::transport::Endpoint>,
1103 D::Error: Into<StdError>,
1104 {
1105 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1106 Ok(Self::new(conn))
1107 }
1108 }
1109 impl<T> ConsensusServiceClient<T>
1110 where
1111 T: tonic::client::GrpcService<tonic::body::Body>,
1112 T::Error: Into<StdError>,
1113 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1114 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1115 {
1116 pub fn new(inner: T) -> Self {
1117 let inner = tonic::client::Grpc::new(inner);
1118 Self { inner }
1119 }
1120 pub fn with_origin(inner: T, origin: Uri) -> Self {
1121 let inner = tonic::client::Grpc::with_origin(inner, origin);
1122 Self { inner }
1123 }
1124 pub fn with_interceptor<F>(
1125 inner: T,
1126 interceptor: F,
1127 ) -> ConsensusServiceClient<InterceptedService<T, F>>
1128 where
1129 F: tonic::service::Interceptor,
1130 T::ResponseBody: Default,
1131 T: tonic::codegen::Service<
1132 http::Request<tonic::body::Body>,
1133 Response = http::Response<
1134 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1135 >,
1136 >,
1137 <T as tonic::codegen::Service<
1138 http::Request<tonic::body::Body>,
1139 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1140 {
1141 ConsensusServiceClient::new(InterceptedService::new(inner, interceptor))
1142 }
1143 #[must_use]
1148 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1149 self.inner = self.inner.send_compressed(encoding);
1150 self
1151 }
1152 #[must_use]
1154 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1155 self.inner = self.inner.accept_compressed(encoding);
1156 self
1157 }
1158 #[must_use]
1162 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1163 self.inner = self.inner.max_decoding_message_size(limit);
1164 self
1165 }
1166 #[must_use]
1170 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1171 self.inner = self.inner.max_encoding_message_size(limit);
1172 self
1173 }
1174 pub async fn get_state_certificate(
1176 &mut self,
1177 request: impl tonic::IntoRequest<
1178 ::serialization_api::v2::GetStateCertificateRequest,
1179 >,
1180 ) -> std::result::Result<
1181 tonic::Response<::serialization_api::v2::StateCertificateResponse>,
1182 tonic::Status,
1183 > {
1184 self.inner
1185 .ready()
1186 .await
1187 .map_err(|e| {
1188 tonic::Status::unknown(
1189 format!("Service was not ready: {}", e.into()),
1190 )
1191 })?;
1192 let codec = tonic_prost::ProstCodec::default();
1193 let path = http::uri::PathAndQuery::from_static(
1194 "/espresso.api.v2.ConsensusService/GetStateCertificate",
1195 );
1196 let mut req = request.into_request();
1197 req.extensions_mut()
1198 .insert(
1199 GrpcMethod::new(
1200 "espresso.api.v2.ConsensusService",
1201 "GetStateCertificate",
1202 ),
1203 );
1204 self.inner.unary(req, path, codec).await
1205 }
1206 pub async fn get_stake_table(
1208 &mut self,
1209 request: impl tonic::IntoRequest<
1210 ::serialization_api::v2::GetStakeTableRequest,
1211 >,
1212 ) -> std::result::Result<
1213 tonic::Response<::serialization_api::v2::StakeTableResponse>,
1214 tonic::Status,
1215 > {
1216 self.inner
1217 .ready()
1218 .await
1219 .map_err(|e| {
1220 tonic::Status::unknown(
1221 format!("Service was not ready: {}", e.into()),
1222 )
1223 })?;
1224 let codec = tonic_prost::ProstCodec::default();
1225 let path = http::uri::PathAndQuery::from_static(
1226 "/espresso.api.v2.ConsensusService/GetStakeTable",
1227 );
1228 let mut req = request.into_request();
1229 req.extensions_mut()
1230 .insert(
1231 GrpcMethod::new("espresso.api.v2.ConsensusService", "GetStakeTable"),
1232 );
1233 self.inner.unary(req, path, codec).await
1234 }
1235 }
1236}
1237pub mod consensus_service_server {
1239 #![allow(
1240 unused_variables,
1241 dead_code,
1242 missing_docs,
1243 clippy::wildcard_imports,
1244 clippy::let_unit_value,
1245 )]
1246 use tonic::codegen::*;
1247 #[async_trait]
1249 pub trait ConsensusService: std::marker::Send + std::marker::Sync + 'static {
1250 async fn get_state_certificate(
1252 &self,
1253 request: tonic::Request<::serialization_api::v2::GetStateCertificateRequest>,
1254 ) -> std::result::Result<
1255 tonic::Response<::serialization_api::v2::StateCertificateResponse>,
1256 tonic::Status,
1257 >;
1258 async fn get_stake_table(
1260 &self,
1261 request: tonic::Request<::serialization_api::v2::GetStakeTableRequest>,
1262 ) -> std::result::Result<
1263 tonic::Response<::serialization_api::v2::StakeTableResponse>,
1264 tonic::Status,
1265 >;
1266 }
1267 #[derive(Debug)]
1269 pub struct ConsensusServiceServer<T> {
1270 inner: Arc<T>,
1271 accept_compression_encodings: EnabledCompressionEncodings,
1272 send_compression_encodings: EnabledCompressionEncodings,
1273 max_decoding_message_size: Option<usize>,
1274 max_encoding_message_size: Option<usize>,
1275 }
1276 impl<T> ConsensusServiceServer<T> {
1277 pub fn new(inner: T) -> Self {
1278 Self::from_arc(Arc::new(inner))
1279 }
1280 pub fn from_arc(inner: Arc<T>) -> Self {
1281 Self {
1282 inner,
1283 accept_compression_encodings: Default::default(),
1284 send_compression_encodings: Default::default(),
1285 max_decoding_message_size: None,
1286 max_encoding_message_size: None,
1287 }
1288 }
1289 pub fn with_interceptor<F>(
1290 inner: T,
1291 interceptor: F,
1292 ) -> InterceptedService<Self, F>
1293 where
1294 F: tonic::service::Interceptor,
1295 {
1296 InterceptedService::new(Self::new(inner), interceptor)
1297 }
1298 #[must_use]
1300 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1301 self.accept_compression_encodings.enable(encoding);
1302 self
1303 }
1304 #[must_use]
1306 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1307 self.send_compression_encodings.enable(encoding);
1308 self
1309 }
1310 #[must_use]
1314 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1315 self.max_decoding_message_size = Some(limit);
1316 self
1317 }
1318 #[must_use]
1322 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1323 self.max_encoding_message_size = Some(limit);
1324 self
1325 }
1326 }
1327 impl<T, B> tonic::codegen::Service<http::Request<B>> for ConsensusServiceServer<T>
1328 where
1329 T: ConsensusService,
1330 B: Body + std::marker::Send + 'static,
1331 B::Error: Into<StdError> + std::marker::Send + 'static,
1332 {
1333 type Response = http::Response<tonic::body::Body>;
1334 type Error = std::convert::Infallible;
1335 type Future = BoxFuture<Self::Response, Self::Error>;
1336 fn poll_ready(
1337 &mut self,
1338 _cx: &mut Context<'_>,
1339 ) -> Poll<std::result::Result<(), Self::Error>> {
1340 Poll::Ready(Ok(()))
1341 }
1342 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1343 match req.uri().path() {
1344 "/espresso.api.v2.ConsensusService/GetStateCertificate" => {
1345 #[allow(non_camel_case_types)]
1346 struct GetStateCertificateSvc<T: ConsensusService>(pub Arc<T>);
1347 impl<
1348 T: ConsensusService,
1349 > tonic::server::UnaryService<
1350 ::serialization_api::v2::GetStateCertificateRequest,
1351 > for GetStateCertificateSvc<T> {
1352 type Response = ::serialization_api::v2::StateCertificateResponse;
1353 type Future = BoxFuture<
1354 tonic::Response<Self::Response>,
1355 tonic::Status,
1356 >;
1357 fn call(
1358 &mut self,
1359 request: tonic::Request<
1360 ::serialization_api::v2::GetStateCertificateRequest,
1361 >,
1362 ) -> Self::Future {
1363 let inner = Arc::clone(&self.0);
1364 let fut = async move {
1365 <T as ConsensusService>::get_state_certificate(
1366 &inner,
1367 request,
1368 )
1369 .await
1370 };
1371 Box::pin(fut)
1372 }
1373 }
1374 let accept_compression_encodings = self.accept_compression_encodings;
1375 let send_compression_encodings = self.send_compression_encodings;
1376 let max_decoding_message_size = self.max_decoding_message_size;
1377 let max_encoding_message_size = self.max_encoding_message_size;
1378 let inner = self.inner.clone();
1379 let fut = async move {
1380 let method = GetStateCertificateSvc(inner);
1381 let codec = tonic_prost::ProstCodec::default();
1382 let mut grpc = tonic::server::Grpc::new(codec)
1383 .apply_compression_config(
1384 accept_compression_encodings,
1385 send_compression_encodings,
1386 )
1387 .apply_max_message_size_config(
1388 max_decoding_message_size,
1389 max_encoding_message_size,
1390 );
1391 let res = grpc.unary(method, req).await;
1392 Ok(res)
1393 };
1394 Box::pin(fut)
1395 }
1396 "/espresso.api.v2.ConsensusService/GetStakeTable" => {
1397 #[allow(non_camel_case_types)]
1398 struct GetStakeTableSvc<T: ConsensusService>(pub Arc<T>);
1399 impl<
1400 T: ConsensusService,
1401 > tonic::server::UnaryService<
1402 ::serialization_api::v2::GetStakeTableRequest,
1403 > for GetStakeTableSvc<T> {
1404 type Response = ::serialization_api::v2::StakeTableResponse;
1405 type Future = BoxFuture<
1406 tonic::Response<Self::Response>,
1407 tonic::Status,
1408 >;
1409 fn call(
1410 &mut self,
1411 request: tonic::Request<
1412 ::serialization_api::v2::GetStakeTableRequest,
1413 >,
1414 ) -> Self::Future {
1415 let inner = Arc::clone(&self.0);
1416 let fut = async move {
1417 <T as ConsensusService>::get_stake_table(&inner, request)
1418 .await
1419 };
1420 Box::pin(fut)
1421 }
1422 }
1423 let accept_compression_encodings = self.accept_compression_encodings;
1424 let send_compression_encodings = self.send_compression_encodings;
1425 let max_decoding_message_size = self.max_decoding_message_size;
1426 let max_encoding_message_size = self.max_encoding_message_size;
1427 let inner = self.inner.clone();
1428 let fut = async move {
1429 let method = GetStakeTableSvc(inner);
1430 let codec = tonic_prost::ProstCodec::default();
1431 let mut grpc = tonic::server::Grpc::new(codec)
1432 .apply_compression_config(
1433 accept_compression_encodings,
1434 send_compression_encodings,
1435 )
1436 .apply_max_message_size_config(
1437 max_decoding_message_size,
1438 max_encoding_message_size,
1439 );
1440 let res = grpc.unary(method, req).await;
1441 Ok(res)
1442 };
1443 Box::pin(fut)
1444 }
1445 _ => {
1446 Box::pin(async move {
1447 let mut response = http::Response::new(
1448 tonic::body::Body::default(),
1449 );
1450 let headers = response.headers_mut();
1451 headers
1452 .insert(
1453 tonic::Status::GRPC_STATUS,
1454 (tonic::Code::Unimplemented as i32).into(),
1455 );
1456 headers
1457 .insert(
1458 http::header::CONTENT_TYPE,
1459 tonic::metadata::GRPC_CONTENT_TYPE,
1460 );
1461 Ok(response)
1462 })
1463 }
1464 }
1465 }
1466 }
1467 impl<T> Clone for ConsensusServiceServer<T> {
1468 fn clone(&self) -> Self {
1469 let inner = self.inner.clone();
1470 Self {
1471 inner,
1472 accept_compression_encodings: self.accept_compression_encodings,
1473 send_compression_encodings: self.send_compression_encodings,
1474 max_decoding_message_size: self.max_decoding_message_size,
1475 max_encoding_message_size: self.max_encoding_message_size,
1476 }
1477 }
1478 }
1479 pub const SERVICE_NAME: &str = "espresso.api.v2.ConsensusService";
1481 impl<T> tonic::server::NamedService for ConsensusServiceServer<T> {
1482 const NAME: &'static str = SERVICE_NAME;
1483 }
1484}