1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct BlockInputsRequest {
5 #[prost(message, repeated, tag = "1")]
7 pub account_ids: ::prost::alloc::vec::Vec<super::account::AccountId>,
8 #[prost(message, repeated, tag = "2")]
18 pub nullifiers: ::prost::alloc::vec::Vec<super::primitives::Digest>,
19 #[prost(message, repeated, tag = "3")]
21 pub unauthenticated_notes: ::prost::alloc::vec::Vec<super::primitives::Digest>,
22 #[prost(fixed32, repeated, tag = "4")]
24 pub reference_blocks: ::prost::alloc::vec::Vec<u32>,
25}
26#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct BlockInputs {
29 #[prost(message, optional, tag = "1")]
31 pub latest_block_header: ::core::option::Option<super::blockchain::BlockHeader>,
32 #[prost(message, repeated, tag = "2")]
35 pub unauthenticated_note_proofs: ::prost::alloc::vec::Vec<
36 super::note::NoteInclusionInBlockProof,
37 >,
38 #[prost(bytes = "vec", tag = "3")]
42 pub partial_block_chain: ::prost::alloc::vec::Vec<u8>,
43 #[prost(message, repeated, tag = "4")]
45 pub account_witnesses: ::prost::alloc::vec::Vec<super::account::AccountWitness>,
46 #[prost(message, repeated, tag = "5")]
48 pub nullifier_witnesses: ::prost::alloc::vec::Vec<block_inputs::NullifierWitness>,
49}
50pub mod block_inputs {
52 #[derive(Clone, PartialEq, ::prost::Message)]
54 pub struct NullifierWitness {
55 #[prost(message, optional, tag = "1")]
57 pub nullifier: ::core::option::Option<super::super::primitives::Digest>,
58 #[prost(message, optional, tag = "2")]
60 pub opening: ::core::option::Option<super::super::primitives::SmtOpening>,
61 }
62}
63#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct BatchInputsRequest {
66 #[prost(message, repeated, tag = "1")]
68 pub note_commitments: ::prost::alloc::vec::Vec<super::primitives::Digest>,
69 #[prost(fixed32, repeated, tag = "2")]
71 pub reference_blocks: ::prost::alloc::vec::Vec<u32>,
72}
73#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct BatchInputs {
76 #[prost(message, optional, tag = "1")]
78 pub batch_reference_block_header: ::core::option::Option<
79 super::blockchain::BlockHeader,
80 >,
81 #[prost(message, repeated, tag = "2")]
83 pub note_proofs: ::prost::alloc::vec::Vec<super::note::NoteInclusionInBlockProof>,
84 #[prost(bytes = "vec", tag = "3")]
88 pub partial_block_chain: ::prost::alloc::vec::Vec<u8>,
89}
90#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct TransactionInputsRequest {
93 #[prost(message, optional, tag = "1")]
95 pub account_id: ::core::option::Option<super::account::AccountId>,
96 #[prost(message, repeated, tag = "2")]
98 pub nullifiers: ::prost::alloc::vec::Vec<super::primitives::Digest>,
99 #[prost(message, repeated, tag = "3")]
104 pub unauthenticated_notes: ::prost::alloc::vec::Vec<super::primitives::Digest>,
105}
106#[derive(Clone, PartialEq, ::prost::Message)]
108pub struct TransactionInputs {
109 #[prost(message, optional, tag = "1")]
111 pub account_state: ::core::option::Option<
112 transaction_inputs::AccountTransactionInputRecord,
113 >,
114 #[prost(message, repeated, tag = "2")]
116 pub nullifiers: ::prost::alloc::vec::Vec<
117 transaction_inputs::NullifierTransactionInputRecord,
118 >,
119 #[prost(message, repeated, tag = "3")]
121 pub found_unauthenticated_notes: ::prost::alloc::vec::Vec<super::primitives::Digest>,
122 #[prost(fixed32, tag = "4")]
124 pub block_height: u32,
125 #[prost(bool, optional, tag = "5")]
129 pub new_account_id_prefix_is_unique: ::core::option::Option<bool>,
130}
131pub mod transaction_inputs {
133 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
135 pub struct AccountTransactionInputRecord {
136 #[prost(message, optional, tag = "1")]
138 pub account_id: ::core::option::Option<super::super::account::AccountId>,
139 #[prost(message, optional, tag = "2")]
141 pub account_commitment: ::core::option::Option<super::super::primitives::Digest>,
142 }
143 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
145 pub struct NullifierTransactionInputRecord {
146 #[prost(message, optional, tag = "1")]
148 pub nullifier: ::core::option::Option<super::super::primitives::Digest>,
149 #[prost(fixed32, tag = "2")]
151 pub block_num: u32,
152 }
153}
154#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
156pub struct MaybeAccountDetails {
157 #[prost(message, optional, tag = "1")]
159 pub details: ::core::option::Option<super::account::AccountDetails>,
160}
161#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
165pub struct UnconsumedNetworkNotesRequest {
166 #[prost(uint64, optional, tag = "1")]
171 pub page_token: ::core::option::Option<u64>,
172 #[prost(uint64, tag = "2")]
174 pub page_size: u64,
175 #[prost(message, optional, tag = "3")]
177 pub account_id: ::core::option::Option<super::account::AccountId>,
178 #[prost(fixed32, tag = "4")]
182 pub block_num: u32,
183}
184#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct UnconsumedNetworkNotes {
187 #[prost(uint64, optional, tag = "1")]
194 pub next_token: ::core::option::Option<u64>,
195 #[prost(message, repeated, tag = "2")]
197 pub notes: ::prost::alloc::vec::Vec<super::note::NetworkNote>,
198}
199#[derive(Clone, PartialEq, ::prost::Message)]
201pub struct NetworkAccountIdList {
202 #[prost(message, optional, tag = "1")]
204 pub pagination_info: ::core::option::Option<super::rpc::PaginationInfo>,
205 #[prost(message, repeated, tag = "2")]
207 pub account_ids: ::prost::alloc::vec::Vec<super::account::AccountId>,
208}
209#[derive(Clone, PartialEq, ::prost::Message)]
211pub struct CurrentBlockchainData {
212 #[prost(message, repeated, tag = "1")]
214 pub current_peaks: ::prost::alloc::vec::Vec<super::primitives::Digest>,
215 #[prost(message, optional, tag = "2")]
217 pub current_block_header: ::core::option::Option<super::blockchain::BlockHeader>,
218}
219#[derive(Clone, PartialEq, ::prost::Message)]
221pub struct VaultAssetWitnessesRequest {
222 #[prost(message, optional, tag = "1")]
224 pub account_id: ::core::option::Option<super::account::AccountId>,
225 #[prost(message, repeated, tag = "2")]
227 pub vault_keys: ::prost::alloc::vec::Vec<super::primitives::Digest>,
228 #[prost(fixed32, optional, tag = "3")]
235 pub block_num: ::core::option::Option<u32>,
236}
237#[derive(Clone, PartialEq, ::prost::Message)]
239pub struct VaultAssetWitnessesResponse {
240 #[prost(fixed32, tag = "1")]
244 pub block_num: u32,
245 #[prost(message, repeated, tag = "2")]
247 pub asset_witnesses: ::prost::alloc::vec::Vec<
248 vault_asset_witnesses_response::VaultAssetWitness,
249 >,
250}
251pub mod vault_asset_witnesses_response {
253 #[derive(Clone, PartialEq, ::prost::Message)]
255 pub struct VaultAssetWitness {
256 #[prost(message, optional, tag = "1")]
258 pub proof: ::core::option::Option<super::super::primitives::SmtOpening>,
259 }
260}
261#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
263pub struct StorageMapWitnessRequest {
264 #[prost(message, optional, tag = "1")]
266 pub account_id: ::core::option::Option<super::account::AccountId>,
267 #[prost(message, optional, tag = "2")]
269 pub map_key: ::core::option::Option<super::primitives::Digest>,
270 #[prost(fixed32, optional, tag = "3")]
277 pub block_num: ::core::option::Option<u32>,
278 #[prost(string, tag = "4")]
280 pub slot_name: ::prost::alloc::string::String,
281}
282#[derive(Clone, PartialEq, ::prost::Message)]
284pub struct StorageMapWitnessResponse {
285 #[prost(message, optional, tag = "1")]
287 pub witness: ::core::option::Option<storage_map_witness_response::StorageWitness>,
288 #[prost(fixed32, tag = "2")]
290 pub block_num: u32,
291}
292pub mod storage_map_witness_response {
294 #[derive(Clone, PartialEq, ::prost::Message)]
296 pub struct StorageWitness {
297 #[prost(message, optional, tag = "1")]
299 pub key: ::core::option::Option<super::super::primitives::Digest>,
300 #[prost(message, optional, tag = "3")]
302 pub proof: ::core::option::Option<super::super::primitives::SmtOpening>,
303 }
304}
305pub mod rpc_client {
307 #![allow(
308 unused_variables,
309 dead_code,
310 missing_docs,
311 clippy::wildcard_imports,
312 clippy::let_unit_value,
313 )]
314 use tonic::codegen::*;
315 use tonic::codegen::http::Uri;
316 #[derive(Debug, Clone)]
318 pub struct RpcClient<T> {
319 inner: tonic::client::Grpc<T>,
320 }
321 impl RpcClient<tonic::transport::Channel> {
322 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
324 where
325 D: TryInto<tonic::transport::Endpoint>,
326 D::Error: Into<StdError>,
327 {
328 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
329 Ok(Self::new(conn))
330 }
331 }
332 impl<T> RpcClient<T>
333 where
334 T: tonic::client::GrpcService<tonic::body::Body>,
335 T::Error: Into<StdError>,
336 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
337 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
338 {
339 pub fn new(inner: T) -> Self {
340 let inner = tonic::client::Grpc::new(inner);
341 Self { inner }
342 }
343 pub fn with_origin(inner: T, origin: Uri) -> Self {
344 let inner = tonic::client::Grpc::with_origin(inner, origin);
345 Self { inner }
346 }
347 pub fn with_interceptor<F>(
348 inner: T,
349 interceptor: F,
350 ) -> RpcClient<InterceptedService<T, F>>
351 where
352 F: tonic::service::Interceptor,
353 T::ResponseBody: Default,
354 T: tonic::codegen::Service<
355 http::Request<tonic::body::Body>,
356 Response = http::Response<
357 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
358 >,
359 >,
360 <T as tonic::codegen::Service<
361 http::Request<tonic::body::Body>,
362 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
363 {
364 RpcClient::new(InterceptedService::new(inner, interceptor))
365 }
366 #[must_use]
371 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
372 self.inner = self.inner.send_compressed(encoding);
373 self
374 }
375 #[must_use]
377 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
378 self.inner = self.inner.accept_compressed(encoding);
379 self
380 }
381 #[must_use]
385 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
386 self.inner = self.inner.max_decoding_message_size(limit);
387 self
388 }
389 #[must_use]
393 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
394 self.inner = self.inner.max_encoding_message_size(limit);
395 self
396 }
397 pub async fn status(
399 &mut self,
400 request: impl tonic::IntoRequest<()>,
401 ) -> std::result::Result<
402 tonic::Response<super::super::rpc::StoreStatus>,
403 tonic::Status,
404 > {
405 self.inner
406 .ready()
407 .await
408 .map_err(|e| {
409 tonic::Status::unknown(
410 format!("Service was not ready: {}", e.into()),
411 )
412 })?;
413 let codec = tonic_prost::ProstCodec::default();
414 let path = http::uri::PathAndQuery::from_static("/store.Rpc/Status");
415 let mut req = request.into_request();
416 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "Status"));
417 self.inner.unary(req, path, codec).await
418 }
419 pub async fn check_nullifiers(
433 &mut self,
434 request: impl tonic::IntoRequest<super::super::rpc::NullifierList>,
435 ) -> std::result::Result<
436 tonic::Response<super::super::rpc::CheckNullifiersResponse>,
437 tonic::Status,
438 > {
439 self.inner
440 .ready()
441 .await
442 .map_err(|e| {
443 tonic::Status::unknown(
444 format!("Service was not ready: {}", e.into()),
445 )
446 })?;
447 let codec = tonic_prost::ProstCodec::default();
448 let path = http::uri::PathAndQuery::from_static(
449 "/store.Rpc/CheckNullifiers",
450 );
451 let mut req = request.into_request();
452 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "CheckNullifiers"));
453 self.inner.unary(req, path, codec).await
454 }
455 pub async fn get_account(
457 &mut self,
458 request: impl tonic::IntoRequest<super::super::rpc::AccountRequest>,
459 ) -> std::result::Result<
460 tonic::Response<super::super::rpc::AccountResponse>,
461 tonic::Status,
462 > {
463 self.inner
464 .ready()
465 .await
466 .map_err(|e| {
467 tonic::Status::unknown(
468 format!("Service was not ready: {}", e.into()),
469 )
470 })?;
471 let codec = tonic_prost::ProstCodec::default();
472 let path = http::uri::PathAndQuery::from_static("/store.Rpc/GetAccount");
473 let mut req = request.into_request();
474 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "GetAccount"));
475 self.inner.unary(req, path, codec).await
476 }
477 pub async fn get_block_by_number(
479 &mut self,
480 request: impl tonic::IntoRequest<super::super::blockchain::BlockNumber>,
481 ) -> std::result::Result<
482 tonic::Response<super::super::blockchain::MaybeBlock>,
483 tonic::Status,
484 > {
485 self.inner
486 .ready()
487 .await
488 .map_err(|e| {
489 tonic::Status::unknown(
490 format!("Service was not ready: {}", e.into()),
491 )
492 })?;
493 let codec = tonic_prost::ProstCodec::default();
494 let path = http::uri::PathAndQuery::from_static(
495 "/store.Rpc/GetBlockByNumber",
496 );
497 let mut req = request.into_request();
498 req.extensions_mut()
499 .insert(GrpcMethod::new("store.Rpc", "GetBlockByNumber"));
500 self.inner.unary(req, path, codec).await
501 }
502 pub async fn get_block_header_by_number(
505 &mut self,
506 request: impl tonic::IntoRequest<
507 super::super::rpc::BlockHeaderByNumberRequest,
508 >,
509 ) -> std::result::Result<
510 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
511 tonic::Status,
512 > {
513 self.inner
514 .ready()
515 .await
516 .map_err(|e| {
517 tonic::Status::unknown(
518 format!("Service was not ready: {}", e.into()),
519 )
520 })?;
521 let codec = tonic_prost::ProstCodec::default();
522 let path = http::uri::PathAndQuery::from_static(
523 "/store.Rpc/GetBlockHeaderByNumber",
524 );
525 let mut req = request.into_request();
526 req.extensions_mut()
527 .insert(GrpcMethod::new("store.Rpc", "GetBlockHeaderByNumber"));
528 self.inner.unary(req, path, codec).await
529 }
530 pub async fn get_notes_by_id(
532 &mut self,
533 request: impl tonic::IntoRequest<super::super::note::NoteIdList>,
534 ) -> std::result::Result<
535 tonic::Response<super::super::note::CommittedNoteList>,
536 tonic::Status,
537 > {
538 self.inner
539 .ready()
540 .await
541 .map_err(|e| {
542 tonic::Status::unknown(
543 format!("Service was not ready: {}", e.into()),
544 )
545 })?;
546 let codec = tonic_prost::ProstCodec::default();
547 let path = http::uri::PathAndQuery::from_static("/store.Rpc/GetNotesById");
548 let mut req = request.into_request();
549 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "GetNotesById"));
550 self.inner.unary(req, path, codec).await
551 }
552 pub async fn get_note_script_by_root(
554 &mut self,
555 request: impl tonic::IntoRequest<super::super::note::NoteRoot>,
556 ) -> std::result::Result<
557 tonic::Response<super::super::rpc::MaybeNoteScript>,
558 tonic::Status,
559 > {
560 self.inner
561 .ready()
562 .await
563 .map_err(|e| {
564 tonic::Status::unknown(
565 format!("Service was not ready: {}", e.into()),
566 )
567 })?;
568 let codec = tonic_prost::ProstCodec::default();
569 let path = http::uri::PathAndQuery::from_static(
570 "/store.Rpc/GetNoteScriptByRoot",
571 );
572 let mut req = request.into_request();
573 req.extensions_mut()
574 .insert(GrpcMethod::new("store.Rpc", "GetNoteScriptByRoot"));
575 self.inner.unary(req, path, codec).await
576 }
577 pub async fn sync_nullifiers(
581 &mut self,
582 request: impl tonic::IntoRequest<super::super::rpc::SyncNullifiersRequest>,
583 ) -> std::result::Result<
584 tonic::Response<super::super::rpc::SyncNullifiersResponse>,
585 tonic::Status,
586 > {
587 self.inner
588 .ready()
589 .await
590 .map_err(|e| {
591 tonic::Status::unknown(
592 format!("Service was not ready: {}", e.into()),
593 )
594 })?;
595 let codec = tonic_prost::ProstCodec::default();
596 let path = http::uri::PathAndQuery::from_static("/store.Rpc/SyncNullifiers");
597 let mut req = request.into_request();
598 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "SyncNullifiers"));
599 self.inner.unary(req, path, codec).await
600 }
601 pub async fn sync_notes(
611 &mut self,
612 request: impl tonic::IntoRequest<super::super::rpc::SyncNotesRequest>,
613 ) -> std::result::Result<
614 tonic::Response<super::super::rpc::SyncNotesResponse>,
615 tonic::Status,
616 > {
617 self.inner
618 .ready()
619 .await
620 .map_err(|e| {
621 tonic::Status::unknown(
622 format!("Service was not ready: {}", e.into()),
623 )
624 })?;
625 let codec = tonic_prost::ProstCodec::default();
626 let path = http::uri::PathAndQuery::from_static("/store.Rpc/SyncNotes");
627 let mut req = request.into_request();
628 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "SyncNotes"));
629 self.inner.unary(req, path, codec).await
630 }
631 pub async fn sync_state(
647 &mut self,
648 request: impl tonic::IntoRequest<super::super::rpc::SyncStateRequest>,
649 ) -> std::result::Result<
650 tonic::Response<super::super::rpc::SyncStateResponse>,
651 tonic::Status,
652 > {
653 self.inner
654 .ready()
655 .await
656 .map_err(|e| {
657 tonic::Status::unknown(
658 format!("Service was not ready: {}", e.into()),
659 )
660 })?;
661 let codec = tonic_prost::ProstCodec::default();
662 let path = http::uri::PathAndQuery::from_static("/store.Rpc/SyncState");
663 let mut req = request.into_request();
664 req.extensions_mut().insert(GrpcMethod::new("store.Rpc", "SyncState"));
665 self.inner.unary(req, path, codec).await
666 }
667 pub async fn sync_account_vault(
669 &mut self,
670 request: impl tonic::IntoRequest<super::super::rpc::SyncAccountVaultRequest>,
671 ) -> std::result::Result<
672 tonic::Response<super::super::rpc::SyncAccountVaultResponse>,
673 tonic::Status,
674 > {
675 self.inner
676 .ready()
677 .await
678 .map_err(|e| {
679 tonic::Status::unknown(
680 format!("Service was not ready: {}", e.into()),
681 )
682 })?;
683 let codec = tonic_prost::ProstCodec::default();
684 let path = http::uri::PathAndQuery::from_static(
685 "/store.Rpc/SyncAccountVault",
686 );
687 let mut req = request.into_request();
688 req.extensions_mut()
689 .insert(GrpcMethod::new("store.Rpc", "SyncAccountVault"));
690 self.inner.unary(req, path, codec).await
691 }
692 pub async fn sync_account_storage_maps(
694 &mut self,
695 request: impl tonic::IntoRequest<
696 super::super::rpc::SyncAccountStorageMapsRequest,
697 >,
698 ) -> std::result::Result<
699 tonic::Response<super::super::rpc::SyncAccountStorageMapsResponse>,
700 tonic::Status,
701 > {
702 self.inner
703 .ready()
704 .await
705 .map_err(|e| {
706 tonic::Status::unknown(
707 format!("Service was not ready: {}", e.into()),
708 )
709 })?;
710 let codec = tonic_prost::ProstCodec::default();
711 let path = http::uri::PathAndQuery::from_static(
712 "/store.Rpc/SyncAccountStorageMaps",
713 );
714 let mut req = request.into_request();
715 req.extensions_mut()
716 .insert(GrpcMethod::new("store.Rpc", "SyncAccountStorageMaps"));
717 self.inner.unary(req, path, codec).await
718 }
719 pub async fn sync_transactions(
721 &mut self,
722 request: impl tonic::IntoRequest<super::super::rpc::SyncTransactionsRequest>,
723 ) -> std::result::Result<
724 tonic::Response<super::super::rpc::SyncTransactionsResponse>,
725 tonic::Status,
726 > {
727 self.inner
728 .ready()
729 .await
730 .map_err(|e| {
731 tonic::Status::unknown(
732 format!("Service was not ready: {}", e.into()),
733 )
734 })?;
735 let codec = tonic_prost::ProstCodec::default();
736 let path = http::uri::PathAndQuery::from_static(
737 "/store.Rpc/SyncTransactions",
738 );
739 let mut req = request.into_request();
740 req.extensions_mut()
741 .insert(GrpcMethod::new("store.Rpc", "SyncTransactions"));
742 self.inner.unary(req, path, codec).await
743 }
744 }
745}
746pub mod rpc_server {
748 #![allow(
749 unused_variables,
750 dead_code,
751 missing_docs,
752 clippy::wildcard_imports,
753 clippy::let_unit_value,
754 )]
755 use tonic::codegen::*;
756 #[async_trait]
758 pub trait Rpc: std::marker::Send + std::marker::Sync + 'static {
759 async fn status(
761 &self,
762 request: tonic::Request<()>,
763 ) -> std::result::Result<
764 tonic::Response<super::super::rpc::StoreStatus>,
765 tonic::Status,
766 >;
767 async fn check_nullifiers(
781 &self,
782 request: tonic::Request<super::super::rpc::NullifierList>,
783 ) -> std::result::Result<
784 tonic::Response<super::super::rpc::CheckNullifiersResponse>,
785 tonic::Status,
786 >;
787 async fn get_account(
789 &self,
790 request: tonic::Request<super::super::rpc::AccountRequest>,
791 ) -> std::result::Result<
792 tonic::Response<super::super::rpc::AccountResponse>,
793 tonic::Status,
794 >;
795 async fn get_block_by_number(
797 &self,
798 request: tonic::Request<super::super::blockchain::BlockNumber>,
799 ) -> std::result::Result<
800 tonic::Response<super::super::blockchain::MaybeBlock>,
801 tonic::Status,
802 >;
803 async fn get_block_header_by_number(
806 &self,
807 request: tonic::Request<super::super::rpc::BlockHeaderByNumberRequest>,
808 ) -> std::result::Result<
809 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
810 tonic::Status,
811 >;
812 async fn get_notes_by_id(
814 &self,
815 request: tonic::Request<super::super::note::NoteIdList>,
816 ) -> std::result::Result<
817 tonic::Response<super::super::note::CommittedNoteList>,
818 tonic::Status,
819 >;
820 async fn get_note_script_by_root(
822 &self,
823 request: tonic::Request<super::super::note::NoteRoot>,
824 ) -> std::result::Result<
825 tonic::Response<super::super::rpc::MaybeNoteScript>,
826 tonic::Status,
827 >;
828 async fn sync_nullifiers(
832 &self,
833 request: tonic::Request<super::super::rpc::SyncNullifiersRequest>,
834 ) -> std::result::Result<
835 tonic::Response<super::super::rpc::SyncNullifiersResponse>,
836 tonic::Status,
837 >;
838 async fn sync_notes(
848 &self,
849 request: tonic::Request<super::super::rpc::SyncNotesRequest>,
850 ) -> std::result::Result<
851 tonic::Response<super::super::rpc::SyncNotesResponse>,
852 tonic::Status,
853 >;
854 async fn sync_state(
870 &self,
871 request: tonic::Request<super::super::rpc::SyncStateRequest>,
872 ) -> std::result::Result<
873 tonic::Response<super::super::rpc::SyncStateResponse>,
874 tonic::Status,
875 >;
876 async fn sync_account_vault(
878 &self,
879 request: tonic::Request<super::super::rpc::SyncAccountVaultRequest>,
880 ) -> std::result::Result<
881 tonic::Response<super::super::rpc::SyncAccountVaultResponse>,
882 tonic::Status,
883 >;
884 async fn sync_account_storage_maps(
886 &self,
887 request: tonic::Request<super::super::rpc::SyncAccountStorageMapsRequest>,
888 ) -> std::result::Result<
889 tonic::Response<super::super::rpc::SyncAccountStorageMapsResponse>,
890 tonic::Status,
891 >;
892 async fn sync_transactions(
894 &self,
895 request: tonic::Request<super::super::rpc::SyncTransactionsRequest>,
896 ) -> std::result::Result<
897 tonic::Response<super::super::rpc::SyncTransactionsResponse>,
898 tonic::Status,
899 >;
900 }
901 #[derive(Debug)]
903 pub struct RpcServer<T> {
904 inner: Arc<T>,
905 accept_compression_encodings: EnabledCompressionEncodings,
906 send_compression_encodings: EnabledCompressionEncodings,
907 max_decoding_message_size: Option<usize>,
908 max_encoding_message_size: Option<usize>,
909 }
910 impl<T> RpcServer<T> {
911 pub fn new(inner: T) -> Self {
912 Self::from_arc(Arc::new(inner))
913 }
914 pub fn from_arc(inner: Arc<T>) -> Self {
915 Self {
916 inner,
917 accept_compression_encodings: Default::default(),
918 send_compression_encodings: Default::default(),
919 max_decoding_message_size: None,
920 max_encoding_message_size: None,
921 }
922 }
923 pub fn with_interceptor<F>(
924 inner: T,
925 interceptor: F,
926 ) -> InterceptedService<Self, F>
927 where
928 F: tonic::service::Interceptor,
929 {
930 InterceptedService::new(Self::new(inner), interceptor)
931 }
932 #[must_use]
934 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
935 self.accept_compression_encodings.enable(encoding);
936 self
937 }
938 #[must_use]
940 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
941 self.send_compression_encodings.enable(encoding);
942 self
943 }
944 #[must_use]
948 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
949 self.max_decoding_message_size = Some(limit);
950 self
951 }
952 #[must_use]
956 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
957 self.max_encoding_message_size = Some(limit);
958 self
959 }
960 }
961 impl<T, B> tonic::codegen::Service<http::Request<B>> for RpcServer<T>
962 where
963 T: Rpc,
964 B: Body + std::marker::Send + 'static,
965 B::Error: Into<StdError> + std::marker::Send + 'static,
966 {
967 type Response = http::Response<tonic::body::Body>;
968 type Error = std::convert::Infallible;
969 type Future = BoxFuture<Self::Response, Self::Error>;
970 fn poll_ready(
971 &mut self,
972 _cx: &mut Context<'_>,
973 ) -> Poll<std::result::Result<(), Self::Error>> {
974 Poll::Ready(Ok(()))
975 }
976 fn call(&mut self, req: http::Request<B>) -> Self::Future {
977 match req.uri().path() {
978 "/store.Rpc/Status" => {
979 #[allow(non_camel_case_types)]
980 struct StatusSvc<T: Rpc>(pub Arc<T>);
981 impl<T: Rpc> tonic::server::UnaryService<()> for StatusSvc<T> {
982 type Response = super::super::rpc::StoreStatus;
983 type Future = BoxFuture<
984 tonic::Response<Self::Response>,
985 tonic::Status,
986 >;
987 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
988 let inner = Arc::clone(&self.0);
989 let fut = async move {
990 <T as Rpc>::status(&inner, request).await
991 };
992 Box::pin(fut)
993 }
994 }
995 let accept_compression_encodings = self.accept_compression_encodings;
996 let send_compression_encodings = self.send_compression_encodings;
997 let max_decoding_message_size = self.max_decoding_message_size;
998 let max_encoding_message_size = self.max_encoding_message_size;
999 let inner = self.inner.clone();
1000 let fut = async move {
1001 let method = StatusSvc(inner);
1002 let codec = tonic_prost::ProstCodec::default();
1003 let mut grpc = tonic::server::Grpc::new(codec)
1004 .apply_compression_config(
1005 accept_compression_encodings,
1006 send_compression_encodings,
1007 )
1008 .apply_max_message_size_config(
1009 max_decoding_message_size,
1010 max_encoding_message_size,
1011 );
1012 let res = grpc.unary(method, req).await;
1013 Ok(res)
1014 };
1015 Box::pin(fut)
1016 }
1017 "/store.Rpc/CheckNullifiers" => {
1018 #[allow(non_camel_case_types)]
1019 struct CheckNullifiersSvc<T: Rpc>(pub Arc<T>);
1020 impl<
1021 T: Rpc,
1022 > tonic::server::UnaryService<super::super::rpc::NullifierList>
1023 for CheckNullifiersSvc<T> {
1024 type Response = super::super::rpc::CheckNullifiersResponse;
1025 type Future = BoxFuture<
1026 tonic::Response<Self::Response>,
1027 tonic::Status,
1028 >;
1029 fn call(
1030 &mut self,
1031 request: tonic::Request<super::super::rpc::NullifierList>,
1032 ) -> Self::Future {
1033 let inner = Arc::clone(&self.0);
1034 let fut = async move {
1035 <T as Rpc>::check_nullifiers(&inner, request).await
1036 };
1037 Box::pin(fut)
1038 }
1039 }
1040 let accept_compression_encodings = self.accept_compression_encodings;
1041 let send_compression_encodings = self.send_compression_encodings;
1042 let max_decoding_message_size = self.max_decoding_message_size;
1043 let max_encoding_message_size = self.max_encoding_message_size;
1044 let inner = self.inner.clone();
1045 let fut = async move {
1046 let method = CheckNullifiersSvc(inner);
1047 let codec = tonic_prost::ProstCodec::default();
1048 let mut grpc = tonic::server::Grpc::new(codec)
1049 .apply_compression_config(
1050 accept_compression_encodings,
1051 send_compression_encodings,
1052 )
1053 .apply_max_message_size_config(
1054 max_decoding_message_size,
1055 max_encoding_message_size,
1056 );
1057 let res = grpc.unary(method, req).await;
1058 Ok(res)
1059 };
1060 Box::pin(fut)
1061 }
1062 "/store.Rpc/GetAccount" => {
1063 #[allow(non_camel_case_types)]
1064 struct GetAccountSvc<T: Rpc>(pub Arc<T>);
1065 impl<
1066 T: Rpc,
1067 > tonic::server::UnaryService<super::super::rpc::AccountRequest>
1068 for GetAccountSvc<T> {
1069 type Response = super::super::rpc::AccountResponse;
1070 type Future = BoxFuture<
1071 tonic::Response<Self::Response>,
1072 tonic::Status,
1073 >;
1074 fn call(
1075 &mut self,
1076 request: tonic::Request<super::super::rpc::AccountRequest>,
1077 ) -> Self::Future {
1078 let inner = Arc::clone(&self.0);
1079 let fut = async move {
1080 <T as Rpc>::get_account(&inner, request).await
1081 };
1082 Box::pin(fut)
1083 }
1084 }
1085 let accept_compression_encodings = self.accept_compression_encodings;
1086 let send_compression_encodings = self.send_compression_encodings;
1087 let max_decoding_message_size = self.max_decoding_message_size;
1088 let max_encoding_message_size = self.max_encoding_message_size;
1089 let inner = self.inner.clone();
1090 let fut = async move {
1091 let method = GetAccountSvc(inner);
1092 let codec = tonic_prost::ProstCodec::default();
1093 let mut grpc = tonic::server::Grpc::new(codec)
1094 .apply_compression_config(
1095 accept_compression_encodings,
1096 send_compression_encodings,
1097 )
1098 .apply_max_message_size_config(
1099 max_decoding_message_size,
1100 max_encoding_message_size,
1101 );
1102 let res = grpc.unary(method, req).await;
1103 Ok(res)
1104 };
1105 Box::pin(fut)
1106 }
1107 "/store.Rpc/GetBlockByNumber" => {
1108 #[allow(non_camel_case_types)]
1109 struct GetBlockByNumberSvc<T: Rpc>(pub Arc<T>);
1110 impl<
1111 T: Rpc,
1112 > tonic::server::UnaryService<super::super::blockchain::BlockNumber>
1113 for GetBlockByNumberSvc<T> {
1114 type Response = super::super::blockchain::MaybeBlock;
1115 type Future = BoxFuture<
1116 tonic::Response<Self::Response>,
1117 tonic::Status,
1118 >;
1119 fn call(
1120 &mut self,
1121 request: tonic::Request<
1122 super::super::blockchain::BlockNumber,
1123 >,
1124 ) -> Self::Future {
1125 let inner = Arc::clone(&self.0);
1126 let fut = async move {
1127 <T as Rpc>::get_block_by_number(&inner, request).await
1128 };
1129 Box::pin(fut)
1130 }
1131 }
1132 let accept_compression_encodings = self.accept_compression_encodings;
1133 let send_compression_encodings = self.send_compression_encodings;
1134 let max_decoding_message_size = self.max_decoding_message_size;
1135 let max_encoding_message_size = self.max_encoding_message_size;
1136 let inner = self.inner.clone();
1137 let fut = async move {
1138 let method = GetBlockByNumberSvc(inner);
1139 let codec = tonic_prost::ProstCodec::default();
1140 let mut grpc = tonic::server::Grpc::new(codec)
1141 .apply_compression_config(
1142 accept_compression_encodings,
1143 send_compression_encodings,
1144 )
1145 .apply_max_message_size_config(
1146 max_decoding_message_size,
1147 max_encoding_message_size,
1148 );
1149 let res = grpc.unary(method, req).await;
1150 Ok(res)
1151 };
1152 Box::pin(fut)
1153 }
1154 "/store.Rpc/GetBlockHeaderByNumber" => {
1155 #[allow(non_camel_case_types)]
1156 struct GetBlockHeaderByNumberSvc<T: Rpc>(pub Arc<T>);
1157 impl<
1158 T: Rpc,
1159 > tonic::server::UnaryService<
1160 super::super::rpc::BlockHeaderByNumberRequest,
1161 > for GetBlockHeaderByNumberSvc<T> {
1162 type Response = super::super::rpc::BlockHeaderByNumberResponse;
1163 type Future = BoxFuture<
1164 tonic::Response<Self::Response>,
1165 tonic::Status,
1166 >;
1167 fn call(
1168 &mut self,
1169 request: tonic::Request<
1170 super::super::rpc::BlockHeaderByNumberRequest,
1171 >,
1172 ) -> Self::Future {
1173 let inner = Arc::clone(&self.0);
1174 let fut = async move {
1175 <T as Rpc>::get_block_header_by_number(&inner, request)
1176 .await
1177 };
1178 Box::pin(fut)
1179 }
1180 }
1181 let accept_compression_encodings = self.accept_compression_encodings;
1182 let send_compression_encodings = self.send_compression_encodings;
1183 let max_decoding_message_size = self.max_decoding_message_size;
1184 let max_encoding_message_size = self.max_encoding_message_size;
1185 let inner = self.inner.clone();
1186 let fut = async move {
1187 let method = GetBlockHeaderByNumberSvc(inner);
1188 let codec = tonic_prost::ProstCodec::default();
1189 let mut grpc = tonic::server::Grpc::new(codec)
1190 .apply_compression_config(
1191 accept_compression_encodings,
1192 send_compression_encodings,
1193 )
1194 .apply_max_message_size_config(
1195 max_decoding_message_size,
1196 max_encoding_message_size,
1197 );
1198 let res = grpc.unary(method, req).await;
1199 Ok(res)
1200 };
1201 Box::pin(fut)
1202 }
1203 "/store.Rpc/GetNotesById" => {
1204 #[allow(non_camel_case_types)]
1205 struct GetNotesByIdSvc<T: Rpc>(pub Arc<T>);
1206 impl<
1207 T: Rpc,
1208 > tonic::server::UnaryService<super::super::note::NoteIdList>
1209 for GetNotesByIdSvc<T> {
1210 type Response = super::super::note::CommittedNoteList;
1211 type Future = BoxFuture<
1212 tonic::Response<Self::Response>,
1213 tonic::Status,
1214 >;
1215 fn call(
1216 &mut self,
1217 request: tonic::Request<super::super::note::NoteIdList>,
1218 ) -> Self::Future {
1219 let inner = Arc::clone(&self.0);
1220 let fut = async move {
1221 <T as Rpc>::get_notes_by_id(&inner, request).await
1222 };
1223 Box::pin(fut)
1224 }
1225 }
1226 let accept_compression_encodings = self.accept_compression_encodings;
1227 let send_compression_encodings = self.send_compression_encodings;
1228 let max_decoding_message_size = self.max_decoding_message_size;
1229 let max_encoding_message_size = self.max_encoding_message_size;
1230 let inner = self.inner.clone();
1231 let fut = async move {
1232 let method = GetNotesByIdSvc(inner);
1233 let codec = tonic_prost::ProstCodec::default();
1234 let mut grpc = tonic::server::Grpc::new(codec)
1235 .apply_compression_config(
1236 accept_compression_encodings,
1237 send_compression_encodings,
1238 )
1239 .apply_max_message_size_config(
1240 max_decoding_message_size,
1241 max_encoding_message_size,
1242 );
1243 let res = grpc.unary(method, req).await;
1244 Ok(res)
1245 };
1246 Box::pin(fut)
1247 }
1248 "/store.Rpc/GetNoteScriptByRoot" => {
1249 #[allow(non_camel_case_types)]
1250 struct GetNoteScriptByRootSvc<T: Rpc>(pub Arc<T>);
1251 impl<
1252 T: Rpc,
1253 > tonic::server::UnaryService<super::super::note::NoteRoot>
1254 for GetNoteScriptByRootSvc<T> {
1255 type Response = super::super::rpc::MaybeNoteScript;
1256 type Future = BoxFuture<
1257 tonic::Response<Self::Response>,
1258 tonic::Status,
1259 >;
1260 fn call(
1261 &mut self,
1262 request: tonic::Request<super::super::note::NoteRoot>,
1263 ) -> Self::Future {
1264 let inner = Arc::clone(&self.0);
1265 let fut = async move {
1266 <T as Rpc>::get_note_script_by_root(&inner, request).await
1267 };
1268 Box::pin(fut)
1269 }
1270 }
1271 let accept_compression_encodings = self.accept_compression_encodings;
1272 let send_compression_encodings = self.send_compression_encodings;
1273 let max_decoding_message_size = self.max_decoding_message_size;
1274 let max_encoding_message_size = self.max_encoding_message_size;
1275 let inner = self.inner.clone();
1276 let fut = async move {
1277 let method = GetNoteScriptByRootSvc(inner);
1278 let codec = tonic_prost::ProstCodec::default();
1279 let mut grpc = tonic::server::Grpc::new(codec)
1280 .apply_compression_config(
1281 accept_compression_encodings,
1282 send_compression_encodings,
1283 )
1284 .apply_max_message_size_config(
1285 max_decoding_message_size,
1286 max_encoding_message_size,
1287 );
1288 let res = grpc.unary(method, req).await;
1289 Ok(res)
1290 };
1291 Box::pin(fut)
1292 }
1293 "/store.Rpc/SyncNullifiers" => {
1294 #[allow(non_camel_case_types)]
1295 struct SyncNullifiersSvc<T: Rpc>(pub Arc<T>);
1296 impl<
1297 T: Rpc,
1298 > tonic::server::UnaryService<
1299 super::super::rpc::SyncNullifiersRequest,
1300 > for SyncNullifiersSvc<T> {
1301 type Response = super::super::rpc::SyncNullifiersResponse;
1302 type Future = BoxFuture<
1303 tonic::Response<Self::Response>,
1304 tonic::Status,
1305 >;
1306 fn call(
1307 &mut self,
1308 request: tonic::Request<
1309 super::super::rpc::SyncNullifiersRequest,
1310 >,
1311 ) -> Self::Future {
1312 let inner = Arc::clone(&self.0);
1313 let fut = async move {
1314 <T as Rpc>::sync_nullifiers(&inner, request).await
1315 };
1316 Box::pin(fut)
1317 }
1318 }
1319 let accept_compression_encodings = self.accept_compression_encodings;
1320 let send_compression_encodings = self.send_compression_encodings;
1321 let max_decoding_message_size = self.max_decoding_message_size;
1322 let max_encoding_message_size = self.max_encoding_message_size;
1323 let inner = self.inner.clone();
1324 let fut = async move {
1325 let method = SyncNullifiersSvc(inner);
1326 let codec = tonic_prost::ProstCodec::default();
1327 let mut grpc = tonic::server::Grpc::new(codec)
1328 .apply_compression_config(
1329 accept_compression_encodings,
1330 send_compression_encodings,
1331 )
1332 .apply_max_message_size_config(
1333 max_decoding_message_size,
1334 max_encoding_message_size,
1335 );
1336 let res = grpc.unary(method, req).await;
1337 Ok(res)
1338 };
1339 Box::pin(fut)
1340 }
1341 "/store.Rpc/SyncNotes" => {
1342 #[allow(non_camel_case_types)]
1343 struct SyncNotesSvc<T: Rpc>(pub Arc<T>);
1344 impl<
1345 T: Rpc,
1346 > tonic::server::UnaryService<super::super::rpc::SyncNotesRequest>
1347 for SyncNotesSvc<T> {
1348 type Response = super::super::rpc::SyncNotesResponse;
1349 type Future = BoxFuture<
1350 tonic::Response<Self::Response>,
1351 tonic::Status,
1352 >;
1353 fn call(
1354 &mut self,
1355 request: tonic::Request<super::super::rpc::SyncNotesRequest>,
1356 ) -> Self::Future {
1357 let inner = Arc::clone(&self.0);
1358 let fut = async move {
1359 <T as Rpc>::sync_notes(&inner, request).await
1360 };
1361 Box::pin(fut)
1362 }
1363 }
1364 let accept_compression_encodings = self.accept_compression_encodings;
1365 let send_compression_encodings = self.send_compression_encodings;
1366 let max_decoding_message_size = self.max_decoding_message_size;
1367 let max_encoding_message_size = self.max_encoding_message_size;
1368 let inner = self.inner.clone();
1369 let fut = async move {
1370 let method = SyncNotesSvc(inner);
1371 let codec = tonic_prost::ProstCodec::default();
1372 let mut grpc = tonic::server::Grpc::new(codec)
1373 .apply_compression_config(
1374 accept_compression_encodings,
1375 send_compression_encodings,
1376 )
1377 .apply_max_message_size_config(
1378 max_decoding_message_size,
1379 max_encoding_message_size,
1380 );
1381 let res = grpc.unary(method, req).await;
1382 Ok(res)
1383 };
1384 Box::pin(fut)
1385 }
1386 "/store.Rpc/SyncState" => {
1387 #[allow(non_camel_case_types)]
1388 struct SyncStateSvc<T: Rpc>(pub Arc<T>);
1389 impl<
1390 T: Rpc,
1391 > tonic::server::UnaryService<super::super::rpc::SyncStateRequest>
1392 for SyncStateSvc<T> {
1393 type Response = super::super::rpc::SyncStateResponse;
1394 type Future = BoxFuture<
1395 tonic::Response<Self::Response>,
1396 tonic::Status,
1397 >;
1398 fn call(
1399 &mut self,
1400 request: tonic::Request<super::super::rpc::SyncStateRequest>,
1401 ) -> Self::Future {
1402 let inner = Arc::clone(&self.0);
1403 let fut = async move {
1404 <T as Rpc>::sync_state(&inner, request).await
1405 };
1406 Box::pin(fut)
1407 }
1408 }
1409 let accept_compression_encodings = self.accept_compression_encodings;
1410 let send_compression_encodings = self.send_compression_encodings;
1411 let max_decoding_message_size = self.max_decoding_message_size;
1412 let max_encoding_message_size = self.max_encoding_message_size;
1413 let inner = self.inner.clone();
1414 let fut = async move {
1415 let method = SyncStateSvc(inner);
1416 let codec = tonic_prost::ProstCodec::default();
1417 let mut grpc = tonic::server::Grpc::new(codec)
1418 .apply_compression_config(
1419 accept_compression_encodings,
1420 send_compression_encodings,
1421 )
1422 .apply_max_message_size_config(
1423 max_decoding_message_size,
1424 max_encoding_message_size,
1425 );
1426 let res = grpc.unary(method, req).await;
1427 Ok(res)
1428 };
1429 Box::pin(fut)
1430 }
1431 "/store.Rpc/SyncAccountVault" => {
1432 #[allow(non_camel_case_types)]
1433 struct SyncAccountVaultSvc<T: Rpc>(pub Arc<T>);
1434 impl<
1435 T: Rpc,
1436 > tonic::server::UnaryService<
1437 super::super::rpc::SyncAccountVaultRequest,
1438 > for SyncAccountVaultSvc<T> {
1439 type Response = super::super::rpc::SyncAccountVaultResponse;
1440 type Future = BoxFuture<
1441 tonic::Response<Self::Response>,
1442 tonic::Status,
1443 >;
1444 fn call(
1445 &mut self,
1446 request: tonic::Request<
1447 super::super::rpc::SyncAccountVaultRequest,
1448 >,
1449 ) -> Self::Future {
1450 let inner = Arc::clone(&self.0);
1451 let fut = async move {
1452 <T as Rpc>::sync_account_vault(&inner, request).await
1453 };
1454 Box::pin(fut)
1455 }
1456 }
1457 let accept_compression_encodings = self.accept_compression_encodings;
1458 let send_compression_encodings = self.send_compression_encodings;
1459 let max_decoding_message_size = self.max_decoding_message_size;
1460 let max_encoding_message_size = self.max_encoding_message_size;
1461 let inner = self.inner.clone();
1462 let fut = async move {
1463 let method = SyncAccountVaultSvc(inner);
1464 let codec = tonic_prost::ProstCodec::default();
1465 let mut grpc = tonic::server::Grpc::new(codec)
1466 .apply_compression_config(
1467 accept_compression_encodings,
1468 send_compression_encodings,
1469 )
1470 .apply_max_message_size_config(
1471 max_decoding_message_size,
1472 max_encoding_message_size,
1473 );
1474 let res = grpc.unary(method, req).await;
1475 Ok(res)
1476 };
1477 Box::pin(fut)
1478 }
1479 "/store.Rpc/SyncAccountStorageMaps" => {
1480 #[allow(non_camel_case_types)]
1481 struct SyncAccountStorageMapsSvc<T: Rpc>(pub Arc<T>);
1482 impl<
1483 T: Rpc,
1484 > tonic::server::UnaryService<
1485 super::super::rpc::SyncAccountStorageMapsRequest,
1486 > for SyncAccountStorageMapsSvc<T> {
1487 type Response = super::super::rpc::SyncAccountStorageMapsResponse;
1488 type Future = BoxFuture<
1489 tonic::Response<Self::Response>,
1490 tonic::Status,
1491 >;
1492 fn call(
1493 &mut self,
1494 request: tonic::Request<
1495 super::super::rpc::SyncAccountStorageMapsRequest,
1496 >,
1497 ) -> Self::Future {
1498 let inner = Arc::clone(&self.0);
1499 let fut = async move {
1500 <T as Rpc>::sync_account_storage_maps(&inner, request).await
1501 };
1502 Box::pin(fut)
1503 }
1504 }
1505 let accept_compression_encodings = self.accept_compression_encodings;
1506 let send_compression_encodings = self.send_compression_encodings;
1507 let max_decoding_message_size = self.max_decoding_message_size;
1508 let max_encoding_message_size = self.max_encoding_message_size;
1509 let inner = self.inner.clone();
1510 let fut = async move {
1511 let method = SyncAccountStorageMapsSvc(inner);
1512 let codec = tonic_prost::ProstCodec::default();
1513 let mut grpc = tonic::server::Grpc::new(codec)
1514 .apply_compression_config(
1515 accept_compression_encodings,
1516 send_compression_encodings,
1517 )
1518 .apply_max_message_size_config(
1519 max_decoding_message_size,
1520 max_encoding_message_size,
1521 );
1522 let res = grpc.unary(method, req).await;
1523 Ok(res)
1524 };
1525 Box::pin(fut)
1526 }
1527 "/store.Rpc/SyncTransactions" => {
1528 #[allow(non_camel_case_types)]
1529 struct SyncTransactionsSvc<T: Rpc>(pub Arc<T>);
1530 impl<
1531 T: Rpc,
1532 > tonic::server::UnaryService<
1533 super::super::rpc::SyncTransactionsRequest,
1534 > for SyncTransactionsSvc<T> {
1535 type Response = super::super::rpc::SyncTransactionsResponse;
1536 type Future = BoxFuture<
1537 tonic::Response<Self::Response>,
1538 tonic::Status,
1539 >;
1540 fn call(
1541 &mut self,
1542 request: tonic::Request<
1543 super::super::rpc::SyncTransactionsRequest,
1544 >,
1545 ) -> Self::Future {
1546 let inner = Arc::clone(&self.0);
1547 let fut = async move {
1548 <T as Rpc>::sync_transactions(&inner, request).await
1549 };
1550 Box::pin(fut)
1551 }
1552 }
1553 let accept_compression_encodings = self.accept_compression_encodings;
1554 let send_compression_encodings = self.send_compression_encodings;
1555 let max_decoding_message_size = self.max_decoding_message_size;
1556 let max_encoding_message_size = self.max_encoding_message_size;
1557 let inner = self.inner.clone();
1558 let fut = async move {
1559 let method = SyncTransactionsSvc(inner);
1560 let codec = tonic_prost::ProstCodec::default();
1561 let mut grpc = tonic::server::Grpc::new(codec)
1562 .apply_compression_config(
1563 accept_compression_encodings,
1564 send_compression_encodings,
1565 )
1566 .apply_max_message_size_config(
1567 max_decoding_message_size,
1568 max_encoding_message_size,
1569 );
1570 let res = grpc.unary(method, req).await;
1571 Ok(res)
1572 };
1573 Box::pin(fut)
1574 }
1575 _ => {
1576 Box::pin(async move {
1577 let mut response = http::Response::new(
1578 tonic::body::Body::default(),
1579 );
1580 let headers = response.headers_mut();
1581 headers
1582 .insert(
1583 tonic::Status::GRPC_STATUS,
1584 (tonic::Code::Unimplemented as i32).into(),
1585 );
1586 headers
1587 .insert(
1588 http::header::CONTENT_TYPE,
1589 tonic::metadata::GRPC_CONTENT_TYPE,
1590 );
1591 Ok(response)
1592 })
1593 }
1594 }
1595 }
1596 }
1597 impl<T> Clone for RpcServer<T> {
1598 fn clone(&self) -> Self {
1599 let inner = self.inner.clone();
1600 Self {
1601 inner,
1602 accept_compression_encodings: self.accept_compression_encodings,
1603 send_compression_encodings: self.send_compression_encodings,
1604 max_decoding_message_size: self.max_decoding_message_size,
1605 max_encoding_message_size: self.max_encoding_message_size,
1606 }
1607 }
1608 }
1609 pub const SERVICE_NAME: &str = "store.Rpc";
1611 impl<T> tonic::server::NamedService for RpcServer<T> {
1612 const NAME: &'static str = SERVICE_NAME;
1613 }
1614}
1615pub mod block_producer_client {
1617 #![allow(
1618 unused_variables,
1619 dead_code,
1620 missing_docs,
1621 clippy::wildcard_imports,
1622 clippy::let_unit_value,
1623 )]
1624 use tonic::codegen::*;
1625 use tonic::codegen::http::Uri;
1626 #[derive(Debug, Clone)]
1628 pub struct BlockProducerClient<T> {
1629 inner: tonic::client::Grpc<T>,
1630 }
1631 impl BlockProducerClient<tonic::transport::Channel> {
1632 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1634 where
1635 D: TryInto<tonic::transport::Endpoint>,
1636 D::Error: Into<StdError>,
1637 {
1638 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1639 Ok(Self::new(conn))
1640 }
1641 }
1642 impl<T> BlockProducerClient<T>
1643 where
1644 T: tonic::client::GrpcService<tonic::body::Body>,
1645 T::Error: Into<StdError>,
1646 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1647 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1648 {
1649 pub fn new(inner: T) -> Self {
1650 let inner = tonic::client::Grpc::new(inner);
1651 Self { inner }
1652 }
1653 pub fn with_origin(inner: T, origin: Uri) -> Self {
1654 let inner = tonic::client::Grpc::with_origin(inner, origin);
1655 Self { inner }
1656 }
1657 pub fn with_interceptor<F>(
1658 inner: T,
1659 interceptor: F,
1660 ) -> BlockProducerClient<InterceptedService<T, F>>
1661 where
1662 F: tonic::service::Interceptor,
1663 T::ResponseBody: Default,
1664 T: tonic::codegen::Service<
1665 http::Request<tonic::body::Body>,
1666 Response = http::Response<
1667 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1668 >,
1669 >,
1670 <T as tonic::codegen::Service<
1671 http::Request<tonic::body::Body>,
1672 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1673 {
1674 BlockProducerClient::new(InterceptedService::new(inner, interceptor))
1675 }
1676 #[must_use]
1681 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1682 self.inner = self.inner.send_compressed(encoding);
1683 self
1684 }
1685 #[must_use]
1687 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1688 self.inner = self.inner.accept_compressed(encoding);
1689 self
1690 }
1691 #[must_use]
1695 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1696 self.inner = self.inner.max_decoding_message_size(limit);
1697 self
1698 }
1699 #[must_use]
1703 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1704 self.inner = self.inner.max_encoding_message_size(limit);
1705 self
1706 }
1707 pub async fn apply_block(
1709 &mut self,
1710 request: impl tonic::IntoRequest<super::super::blockchain::Block>,
1711 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
1712 self.inner
1713 .ready()
1714 .await
1715 .map_err(|e| {
1716 tonic::Status::unknown(
1717 format!("Service was not ready: {}", e.into()),
1718 )
1719 })?;
1720 let codec = tonic_prost::ProstCodec::default();
1721 let path = http::uri::PathAndQuery::from_static(
1722 "/store.BlockProducer/ApplyBlock",
1723 );
1724 let mut req = request.into_request();
1725 req.extensions_mut()
1726 .insert(GrpcMethod::new("store.BlockProducer", "ApplyBlock"));
1727 self.inner.unary(req, path, codec).await
1728 }
1729 pub async fn get_block_header_by_number(
1732 &mut self,
1733 request: impl tonic::IntoRequest<
1734 super::super::rpc::BlockHeaderByNumberRequest,
1735 >,
1736 ) -> std::result::Result<
1737 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
1738 tonic::Status,
1739 > {
1740 self.inner
1741 .ready()
1742 .await
1743 .map_err(|e| {
1744 tonic::Status::unknown(
1745 format!("Service was not ready: {}", e.into()),
1746 )
1747 })?;
1748 let codec = tonic_prost::ProstCodec::default();
1749 let path = http::uri::PathAndQuery::from_static(
1750 "/store.BlockProducer/GetBlockHeaderByNumber",
1751 );
1752 let mut req = request.into_request();
1753 req.extensions_mut()
1754 .insert(
1755 GrpcMethod::new("store.BlockProducer", "GetBlockHeaderByNumber"),
1756 );
1757 self.inner.unary(req, path, codec).await
1758 }
1759 pub async fn get_block_inputs(
1761 &mut self,
1762 request: impl tonic::IntoRequest<super::BlockInputsRequest>,
1763 ) -> std::result::Result<tonic::Response<super::BlockInputs>, tonic::Status> {
1764 self.inner
1765 .ready()
1766 .await
1767 .map_err(|e| {
1768 tonic::Status::unknown(
1769 format!("Service was not ready: {}", e.into()),
1770 )
1771 })?;
1772 let codec = tonic_prost::ProstCodec::default();
1773 let path = http::uri::PathAndQuery::from_static(
1774 "/store.BlockProducer/GetBlockInputs",
1775 );
1776 let mut req = request.into_request();
1777 req.extensions_mut()
1778 .insert(GrpcMethod::new("store.BlockProducer", "GetBlockInputs"));
1779 self.inner.unary(req, path, codec).await
1780 }
1781 pub async fn get_batch_inputs(
1783 &mut self,
1784 request: impl tonic::IntoRequest<super::BatchInputsRequest>,
1785 ) -> std::result::Result<tonic::Response<super::BatchInputs>, tonic::Status> {
1786 self.inner
1787 .ready()
1788 .await
1789 .map_err(|e| {
1790 tonic::Status::unknown(
1791 format!("Service was not ready: {}", e.into()),
1792 )
1793 })?;
1794 let codec = tonic_prost::ProstCodec::default();
1795 let path = http::uri::PathAndQuery::from_static(
1796 "/store.BlockProducer/GetBatchInputs",
1797 );
1798 let mut req = request.into_request();
1799 req.extensions_mut()
1800 .insert(GrpcMethod::new("store.BlockProducer", "GetBatchInputs"));
1801 self.inner.unary(req, path, codec).await
1802 }
1803 pub async fn get_transaction_inputs(
1805 &mut self,
1806 request: impl tonic::IntoRequest<super::TransactionInputsRequest>,
1807 ) -> std::result::Result<
1808 tonic::Response<super::TransactionInputs>,
1809 tonic::Status,
1810 > {
1811 self.inner
1812 .ready()
1813 .await
1814 .map_err(|e| {
1815 tonic::Status::unknown(
1816 format!("Service was not ready: {}", e.into()),
1817 )
1818 })?;
1819 let codec = tonic_prost::ProstCodec::default();
1820 let path = http::uri::PathAndQuery::from_static(
1821 "/store.BlockProducer/GetTransactionInputs",
1822 );
1823 let mut req = request.into_request();
1824 req.extensions_mut()
1825 .insert(GrpcMethod::new("store.BlockProducer", "GetTransactionInputs"));
1826 self.inner.unary(req, path, codec).await
1827 }
1828 }
1829}
1830pub mod block_producer_server {
1832 #![allow(
1833 unused_variables,
1834 dead_code,
1835 missing_docs,
1836 clippy::wildcard_imports,
1837 clippy::let_unit_value,
1838 )]
1839 use tonic::codegen::*;
1840 #[async_trait]
1842 pub trait BlockProducer: std::marker::Send + std::marker::Sync + 'static {
1843 async fn apply_block(
1845 &self,
1846 request: tonic::Request<super::super::blockchain::Block>,
1847 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
1848 async fn get_block_header_by_number(
1851 &self,
1852 request: tonic::Request<super::super::rpc::BlockHeaderByNumberRequest>,
1853 ) -> std::result::Result<
1854 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
1855 tonic::Status,
1856 >;
1857 async fn get_block_inputs(
1859 &self,
1860 request: tonic::Request<super::BlockInputsRequest>,
1861 ) -> std::result::Result<tonic::Response<super::BlockInputs>, tonic::Status>;
1862 async fn get_batch_inputs(
1864 &self,
1865 request: tonic::Request<super::BatchInputsRequest>,
1866 ) -> std::result::Result<tonic::Response<super::BatchInputs>, tonic::Status>;
1867 async fn get_transaction_inputs(
1869 &self,
1870 request: tonic::Request<super::TransactionInputsRequest>,
1871 ) -> std::result::Result<
1872 tonic::Response<super::TransactionInputs>,
1873 tonic::Status,
1874 >;
1875 }
1876 #[derive(Debug)]
1878 pub struct BlockProducerServer<T> {
1879 inner: Arc<T>,
1880 accept_compression_encodings: EnabledCompressionEncodings,
1881 send_compression_encodings: EnabledCompressionEncodings,
1882 max_decoding_message_size: Option<usize>,
1883 max_encoding_message_size: Option<usize>,
1884 }
1885 impl<T> BlockProducerServer<T> {
1886 pub fn new(inner: T) -> Self {
1887 Self::from_arc(Arc::new(inner))
1888 }
1889 pub fn from_arc(inner: Arc<T>) -> Self {
1890 Self {
1891 inner,
1892 accept_compression_encodings: Default::default(),
1893 send_compression_encodings: Default::default(),
1894 max_decoding_message_size: None,
1895 max_encoding_message_size: None,
1896 }
1897 }
1898 pub fn with_interceptor<F>(
1899 inner: T,
1900 interceptor: F,
1901 ) -> InterceptedService<Self, F>
1902 where
1903 F: tonic::service::Interceptor,
1904 {
1905 InterceptedService::new(Self::new(inner), interceptor)
1906 }
1907 #[must_use]
1909 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1910 self.accept_compression_encodings.enable(encoding);
1911 self
1912 }
1913 #[must_use]
1915 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1916 self.send_compression_encodings.enable(encoding);
1917 self
1918 }
1919 #[must_use]
1923 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1924 self.max_decoding_message_size = Some(limit);
1925 self
1926 }
1927 #[must_use]
1931 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1932 self.max_encoding_message_size = Some(limit);
1933 self
1934 }
1935 }
1936 impl<T, B> tonic::codegen::Service<http::Request<B>> for BlockProducerServer<T>
1937 where
1938 T: BlockProducer,
1939 B: Body + std::marker::Send + 'static,
1940 B::Error: Into<StdError> + std::marker::Send + 'static,
1941 {
1942 type Response = http::Response<tonic::body::Body>;
1943 type Error = std::convert::Infallible;
1944 type Future = BoxFuture<Self::Response, Self::Error>;
1945 fn poll_ready(
1946 &mut self,
1947 _cx: &mut Context<'_>,
1948 ) -> Poll<std::result::Result<(), Self::Error>> {
1949 Poll::Ready(Ok(()))
1950 }
1951 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1952 match req.uri().path() {
1953 "/store.BlockProducer/ApplyBlock" => {
1954 #[allow(non_camel_case_types)]
1955 struct ApplyBlockSvc<T: BlockProducer>(pub Arc<T>);
1956 impl<
1957 T: BlockProducer,
1958 > tonic::server::UnaryService<super::super::blockchain::Block>
1959 for ApplyBlockSvc<T> {
1960 type Response = ();
1961 type Future = BoxFuture<
1962 tonic::Response<Self::Response>,
1963 tonic::Status,
1964 >;
1965 fn call(
1966 &mut self,
1967 request: tonic::Request<super::super::blockchain::Block>,
1968 ) -> Self::Future {
1969 let inner = Arc::clone(&self.0);
1970 let fut = async move {
1971 <T as BlockProducer>::apply_block(&inner, request).await
1972 };
1973 Box::pin(fut)
1974 }
1975 }
1976 let accept_compression_encodings = self.accept_compression_encodings;
1977 let send_compression_encodings = self.send_compression_encodings;
1978 let max_decoding_message_size = self.max_decoding_message_size;
1979 let max_encoding_message_size = self.max_encoding_message_size;
1980 let inner = self.inner.clone();
1981 let fut = async move {
1982 let method = ApplyBlockSvc(inner);
1983 let codec = tonic_prost::ProstCodec::default();
1984 let mut grpc = tonic::server::Grpc::new(codec)
1985 .apply_compression_config(
1986 accept_compression_encodings,
1987 send_compression_encodings,
1988 )
1989 .apply_max_message_size_config(
1990 max_decoding_message_size,
1991 max_encoding_message_size,
1992 );
1993 let res = grpc.unary(method, req).await;
1994 Ok(res)
1995 };
1996 Box::pin(fut)
1997 }
1998 "/store.BlockProducer/GetBlockHeaderByNumber" => {
1999 #[allow(non_camel_case_types)]
2000 struct GetBlockHeaderByNumberSvc<T: BlockProducer>(pub Arc<T>);
2001 impl<
2002 T: BlockProducer,
2003 > tonic::server::UnaryService<
2004 super::super::rpc::BlockHeaderByNumberRequest,
2005 > for GetBlockHeaderByNumberSvc<T> {
2006 type Response = super::super::rpc::BlockHeaderByNumberResponse;
2007 type Future = BoxFuture<
2008 tonic::Response<Self::Response>,
2009 tonic::Status,
2010 >;
2011 fn call(
2012 &mut self,
2013 request: tonic::Request<
2014 super::super::rpc::BlockHeaderByNumberRequest,
2015 >,
2016 ) -> Self::Future {
2017 let inner = Arc::clone(&self.0);
2018 let fut = async move {
2019 <T as BlockProducer>::get_block_header_by_number(
2020 &inner,
2021 request,
2022 )
2023 .await
2024 };
2025 Box::pin(fut)
2026 }
2027 }
2028 let accept_compression_encodings = self.accept_compression_encodings;
2029 let send_compression_encodings = self.send_compression_encodings;
2030 let max_decoding_message_size = self.max_decoding_message_size;
2031 let max_encoding_message_size = self.max_encoding_message_size;
2032 let inner = self.inner.clone();
2033 let fut = async move {
2034 let method = GetBlockHeaderByNumberSvc(inner);
2035 let codec = tonic_prost::ProstCodec::default();
2036 let mut grpc = tonic::server::Grpc::new(codec)
2037 .apply_compression_config(
2038 accept_compression_encodings,
2039 send_compression_encodings,
2040 )
2041 .apply_max_message_size_config(
2042 max_decoding_message_size,
2043 max_encoding_message_size,
2044 );
2045 let res = grpc.unary(method, req).await;
2046 Ok(res)
2047 };
2048 Box::pin(fut)
2049 }
2050 "/store.BlockProducer/GetBlockInputs" => {
2051 #[allow(non_camel_case_types)]
2052 struct GetBlockInputsSvc<T: BlockProducer>(pub Arc<T>);
2053 impl<
2054 T: BlockProducer,
2055 > tonic::server::UnaryService<super::BlockInputsRequest>
2056 for GetBlockInputsSvc<T> {
2057 type Response = super::BlockInputs;
2058 type Future = BoxFuture<
2059 tonic::Response<Self::Response>,
2060 tonic::Status,
2061 >;
2062 fn call(
2063 &mut self,
2064 request: tonic::Request<super::BlockInputsRequest>,
2065 ) -> Self::Future {
2066 let inner = Arc::clone(&self.0);
2067 let fut = async move {
2068 <T as BlockProducer>::get_block_inputs(&inner, request)
2069 .await
2070 };
2071 Box::pin(fut)
2072 }
2073 }
2074 let accept_compression_encodings = self.accept_compression_encodings;
2075 let send_compression_encodings = self.send_compression_encodings;
2076 let max_decoding_message_size = self.max_decoding_message_size;
2077 let max_encoding_message_size = self.max_encoding_message_size;
2078 let inner = self.inner.clone();
2079 let fut = async move {
2080 let method = GetBlockInputsSvc(inner);
2081 let codec = tonic_prost::ProstCodec::default();
2082 let mut grpc = tonic::server::Grpc::new(codec)
2083 .apply_compression_config(
2084 accept_compression_encodings,
2085 send_compression_encodings,
2086 )
2087 .apply_max_message_size_config(
2088 max_decoding_message_size,
2089 max_encoding_message_size,
2090 );
2091 let res = grpc.unary(method, req).await;
2092 Ok(res)
2093 };
2094 Box::pin(fut)
2095 }
2096 "/store.BlockProducer/GetBatchInputs" => {
2097 #[allow(non_camel_case_types)]
2098 struct GetBatchInputsSvc<T: BlockProducer>(pub Arc<T>);
2099 impl<
2100 T: BlockProducer,
2101 > tonic::server::UnaryService<super::BatchInputsRequest>
2102 for GetBatchInputsSvc<T> {
2103 type Response = super::BatchInputs;
2104 type Future = BoxFuture<
2105 tonic::Response<Self::Response>,
2106 tonic::Status,
2107 >;
2108 fn call(
2109 &mut self,
2110 request: tonic::Request<super::BatchInputsRequest>,
2111 ) -> Self::Future {
2112 let inner = Arc::clone(&self.0);
2113 let fut = async move {
2114 <T as BlockProducer>::get_batch_inputs(&inner, request)
2115 .await
2116 };
2117 Box::pin(fut)
2118 }
2119 }
2120 let accept_compression_encodings = self.accept_compression_encodings;
2121 let send_compression_encodings = self.send_compression_encodings;
2122 let max_decoding_message_size = self.max_decoding_message_size;
2123 let max_encoding_message_size = self.max_encoding_message_size;
2124 let inner = self.inner.clone();
2125 let fut = async move {
2126 let method = GetBatchInputsSvc(inner);
2127 let codec = tonic_prost::ProstCodec::default();
2128 let mut grpc = tonic::server::Grpc::new(codec)
2129 .apply_compression_config(
2130 accept_compression_encodings,
2131 send_compression_encodings,
2132 )
2133 .apply_max_message_size_config(
2134 max_decoding_message_size,
2135 max_encoding_message_size,
2136 );
2137 let res = grpc.unary(method, req).await;
2138 Ok(res)
2139 };
2140 Box::pin(fut)
2141 }
2142 "/store.BlockProducer/GetTransactionInputs" => {
2143 #[allow(non_camel_case_types)]
2144 struct GetTransactionInputsSvc<T: BlockProducer>(pub Arc<T>);
2145 impl<
2146 T: BlockProducer,
2147 > tonic::server::UnaryService<super::TransactionInputsRequest>
2148 for GetTransactionInputsSvc<T> {
2149 type Response = super::TransactionInputs;
2150 type Future = BoxFuture<
2151 tonic::Response<Self::Response>,
2152 tonic::Status,
2153 >;
2154 fn call(
2155 &mut self,
2156 request: tonic::Request<super::TransactionInputsRequest>,
2157 ) -> Self::Future {
2158 let inner = Arc::clone(&self.0);
2159 let fut = async move {
2160 <T as BlockProducer>::get_transaction_inputs(
2161 &inner,
2162 request,
2163 )
2164 .await
2165 };
2166 Box::pin(fut)
2167 }
2168 }
2169 let accept_compression_encodings = self.accept_compression_encodings;
2170 let send_compression_encodings = self.send_compression_encodings;
2171 let max_decoding_message_size = self.max_decoding_message_size;
2172 let max_encoding_message_size = self.max_encoding_message_size;
2173 let inner = self.inner.clone();
2174 let fut = async move {
2175 let method = GetTransactionInputsSvc(inner);
2176 let codec = tonic_prost::ProstCodec::default();
2177 let mut grpc = tonic::server::Grpc::new(codec)
2178 .apply_compression_config(
2179 accept_compression_encodings,
2180 send_compression_encodings,
2181 )
2182 .apply_max_message_size_config(
2183 max_decoding_message_size,
2184 max_encoding_message_size,
2185 );
2186 let res = grpc.unary(method, req).await;
2187 Ok(res)
2188 };
2189 Box::pin(fut)
2190 }
2191 _ => {
2192 Box::pin(async move {
2193 let mut response = http::Response::new(
2194 tonic::body::Body::default(),
2195 );
2196 let headers = response.headers_mut();
2197 headers
2198 .insert(
2199 tonic::Status::GRPC_STATUS,
2200 (tonic::Code::Unimplemented as i32).into(),
2201 );
2202 headers
2203 .insert(
2204 http::header::CONTENT_TYPE,
2205 tonic::metadata::GRPC_CONTENT_TYPE,
2206 );
2207 Ok(response)
2208 })
2209 }
2210 }
2211 }
2212 }
2213 impl<T> Clone for BlockProducerServer<T> {
2214 fn clone(&self) -> Self {
2215 let inner = self.inner.clone();
2216 Self {
2217 inner,
2218 accept_compression_encodings: self.accept_compression_encodings,
2219 send_compression_encodings: self.send_compression_encodings,
2220 max_decoding_message_size: self.max_decoding_message_size,
2221 max_encoding_message_size: self.max_encoding_message_size,
2222 }
2223 }
2224 }
2225 pub const SERVICE_NAME: &str = "store.BlockProducer";
2227 impl<T> tonic::server::NamedService for BlockProducerServer<T> {
2228 const NAME: &'static str = SERVICE_NAME;
2229 }
2230}
2231pub mod ntx_builder_client {
2233 #![allow(
2234 unused_variables,
2235 dead_code,
2236 missing_docs,
2237 clippy::wildcard_imports,
2238 clippy::let_unit_value,
2239 )]
2240 use tonic::codegen::*;
2241 use tonic::codegen::http::Uri;
2242 #[derive(Debug, Clone)]
2244 pub struct NtxBuilderClient<T> {
2245 inner: tonic::client::Grpc<T>,
2246 }
2247 impl NtxBuilderClient<tonic::transport::Channel> {
2248 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2250 where
2251 D: TryInto<tonic::transport::Endpoint>,
2252 D::Error: Into<StdError>,
2253 {
2254 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2255 Ok(Self::new(conn))
2256 }
2257 }
2258 impl<T> NtxBuilderClient<T>
2259 where
2260 T: tonic::client::GrpcService<tonic::body::Body>,
2261 T::Error: Into<StdError>,
2262 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2263 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2264 {
2265 pub fn new(inner: T) -> Self {
2266 let inner = tonic::client::Grpc::new(inner);
2267 Self { inner }
2268 }
2269 pub fn with_origin(inner: T, origin: Uri) -> Self {
2270 let inner = tonic::client::Grpc::with_origin(inner, origin);
2271 Self { inner }
2272 }
2273 pub fn with_interceptor<F>(
2274 inner: T,
2275 interceptor: F,
2276 ) -> NtxBuilderClient<InterceptedService<T, F>>
2277 where
2278 F: tonic::service::Interceptor,
2279 T::ResponseBody: Default,
2280 T: tonic::codegen::Service<
2281 http::Request<tonic::body::Body>,
2282 Response = http::Response<
2283 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2284 >,
2285 >,
2286 <T as tonic::codegen::Service<
2287 http::Request<tonic::body::Body>,
2288 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2289 {
2290 NtxBuilderClient::new(InterceptedService::new(inner, interceptor))
2291 }
2292 #[must_use]
2297 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2298 self.inner = self.inner.send_compressed(encoding);
2299 self
2300 }
2301 #[must_use]
2303 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2304 self.inner = self.inner.accept_compressed(encoding);
2305 self
2306 }
2307 #[must_use]
2311 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2312 self.inner = self.inner.max_decoding_message_size(limit);
2313 self
2314 }
2315 #[must_use]
2319 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2320 self.inner = self.inner.max_encoding_message_size(limit);
2321 self
2322 }
2323 pub async fn get_block_header_by_number(
2326 &mut self,
2327 request: impl tonic::IntoRequest<
2328 super::super::rpc::BlockHeaderByNumberRequest,
2329 >,
2330 ) -> std::result::Result<
2331 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
2332 tonic::Status,
2333 > {
2334 self.inner
2335 .ready()
2336 .await
2337 .map_err(|e| {
2338 tonic::Status::unknown(
2339 format!("Service was not ready: {}", e.into()),
2340 )
2341 })?;
2342 let codec = tonic_prost::ProstCodec::default();
2343 let path = http::uri::PathAndQuery::from_static(
2344 "/store.NtxBuilder/GetBlockHeaderByNumber",
2345 );
2346 let mut req = request.into_request();
2347 req.extensions_mut()
2348 .insert(GrpcMethod::new("store.NtxBuilder", "GetBlockHeaderByNumber"));
2349 self.inner.unary(req, path, codec).await
2350 }
2351 pub async fn get_unconsumed_network_notes(
2353 &mut self,
2354 request: impl tonic::IntoRequest<super::UnconsumedNetworkNotesRequest>,
2355 ) -> std::result::Result<
2356 tonic::Response<super::UnconsumedNetworkNotes>,
2357 tonic::Status,
2358 > {
2359 self.inner
2360 .ready()
2361 .await
2362 .map_err(|e| {
2363 tonic::Status::unknown(
2364 format!("Service was not ready: {}", e.into()),
2365 )
2366 })?;
2367 let codec = tonic_prost::ProstCodec::default();
2368 let path = http::uri::PathAndQuery::from_static(
2369 "/store.NtxBuilder/GetUnconsumedNetworkNotes",
2370 );
2371 let mut req = request.into_request();
2372 req.extensions_mut()
2373 .insert(
2374 GrpcMethod::new("store.NtxBuilder", "GetUnconsumedNetworkNotes"),
2375 );
2376 self.inner.unary(req, path, codec).await
2377 }
2378 pub async fn get_current_blockchain_data(
2382 &mut self,
2383 request: impl tonic::IntoRequest<super::super::blockchain::MaybeBlockNumber>,
2384 ) -> std::result::Result<
2385 tonic::Response<super::CurrentBlockchainData>,
2386 tonic::Status,
2387 > {
2388 self.inner
2389 .ready()
2390 .await
2391 .map_err(|e| {
2392 tonic::Status::unknown(
2393 format!("Service was not ready: {}", e.into()),
2394 )
2395 })?;
2396 let codec = tonic_prost::ProstCodec::default();
2397 let path = http::uri::PathAndQuery::from_static(
2398 "/store.NtxBuilder/GetCurrentBlockchainData",
2399 );
2400 let mut req = request.into_request();
2401 req.extensions_mut()
2402 .insert(GrpcMethod::new("store.NtxBuilder", "GetCurrentBlockchainData"));
2403 self.inner.unary(req, path, codec).await
2404 }
2405 pub async fn get_network_account_details_by_id(
2407 &mut self,
2408 request: impl tonic::IntoRequest<super::super::account::AccountId>,
2409 ) -> std::result::Result<
2410 tonic::Response<super::MaybeAccountDetails>,
2411 tonic::Status,
2412 > {
2413 self.inner
2414 .ready()
2415 .await
2416 .map_err(|e| {
2417 tonic::Status::unknown(
2418 format!("Service was not ready: {}", e.into()),
2419 )
2420 })?;
2421 let codec = tonic_prost::ProstCodec::default();
2422 let path = http::uri::PathAndQuery::from_static(
2423 "/store.NtxBuilder/GetNetworkAccountDetailsById",
2424 );
2425 let mut req = request.into_request();
2426 req.extensions_mut()
2427 .insert(
2428 GrpcMethod::new("store.NtxBuilder", "GetNetworkAccountDetailsById"),
2429 );
2430 self.inner.unary(req, path, codec).await
2431 }
2432 pub async fn get_network_account_ids(
2434 &mut self,
2435 request: impl tonic::IntoRequest<super::super::rpc::BlockRange>,
2436 ) -> std::result::Result<
2437 tonic::Response<super::NetworkAccountIdList>,
2438 tonic::Status,
2439 > {
2440 self.inner
2441 .ready()
2442 .await
2443 .map_err(|e| {
2444 tonic::Status::unknown(
2445 format!("Service was not ready: {}", e.into()),
2446 )
2447 })?;
2448 let codec = tonic_prost::ProstCodec::default();
2449 let path = http::uri::PathAndQuery::from_static(
2450 "/store.NtxBuilder/GetNetworkAccountIds",
2451 );
2452 let mut req = request.into_request();
2453 req.extensions_mut()
2454 .insert(GrpcMethod::new("store.NtxBuilder", "GetNetworkAccountIds"));
2455 self.inner.unary(req, path, codec).await
2456 }
2457 pub async fn get_account(
2459 &mut self,
2460 request: impl tonic::IntoRequest<super::super::rpc::AccountRequest>,
2461 ) -> std::result::Result<
2462 tonic::Response<super::super::rpc::AccountResponse>,
2463 tonic::Status,
2464 > {
2465 self.inner
2466 .ready()
2467 .await
2468 .map_err(|e| {
2469 tonic::Status::unknown(
2470 format!("Service was not ready: {}", e.into()),
2471 )
2472 })?;
2473 let codec = tonic_prost::ProstCodec::default();
2474 let path = http::uri::PathAndQuery::from_static(
2475 "/store.NtxBuilder/GetAccount",
2476 );
2477 let mut req = request.into_request();
2478 req.extensions_mut()
2479 .insert(GrpcMethod::new("store.NtxBuilder", "GetAccount"));
2480 self.inner.unary(req, path, codec).await
2481 }
2482 pub async fn get_note_script_by_root(
2484 &mut self,
2485 request: impl tonic::IntoRequest<super::super::note::NoteRoot>,
2486 ) -> std::result::Result<
2487 tonic::Response<super::super::rpc::MaybeNoteScript>,
2488 tonic::Status,
2489 > {
2490 self.inner
2491 .ready()
2492 .await
2493 .map_err(|e| {
2494 tonic::Status::unknown(
2495 format!("Service was not ready: {}", e.into()),
2496 )
2497 })?;
2498 let codec = tonic_prost::ProstCodec::default();
2499 let path = http::uri::PathAndQuery::from_static(
2500 "/store.NtxBuilder/GetNoteScriptByRoot",
2501 );
2502 let mut req = request.into_request();
2503 req.extensions_mut()
2504 .insert(GrpcMethod::new("store.NtxBuilder", "GetNoteScriptByRoot"));
2505 self.inner.unary(req, path, codec).await
2506 }
2507 pub async fn get_vault_asset_witnesses(
2509 &mut self,
2510 request: impl tonic::IntoRequest<super::VaultAssetWitnessesRequest>,
2511 ) -> std::result::Result<
2512 tonic::Response<super::VaultAssetWitnessesResponse>,
2513 tonic::Status,
2514 > {
2515 self.inner
2516 .ready()
2517 .await
2518 .map_err(|e| {
2519 tonic::Status::unknown(
2520 format!("Service was not ready: {}", e.into()),
2521 )
2522 })?;
2523 let codec = tonic_prost::ProstCodec::default();
2524 let path = http::uri::PathAndQuery::from_static(
2525 "/store.NtxBuilder/GetVaultAssetWitnesses",
2526 );
2527 let mut req = request.into_request();
2528 req.extensions_mut()
2529 .insert(GrpcMethod::new("store.NtxBuilder", "GetVaultAssetWitnesses"));
2530 self.inner.unary(req, path, codec).await
2531 }
2532 pub async fn get_storage_map_witness(
2534 &mut self,
2535 request: impl tonic::IntoRequest<super::StorageMapWitnessRequest>,
2536 ) -> std::result::Result<
2537 tonic::Response<super::StorageMapWitnessResponse>,
2538 tonic::Status,
2539 > {
2540 self.inner
2541 .ready()
2542 .await
2543 .map_err(|e| {
2544 tonic::Status::unknown(
2545 format!("Service was not ready: {}", e.into()),
2546 )
2547 })?;
2548 let codec = tonic_prost::ProstCodec::default();
2549 let path = http::uri::PathAndQuery::from_static(
2550 "/store.NtxBuilder/GetStorageMapWitness",
2551 );
2552 let mut req = request.into_request();
2553 req.extensions_mut()
2554 .insert(GrpcMethod::new("store.NtxBuilder", "GetStorageMapWitness"));
2555 self.inner.unary(req, path, codec).await
2556 }
2557 }
2558}
2559pub mod ntx_builder_server {
2561 #![allow(
2562 unused_variables,
2563 dead_code,
2564 missing_docs,
2565 clippy::wildcard_imports,
2566 clippy::let_unit_value,
2567 )]
2568 use tonic::codegen::*;
2569 #[async_trait]
2571 pub trait NtxBuilder: std::marker::Send + std::marker::Sync + 'static {
2572 async fn get_block_header_by_number(
2575 &self,
2576 request: tonic::Request<super::super::rpc::BlockHeaderByNumberRequest>,
2577 ) -> std::result::Result<
2578 tonic::Response<super::super::rpc::BlockHeaderByNumberResponse>,
2579 tonic::Status,
2580 >;
2581 async fn get_unconsumed_network_notes(
2583 &self,
2584 request: tonic::Request<super::UnconsumedNetworkNotesRequest>,
2585 ) -> std::result::Result<
2586 tonic::Response<super::UnconsumedNetworkNotes>,
2587 tonic::Status,
2588 >;
2589 async fn get_current_blockchain_data(
2593 &self,
2594 request: tonic::Request<super::super::blockchain::MaybeBlockNumber>,
2595 ) -> std::result::Result<
2596 tonic::Response<super::CurrentBlockchainData>,
2597 tonic::Status,
2598 >;
2599 async fn get_network_account_details_by_id(
2601 &self,
2602 request: tonic::Request<super::super::account::AccountId>,
2603 ) -> std::result::Result<
2604 tonic::Response<super::MaybeAccountDetails>,
2605 tonic::Status,
2606 >;
2607 async fn get_network_account_ids(
2609 &self,
2610 request: tonic::Request<super::super::rpc::BlockRange>,
2611 ) -> std::result::Result<
2612 tonic::Response<super::NetworkAccountIdList>,
2613 tonic::Status,
2614 >;
2615 async fn get_account(
2617 &self,
2618 request: tonic::Request<super::super::rpc::AccountRequest>,
2619 ) -> std::result::Result<
2620 tonic::Response<super::super::rpc::AccountResponse>,
2621 tonic::Status,
2622 >;
2623 async fn get_note_script_by_root(
2625 &self,
2626 request: tonic::Request<super::super::note::NoteRoot>,
2627 ) -> std::result::Result<
2628 tonic::Response<super::super::rpc::MaybeNoteScript>,
2629 tonic::Status,
2630 >;
2631 async fn get_vault_asset_witnesses(
2633 &self,
2634 request: tonic::Request<super::VaultAssetWitnessesRequest>,
2635 ) -> std::result::Result<
2636 tonic::Response<super::VaultAssetWitnessesResponse>,
2637 tonic::Status,
2638 >;
2639 async fn get_storage_map_witness(
2641 &self,
2642 request: tonic::Request<super::StorageMapWitnessRequest>,
2643 ) -> std::result::Result<
2644 tonic::Response<super::StorageMapWitnessResponse>,
2645 tonic::Status,
2646 >;
2647 }
2648 #[derive(Debug)]
2650 pub struct NtxBuilderServer<T> {
2651 inner: Arc<T>,
2652 accept_compression_encodings: EnabledCompressionEncodings,
2653 send_compression_encodings: EnabledCompressionEncodings,
2654 max_decoding_message_size: Option<usize>,
2655 max_encoding_message_size: Option<usize>,
2656 }
2657 impl<T> NtxBuilderServer<T> {
2658 pub fn new(inner: T) -> Self {
2659 Self::from_arc(Arc::new(inner))
2660 }
2661 pub fn from_arc(inner: Arc<T>) -> Self {
2662 Self {
2663 inner,
2664 accept_compression_encodings: Default::default(),
2665 send_compression_encodings: Default::default(),
2666 max_decoding_message_size: None,
2667 max_encoding_message_size: None,
2668 }
2669 }
2670 pub fn with_interceptor<F>(
2671 inner: T,
2672 interceptor: F,
2673 ) -> InterceptedService<Self, F>
2674 where
2675 F: tonic::service::Interceptor,
2676 {
2677 InterceptedService::new(Self::new(inner), interceptor)
2678 }
2679 #[must_use]
2681 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2682 self.accept_compression_encodings.enable(encoding);
2683 self
2684 }
2685 #[must_use]
2687 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2688 self.send_compression_encodings.enable(encoding);
2689 self
2690 }
2691 #[must_use]
2695 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2696 self.max_decoding_message_size = Some(limit);
2697 self
2698 }
2699 #[must_use]
2703 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2704 self.max_encoding_message_size = Some(limit);
2705 self
2706 }
2707 }
2708 impl<T, B> tonic::codegen::Service<http::Request<B>> for NtxBuilderServer<T>
2709 where
2710 T: NtxBuilder,
2711 B: Body + std::marker::Send + 'static,
2712 B::Error: Into<StdError> + std::marker::Send + 'static,
2713 {
2714 type Response = http::Response<tonic::body::Body>;
2715 type Error = std::convert::Infallible;
2716 type Future = BoxFuture<Self::Response, Self::Error>;
2717 fn poll_ready(
2718 &mut self,
2719 _cx: &mut Context<'_>,
2720 ) -> Poll<std::result::Result<(), Self::Error>> {
2721 Poll::Ready(Ok(()))
2722 }
2723 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2724 match req.uri().path() {
2725 "/store.NtxBuilder/GetBlockHeaderByNumber" => {
2726 #[allow(non_camel_case_types)]
2727 struct GetBlockHeaderByNumberSvc<T: NtxBuilder>(pub Arc<T>);
2728 impl<
2729 T: NtxBuilder,
2730 > tonic::server::UnaryService<
2731 super::super::rpc::BlockHeaderByNumberRequest,
2732 > for GetBlockHeaderByNumberSvc<T> {
2733 type Response = super::super::rpc::BlockHeaderByNumberResponse;
2734 type Future = BoxFuture<
2735 tonic::Response<Self::Response>,
2736 tonic::Status,
2737 >;
2738 fn call(
2739 &mut self,
2740 request: tonic::Request<
2741 super::super::rpc::BlockHeaderByNumberRequest,
2742 >,
2743 ) -> Self::Future {
2744 let inner = Arc::clone(&self.0);
2745 let fut = async move {
2746 <T as NtxBuilder>::get_block_header_by_number(
2747 &inner,
2748 request,
2749 )
2750 .await
2751 };
2752 Box::pin(fut)
2753 }
2754 }
2755 let accept_compression_encodings = self.accept_compression_encodings;
2756 let send_compression_encodings = self.send_compression_encodings;
2757 let max_decoding_message_size = self.max_decoding_message_size;
2758 let max_encoding_message_size = self.max_encoding_message_size;
2759 let inner = self.inner.clone();
2760 let fut = async move {
2761 let method = GetBlockHeaderByNumberSvc(inner);
2762 let codec = tonic_prost::ProstCodec::default();
2763 let mut grpc = tonic::server::Grpc::new(codec)
2764 .apply_compression_config(
2765 accept_compression_encodings,
2766 send_compression_encodings,
2767 )
2768 .apply_max_message_size_config(
2769 max_decoding_message_size,
2770 max_encoding_message_size,
2771 );
2772 let res = grpc.unary(method, req).await;
2773 Ok(res)
2774 };
2775 Box::pin(fut)
2776 }
2777 "/store.NtxBuilder/GetUnconsumedNetworkNotes" => {
2778 #[allow(non_camel_case_types)]
2779 struct GetUnconsumedNetworkNotesSvc<T: NtxBuilder>(pub Arc<T>);
2780 impl<
2781 T: NtxBuilder,
2782 > tonic::server::UnaryService<super::UnconsumedNetworkNotesRequest>
2783 for GetUnconsumedNetworkNotesSvc<T> {
2784 type Response = super::UnconsumedNetworkNotes;
2785 type Future = BoxFuture<
2786 tonic::Response<Self::Response>,
2787 tonic::Status,
2788 >;
2789 fn call(
2790 &mut self,
2791 request: tonic::Request<super::UnconsumedNetworkNotesRequest>,
2792 ) -> Self::Future {
2793 let inner = Arc::clone(&self.0);
2794 let fut = async move {
2795 <T as NtxBuilder>::get_unconsumed_network_notes(
2796 &inner,
2797 request,
2798 )
2799 .await
2800 };
2801 Box::pin(fut)
2802 }
2803 }
2804 let accept_compression_encodings = self.accept_compression_encodings;
2805 let send_compression_encodings = self.send_compression_encodings;
2806 let max_decoding_message_size = self.max_decoding_message_size;
2807 let max_encoding_message_size = self.max_encoding_message_size;
2808 let inner = self.inner.clone();
2809 let fut = async move {
2810 let method = GetUnconsumedNetworkNotesSvc(inner);
2811 let codec = tonic_prost::ProstCodec::default();
2812 let mut grpc = tonic::server::Grpc::new(codec)
2813 .apply_compression_config(
2814 accept_compression_encodings,
2815 send_compression_encodings,
2816 )
2817 .apply_max_message_size_config(
2818 max_decoding_message_size,
2819 max_encoding_message_size,
2820 );
2821 let res = grpc.unary(method, req).await;
2822 Ok(res)
2823 };
2824 Box::pin(fut)
2825 }
2826 "/store.NtxBuilder/GetCurrentBlockchainData" => {
2827 #[allow(non_camel_case_types)]
2828 struct GetCurrentBlockchainDataSvc<T: NtxBuilder>(pub Arc<T>);
2829 impl<
2830 T: NtxBuilder,
2831 > tonic::server::UnaryService<
2832 super::super::blockchain::MaybeBlockNumber,
2833 > for GetCurrentBlockchainDataSvc<T> {
2834 type Response = super::CurrentBlockchainData;
2835 type Future = BoxFuture<
2836 tonic::Response<Self::Response>,
2837 tonic::Status,
2838 >;
2839 fn call(
2840 &mut self,
2841 request: tonic::Request<
2842 super::super::blockchain::MaybeBlockNumber,
2843 >,
2844 ) -> Self::Future {
2845 let inner = Arc::clone(&self.0);
2846 let fut = async move {
2847 <T as NtxBuilder>::get_current_blockchain_data(
2848 &inner,
2849 request,
2850 )
2851 .await
2852 };
2853 Box::pin(fut)
2854 }
2855 }
2856 let accept_compression_encodings = self.accept_compression_encodings;
2857 let send_compression_encodings = self.send_compression_encodings;
2858 let max_decoding_message_size = self.max_decoding_message_size;
2859 let max_encoding_message_size = self.max_encoding_message_size;
2860 let inner = self.inner.clone();
2861 let fut = async move {
2862 let method = GetCurrentBlockchainDataSvc(inner);
2863 let codec = tonic_prost::ProstCodec::default();
2864 let mut grpc = tonic::server::Grpc::new(codec)
2865 .apply_compression_config(
2866 accept_compression_encodings,
2867 send_compression_encodings,
2868 )
2869 .apply_max_message_size_config(
2870 max_decoding_message_size,
2871 max_encoding_message_size,
2872 );
2873 let res = grpc.unary(method, req).await;
2874 Ok(res)
2875 };
2876 Box::pin(fut)
2877 }
2878 "/store.NtxBuilder/GetNetworkAccountDetailsById" => {
2879 #[allow(non_camel_case_types)]
2880 struct GetNetworkAccountDetailsByIdSvc<T: NtxBuilder>(pub Arc<T>);
2881 impl<
2882 T: NtxBuilder,
2883 > tonic::server::UnaryService<super::super::account::AccountId>
2884 for GetNetworkAccountDetailsByIdSvc<T> {
2885 type Response = super::MaybeAccountDetails;
2886 type Future = BoxFuture<
2887 tonic::Response<Self::Response>,
2888 tonic::Status,
2889 >;
2890 fn call(
2891 &mut self,
2892 request: tonic::Request<super::super::account::AccountId>,
2893 ) -> Self::Future {
2894 let inner = Arc::clone(&self.0);
2895 let fut = async move {
2896 <T as NtxBuilder>::get_network_account_details_by_id(
2897 &inner,
2898 request,
2899 )
2900 .await
2901 };
2902 Box::pin(fut)
2903 }
2904 }
2905 let accept_compression_encodings = self.accept_compression_encodings;
2906 let send_compression_encodings = self.send_compression_encodings;
2907 let max_decoding_message_size = self.max_decoding_message_size;
2908 let max_encoding_message_size = self.max_encoding_message_size;
2909 let inner = self.inner.clone();
2910 let fut = async move {
2911 let method = GetNetworkAccountDetailsByIdSvc(inner);
2912 let codec = tonic_prost::ProstCodec::default();
2913 let mut grpc = tonic::server::Grpc::new(codec)
2914 .apply_compression_config(
2915 accept_compression_encodings,
2916 send_compression_encodings,
2917 )
2918 .apply_max_message_size_config(
2919 max_decoding_message_size,
2920 max_encoding_message_size,
2921 );
2922 let res = grpc.unary(method, req).await;
2923 Ok(res)
2924 };
2925 Box::pin(fut)
2926 }
2927 "/store.NtxBuilder/GetNetworkAccountIds" => {
2928 #[allow(non_camel_case_types)]
2929 struct GetNetworkAccountIdsSvc<T: NtxBuilder>(pub Arc<T>);
2930 impl<
2931 T: NtxBuilder,
2932 > tonic::server::UnaryService<super::super::rpc::BlockRange>
2933 for GetNetworkAccountIdsSvc<T> {
2934 type Response = super::NetworkAccountIdList;
2935 type Future = BoxFuture<
2936 tonic::Response<Self::Response>,
2937 tonic::Status,
2938 >;
2939 fn call(
2940 &mut self,
2941 request: tonic::Request<super::super::rpc::BlockRange>,
2942 ) -> Self::Future {
2943 let inner = Arc::clone(&self.0);
2944 let fut = async move {
2945 <T as NtxBuilder>::get_network_account_ids(&inner, request)
2946 .await
2947 };
2948 Box::pin(fut)
2949 }
2950 }
2951 let accept_compression_encodings = self.accept_compression_encodings;
2952 let send_compression_encodings = self.send_compression_encodings;
2953 let max_decoding_message_size = self.max_decoding_message_size;
2954 let max_encoding_message_size = self.max_encoding_message_size;
2955 let inner = self.inner.clone();
2956 let fut = async move {
2957 let method = GetNetworkAccountIdsSvc(inner);
2958 let codec = tonic_prost::ProstCodec::default();
2959 let mut grpc = tonic::server::Grpc::new(codec)
2960 .apply_compression_config(
2961 accept_compression_encodings,
2962 send_compression_encodings,
2963 )
2964 .apply_max_message_size_config(
2965 max_decoding_message_size,
2966 max_encoding_message_size,
2967 );
2968 let res = grpc.unary(method, req).await;
2969 Ok(res)
2970 };
2971 Box::pin(fut)
2972 }
2973 "/store.NtxBuilder/GetAccount" => {
2974 #[allow(non_camel_case_types)]
2975 struct GetAccountSvc<T: NtxBuilder>(pub Arc<T>);
2976 impl<
2977 T: NtxBuilder,
2978 > tonic::server::UnaryService<super::super::rpc::AccountRequest>
2979 for GetAccountSvc<T> {
2980 type Response = super::super::rpc::AccountResponse;
2981 type Future = BoxFuture<
2982 tonic::Response<Self::Response>,
2983 tonic::Status,
2984 >;
2985 fn call(
2986 &mut self,
2987 request: tonic::Request<super::super::rpc::AccountRequest>,
2988 ) -> Self::Future {
2989 let inner = Arc::clone(&self.0);
2990 let fut = async move {
2991 <T as NtxBuilder>::get_account(&inner, request).await
2992 };
2993 Box::pin(fut)
2994 }
2995 }
2996 let accept_compression_encodings = self.accept_compression_encodings;
2997 let send_compression_encodings = self.send_compression_encodings;
2998 let max_decoding_message_size = self.max_decoding_message_size;
2999 let max_encoding_message_size = self.max_encoding_message_size;
3000 let inner = self.inner.clone();
3001 let fut = async move {
3002 let method = GetAccountSvc(inner);
3003 let codec = tonic_prost::ProstCodec::default();
3004 let mut grpc = tonic::server::Grpc::new(codec)
3005 .apply_compression_config(
3006 accept_compression_encodings,
3007 send_compression_encodings,
3008 )
3009 .apply_max_message_size_config(
3010 max_decoding_message_size,
3011 max_encoding_message_size,
3012 );
3013 let res = grpc.unary(method, req).await;
3014 Ok(res)
3015 };
3016 Box::pin(fut)
3017 }
3018 "/store.NtxBuilder/GetNoteScriptByRoot" => {
3019 #[allow(non_camel_case_types)]
3020 struct GetNoteScriptByRootSvc<T: NtxBuilder>(pub Arc<T>);
3021 impl<
3022 T: NtxBuilder,
3023 > tonic::server::UnaryService<super::super::note::NoteRoot>
3024 for GetNoteScriptByRootSvc<T> {
3025 type Response = super::super::rpc::MaybeNoteScript;
3026 type Future = BoxFuture<
3027 tonic::Response<Self::Response>,
3028 tonic::Status,
3029 >;
3030 fn call(
3031 &mut self,
3032 request: tonic::Request<super::super::note::NoteRoot>,
3033 ) -> Self::Future {
3034 let inner = Arc::clone(&self.0);
3035 let fut = async move {
3036 <T as NtxBuilder>::get_note_script_by_root(&inner, request)
3037 .await
3038 };
3039 Box::pin(fut)
3040 }
3041 }
3042 let accept_compression_encodings = self.accept_compression_encodings;
3043 let send_compression_encodings = self.send_compression_encodings;
3044 let max_decoding_message_size = self.max_decoding_message_size;
3045 let max_encoding_message_size = self.max_encoding_message_size;
3046 let inner = self.inner.clone();
3047 let fut = async move {
3048 let method = GetNoteScriptByRootSvc(inner);
3049 let codec = tonic_prost::ProstCodec::default();
3050 let mut grpc = tonic::server::Grpc::new(codec)
3051 .apply_compression_config(
3052 accept_compression_encodings,
3053 send_compression_encodings,
3054 )
3055 .apply_max_message_size_config(
3056 max_decoding_message_size,
3057 max_encoding_message_size,
3058 );
3059 let res = grpc.unary(method, req).await;
3060 Ok(res)
3061 };
3062 Box::pin(fut)
3063 }
3064 "/store.NtxBuilder/GetVaultAssetWitnesses" => {
3065 #[allow(non_camel_case_types)]
3066 struct GetVaultAssetWitnessesSvc<T: NtxBuilder>(pub Arc<T>);
3067 impl<
3068 T: NtxBuilder,
3069 > tonic::server::UnaryService<super::VaultAssetWitnessesRequest>
3070 for GetVaultAssetWitnessesSvc<T> {
3071 type Response = super::VaultAssetWitnessesResponse;
3072 type Future = BoxFuture<
3073 tonic::Response<Self::Response>,
3074 tonic::Status,
3075 >;
3076 fn call(
3077 &mut self,
3078 request: tonic::Request<super::VaultAssetWitnessesRequest>,
3079 ) -> Self::Future {
3080 let inner = Arc::clone(&self.0);
3081 let fut = async move {
3082 <T as NtxBuilder>::get_vault_asset_witnesses(
3083 &inner,
3084 request,
3085 )
3086 .await
3087 };
3088 Box::pin(fut)
3089 }
3090 }
3091 let accept_compression_encodings = self.accept_compression_encodings;
3092 let send_compression_encodings = self.send_compression_encodings;
3093 let max_decoding_message_size = self.max_decoding_message_size;
3094 let max_encoding_message_size = self.max_encoding_message_size;
3095 let inner = self.inner.clone();
3096 let fut = async move {
3097 let method = GetVaultAssetWitnessesSvc(inner);
3098 let codec = tonic_prost::ProstCodec::default();
3099 let mut grpc = tonic::server::Grpc::new(codec)
3100 .apply_compression_config(
3101 accept_compression_encodings,
3102 send_compression_encodings,
3103 )
3104 .apply_max_message_size_config(
3105 max_decoding_message_size,
3106 max_encoding_message_size,
3107 );
3108 let res = grpc.unary(method, req).await;
3109 Ok(res)
3110 };
3111 Box::pin(fut)
3112 }
3113 "/store.NtxBuilder/GetStorageMapWitness" => {
3114 #[allow(non_camel_case_types)]
3115 struct GetStorageMapWitnessSvc<T: NtxBuilder>(pub Arc<T>);
3116 impl<
3117 T: NtxBuilder,
3118 > tonic::server::UnaryService<super::StorageMapWitnessRequest>
3119 for GetStorageMapWitnessSvc<T> {
3120 type Response = super::StorageMapWitnessResponse;
3121 type Future = BoxFuture<
3122 tonic::Response<Self::Response>,
3123 tonic::Status,
3124 >;
3125 fn call(
3126 &mut self,
3127 request: tonic::Request<super::StorageMapWitnessRequest>,
3128 ) -> Self::Future {
3129 let inner = Arc::clone(&self.0);
3130 let fut = async move {
3131 <T as NtxBuilder>::get_storage_map_witness(&inner, request)
3132 .await
3133 };
3134 Box::pin(fut)
3135 }
3136 }
3137 let accept_compression_encodings = self.accept_compression_encodings;
3138 let send_compression_encodings = self.send_compression_encodings;
3139 let max_decoding_message_size = self.max_decoding_message_size;
3140 let max_encoding_message_size = self.max_encoding_message_size;
3141 let inner = self.inner.clone();
3142 let fut = async move {
3143 let method = GetStorageMapWitnessSvc(inner);
3144 let codec = tonic_prost::ProstCodec::default();
3145 let mut grpc = tonic::server::Grpc::new(codec)
3146 .apply_compression_config(
3147 accept_compression_encodings,
3148 send_compression_encodings,
3149 )
3150 .apply_max_message_size_config(
3151 max_decoding_message_size,
3152 max_encoding_message_size,
3153 );
3154 let res = grpc.unary(method, req).await;
3155 Ok(res)
3156 };
3157 Box::pin(fut)
3158 }
3159 _ => {
3160 Box::pin(async move {
3161 let mut response = http::Response::new(
3162 tonic::body::Body::default(),
3163 );
3164 let headers = response.headers_mut();
3165 headers
3166 .insert(
3167 tonic::Status::GRPC_STATUS,
3168 (tonic::Code::Unimplemented as i32).into(),
3169 );
3170 headers
3171 .insert(
3172 http::header::CONTENT_TYPE,
3173 tonic::metadata::GRPC_CONTENT_TYPE,
3174 );
3175 Ok(response)
3176 })
3177 }
3178 }
3179 }
3180 }
3181 impl<T> Clone for NtxBuilderServer<T> {
3182 fn clone(&self) -> Self {
3183 let inner = self.inner.clone();
3184 Self {
3185 inner,
3186 accept_compression_encodings: self.accept_compression_encodings,
3187 send_compression_encodings: self.send_compression_encodings,
3188 max_decoding_message_size: self.max_decoding_message_size,
3189 max_encoding_message_size: self.max_encoding_message_size,
3190 }
3191 }
3192 }
3193 pub const SERVICE_NAME: &str = "store.NtxBuilder";
3195 impl<T> tonic::server::NamedService for NtxBuilderServer<T> {
3196 const NAME: &'static str = SERVICE_NAME;
3197 }
3198}