miden_node_proto/generated/
rpc.rs

1// This file is @generated by prost-build.
2/// Generated client implementations.
3pub mod api_client {
4    #![allow(
5        unused_variables,
6        dead_code,
7        missing_docs,
8        clippy::wildcard_imports,
9        clippy::let_unit_value,
10    )]
11    use tonic::codegen::*;
12    use tonic::codegen::http::Uri;
13    #[derive(Debug, Clone)]
14    pub struct ApiClient<T> {
15        inner: tonic::client::Grpc<T>,
16    }
17    impl ApiClient<tonic::transport::Channel> {
18        /// Attempt to create a new client by connecting to a given endpoint.
19        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
20        where
21            D: TryInto<tonic::transport::Endpoint>,
22            D::Error: Into<StdError>,
23        {
24            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
25            Ok(Self::new(conn))
26        }
27    }
28    impl<T> ApiClient<T>
29    where
30        T: tonic::client::GrpcService<tonic::body::BoxBody>,
31        T::Error: Into<StdError>,
32        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
33        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
34    {
35        pub fn new(inner: T) -> Self {
36            let inner = tonic::client::Grpc::new(inner);
37            Self { inner }
38        }
39        pub fn with_origin(inner: T, origin: Uri) -> Self {
40            let inner = tonic::client::Grpc::with_origin(inner, origin);
41            Self { inner }
42        }
43        pub fn with_interceptor<F>(
44            inner: T,
45            interceptor: F,
46        ) -> ApiClient<InterceptedService<T, F>>
47        where
48            F: tonic::service::Interceptor,
49            T::ResponseBody: Default,
50            T: tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52                Response = http::Response<
53                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
54                >,
55            >,
56            <T as tonic::codegen::Service<
57                http::Request<tonic::body::BoxBody>,
58            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
59        {
60            ApiClient::new(InterceptedService::new(inner, interceptor))
61        }
62        /// Compress requests with the given encoding.
63        ///
64        /// This requires the server to support it otherwise it might respond with an
65        /// error.
66        #[must_use]
67        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.send_compressed(encoding);
69            self
70        }
71        /// Enable decompressing responses.
72        #[must_use]
73        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
74            self.inner = self.inner.accept_compressed(encoding);
75            self
76        }
77        /// Limits the maximum size of a decoded message.
78        ///
79        /// Default: `4MB`
80        #[must_use]
81        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
82            self.inner = self.inner.max_decoding_message_size(limit);
83            self
84        }
85        /// Limits the maximum size of an encoded message.
86        ///
87        /// Default: `usize::MAX`
88        #[must_use]
89        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
90            self.inner = self.inner.max_encoding_message_size(limit);
91            self
92        }
93        /// Returns a nullifier proof for each of the requested nullifiers.
94        pub async fn check_nullifiers(
95            &mut self,
96            request: impl tonic::IntoRequest<
97                super::super::requests::CheckNullifiersRequest,
98            >,
99        ) -> std::result::Result<
100            tonic::Response<super::super::responses::CheckNullifiersResponse>,
101            tonic::Status,
102        > {
103            self.inner
104                .ready()
105                .await
106                .map_err(|e| {
107                    tonic::Status::unknown(
108                        format!("Service was not ready: {}", e.into()),
109                    )
110                })?;
111            let codec = tonic::codec::ProstCodec::default();
112            let path = http::uri::PathAndQuery::from_static("/rpc.Api/CheckNullifiers");
113            let mut req = request.into_request();
114            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "CheckNullifiers"));
115            self.inner.unary(req, path, codec).await
116        }
117        /// Returns a list of nullifiers that match the specified prefixes and are recorded in the node.
118        ///
119        /// Note that only 16-bit prefixes are supported at this time.
120        pub async fn check_nullifiers_by_prefix(
121            &mut self,
122            request: impl tonic::IntoRequest<
123                super::super::requests::CheckNullifiersByPrefixRequest,
124            >,
125        ) -> std::result::Result<
126            tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
127            tonic::Status,
128        > {
129            self.inner
130                .ready()
131                .await
132                .map_err(|e| {
133                    tonic::Status::unknown(
134                        format!("Service was not ready: {}", e.into()),
135                    )
136                })?;
137            let codec = tonic::codec::ProstCodec::default();
138            let path = http::uri::PathAndQuery::from_static(
139                "/rpc.Api/CheckNullifiersByPrefix",
140            );
141            let mut req = request.into_request();
142            req.extensions_mut()
143                .insert(GrpcMethod::new("rpc.Api", "CheckNullifiersByPrefix"));
144            self.inner.unary(req, path, codec).await
145        }
146        /// Returns the latest state of an account with the specified ID.
147        pub async fn get_account_details(
148            &mut self,
149            request: impl tonic::IntoRequest<
150                super::super::requests::GetAccountDetailsRequest,
151            >,
152        ) -> std::result::Result<
153            tonic::Response<super::super::responses::GetAccountDetailsResponse>,
154            tonic::Status,
155        > {
156            self.inner
157                .ready()
158                .await
159                .map_err(|e| {
160                    tonic::Status::unknown(
161                        format!("Service was not ready: {}", e.into()),
162                    )
163                })?;
164            let codec = tonic::codec::ProstCodec::default();
165            let path = http::uri::PathAndQuery::from_static(
166                "/rpc.Api/GetAccountDetails",
167            );
168            let mut req = request.into_request();
169            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "GetAccountDetails"));
170            self.inner.unary(req, path, codec).await
171        }
172        /// Returns the latest state proofs of the specified accounts.
173        pub async fn get_account_proofs(
174            &mut self,
175            request: impl tonic::IntoRequest<
176                super::super::requests::GetAccountProofsRequest,
177            >,
178        ) -> std::result::Result<
179            tonic::Response<super::super::responses::GetAccountProofsResponse>,
180            tonic::Status,
181        > {
182            self.inner
183                .ready()
184                .await
185                .map_err(|e| {
186                    tonic::Status::unknown(
187                        format!("Service was not ready: {}", e.into()),
188                    )
189                })?;
190            let codec = tonic::codec::ProstCodec::default();
191            let path = http::uri::PathAndQuery::from_static("/rpc.Api/GetAccountProofs");
192            let mut req = request.into_request();
193            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "GetAccountProofs"));
194            self.inner.unary(req, path, codec).await
195        }
196        /// Returns delta of the account states in the range from `from_block_num` (exclusive) to
197        /// `to_block_num` (inclusive).
198        pub async fn get_account_state_delta(
199            &mut self,
200            request: impl tonic::IntoRequest<
201                super::super::requests::GetAccountStateDeltaRequest,
202            >,
203        ) -> std::result::Result<
204            tonic::Response<super::super::responses::GetAccountStateDeltaResponse>,
205            tonic::Status,
206        > {
207            self.inner
208                .ready()
209                .await
210                .map_err(|e| {
211                    tonic::Status::unknown(
212                        format!("Service was not ready: {}", e.into()),
213                    )
214                })?;
215            let codec = tonic::codec::ProstCodec::default();
216            let path = http::uri::PathAndQuery::from_static(
217                "/rpc.Api/GetAccountStateDelta",
218            );
219            let mut req = request.into_request();
220            req.extensions_mut()
221                .insert(GrpcMethod::new("rpc.Api", "GetAccountStateDelta"));
222            self.inner.unary(req, path, codec).await
223        }
224        /// Returns raw block data for the specified block number.
225        pub async fn get_block_by_number(
226            &mut self,
227            request: impl tonic::IntoRequest<
228                super::super::requests::GetBlockByNumberRequest,
229            >,
230        ) -> std::result::Result<
231            tonic::Response<super::super::responses::GetBlockByNumberResponse>,
232            tonic::Status,
233        > {
234            self.inner
235                .ready()
236                .await
237                .map_err(|e| {
238                    tonic::Status::unknown(
239                        format!("Service was not ready: {}", e.into()),
240                    )
241                })?;
242            let codec = tonic::codec::ProstCodec::default();
243            let path = http::uri::PathAndQuery::from_static("/rpc.Api/GetBlockByNumber");
244            let mut req = request.into_request();
245            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "GetBlockByNumber"));
246            self.inner.unary(req, path, codec).await
247        }
248        /// Retrieves block header by given block number. Optionally, it also returns the MMR path
249        /// and current chain length to authenticate the block's inclusion.
250        pub async fn get_block_header_by_number(
251            &mut self,
252            request: impl tonic::IntoRequest<
253                super::super::requests::GetBlockHeaderByNumberRequest,
254            >,
255        ) -> std::result::Result<
256            tonic::Response<super::super::responses::GetBlockHeaderByNumberResponse>,
257            tonic::Status,
258        > {
259            self.inner
260                .ready()
261                .await
262                .map_err(|e| {
263                    tonic::Status::unknown(
264                        format!("Service was not ready: {}", e.into()),
265                    )
266                })?;
267            let codec = tonic::codec::ProstCodec::default();
268            let path = http::uri::PathAndQuery::from_static(
269                "/rpc.Api/GetBlockHeaderByNumber",
270            );
271            let mut req = request.into_request();
272            req.extensions_mut()
273                .insert(GrpcMethod::new("rpc.Api", "GetBlockHeaderByNumber"));
274            self.inner.unary(req, path, codec).await
275        }
276        /// Returns a list of notes matching the provided note IDs.
277        pub async fn get_notes_by_id(
278            &mut self,
279            request: impl tonic::IntoRequest<super::super::requests::GetNotesByIdRequest>,
280        ) -> std::result::Result<
281            tonic::Response<super::super::responses::GetNotesByIdResponse>,
282            tonic::Status,
283        > {
284            self.inner
285                .ready()
286                .await
287                .map_err(|e| {
288                    tonic::Status::unknown(
289                        format!("Service was not ready: {}", e.into()),
290                    )
291                })?;
292            let codec = tonic::codec::ProstCodec::default();
293            let path = http::uri::PathAndQuery::from_static("/rpc.Api/GetNotesById");
294            let mut req = request.into_request();
295            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "GetNotesById"));
296            self.inner.unary(req, path, codec).await
297        }
298        /// Submits proven transaction to the Miden network.
299        pub async fn submit_proven_transaction(
300            &mut self,
301            request: impl tonic::IntoRequest<
302                super::super::requests::SubmitProvenTransactionRequest,
303            >,
304        ) -> std::result::Result<
305            tonic::Response<super::super::responses::SubmitProvenTransactionResponse>,
306            tonic::Status,
307        > {
308            self.inner
309                .ready()
310                .await
311                .map_err(|e| {
312                    tonic::Status::unknown(
313                        format!("Service was not ready: {}", e.into()),
314                    )
315                })?;
316            let codec = tonic::codec::ProstCodec::default();
317            let path = http::uri::PathAndQuery::from_static(
318                "/rpc.Api/SubmitProvenTransaction",
319            );
320            let mut req = request.into_request();
321            req.extensions_mut()
322                .insert(GrpcMethod::new("rpc.Api", "SubmitProvenTransaction"));
323            self.inner.unary(req, path, codec).await
324        }
325        /// Returns info which can be used by the client to sync up to the tip of chain for the notes they are interested in.
326        ///
327        /// Client specifies the `note_tags` they are interested in, and the block height from which to search for new for
328        /// matching notes for. The request will then return the next block containing any note matching the provided tags.
329        ///
330        /// The response includes each note's metadata and inclusion proof.
331        ///
332        /// A basic note sync can be implemented by repeatedly requesting the previous response's block until reaching the
333        /// tip of the chain.
334        pub async fn sync_notes(
335            &mut self,
336            request: impl tonic::IntoRequest<super::super::requests::SyncNoteRequest>,
337        ) -> std::result::Result<
338            tonic::Response<super::super::responses::SyncNoteResponse>,
339            tonic::Status,
340        > {
341            self.inner
342                .ready()
343                .await
344                .map_err(|e| {
345                    tonic::Status::unknown(
346                        format!("Service was not ready: {}", e.into()),
347                    )
348                })?;
349            let codec = tonic::codec::ProstCodec::default();
350            let path = http::uri::PathAndQuery::from_static("/rpc.Api/SyncNotes");
351            let mut req = request.into_request();
352            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "SyncNotes"));
353            self.inner.unary(req, path, codec).await
354        }
355        /// Returns info which can be used by the client to sync up to the latest state of the chain
356        /// for the objects (accounts, notes, nullifiers) the client is interested in.
357        ///
358        /// This request returns the next block containing requested data. It also returns `chain_tip`
359        /// which is the latest block number in the chain. Client is expected to repeat these requests
360        /// in a loop until `response.block_header.block_num == response.chain_tip`, at which point
361        /// the client is fully synchronized with the chain.
362        ///
363        /// Each request also returns info about new notes, nullifiers etc. created. It also returns
364        /// Chain MMR delta that can be used to update the state of Chain MMR. This includes both chain
365        /// MMR peaks and chain MMR nodes.
366        ///
367        /// For preserving some degree of privacy, note tags and nullifiers filters contain only high
368        /// part of hashes. Thus, returned data contains excessive notes and nullifiers, client can make
369        /// additional filtering of that data on its side.
370        pub async fn sync_state(
371            &mut self,
372            request: impl tonic::IntoRequest<super::super::requests::SyncStateRequest>,
373        ) -> std::result::Result<
374            tonic::Response<super::super::responses::SyncStateResponse>,
375            tonic::Status,
376        > {
377            self.inner
378                .ready()
379                .await
380                .map_err(|e| {
381                    tonic::Status::unknown(
382                        format!("Service was not ready: {}", e.into()),
383                    )
384                })?;
385            let codec = tonic::codec::ProstCodec::default();
386            let path = http::uri::PathAndQuery::from_static("/rpc.Api/SyncState");
387            let mut req = request.into_request();
388            req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "SyncState"));
389            self.inner.unary(req, path, codec).await
390        }
391    }
392}
393/// Generated server implementations.
394pub mod api_server {
395    #![allow(
396        unused_variables,
397        dead_code,
398        missing_docs,
399        clippy::wildcard_imports,
400        clippy::let_unit_value,
401    )]
402    use tonic::codegen::*;
403    /// Generated trait containing gRPC methods that should be implemented for use with ApiServer.
404    #[async_trait]
405    pub trait Api: std::marker::Send + std::marker::Sync + 'static {
406        /// Returns a nullifier proof for each of the requested nullifiers.
407        async fn check_nullifiers(
408            &self,
409            request: tonic::Request<super::super::requests::CheckNullifiersRequest>,
410        ) -> std::result::Result<
411            tonic::Response<super::super::responses::CheckNullifiersResponse>,
412            tonic::Status,
413        >;
414        /// Returns a list of nullifiers that match the specified prefixes and are recorded in the node.
415        ///
416        /// Note that only 16-bit prefixes are supported at this time.
417        async fn check_nullifiers_by_prefix(
418            &self,
419            request: tonic::Request<
420                super::super::requests::CheckNullifiersByPrefixRequest,
421            >,
422        ) -> std::result::Result<
423            tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
424            tonic::Status,
425        >;
426        /// Returns the latest state of an account with the specified ID.
427        async fn get_account_details(
428            &self,
429            request: tonic::Request<super::super::requests::GetAccountDetailsRequest>,
430        ) -> std::result::Result<
431            tonic::Response<super::super::responses::GetAccountDetailsResponse>,
432            tonic::Status,
433        >;
434        /// Returns the latest state proofs of the specified accounts.
435        async fn get_account_proofs(
436            &self,
437            request: tonic::Request<super::super::requests::GetAccountProofsRequest>,
438        ) -> std::result::Result<
439            tonic::Response<super::super::responses::GetAccountProofsResponse>,
440            tonic::Status,
441        >;
442        /// Returns delta of the account states in the range from `from_block_num` (exclusive) to
443        /// `to_block_num` (inclusive).
444        async fn get_account_state_delta(
445            &self,
446            request: tonic::Request<super::super::requests::GetAccountStateDeltaRequest>,
447        ) -> std::result::Result<
448            tonic::Response<super::super::responses::GetAccountStateDeltaResponse>,
449            tonic::Status,
450        >;
451        /// Returns raw block data for the specified block number.
452        async fn get_block_by_number(
453            &self,
454            request: tonic::Request<super::super::requests::GetBlockByNumberRequest>,
455        ) -> std::result::Result<
456            tonic::Response<super::super::responses::GetBlockByNumberResponse>,
457            tonic::Status,
458        >;
459        /// Retrieves block header by given block number. Optionally, it also returns the MMR path
460        /// and current chain length to authenticate the block's inclusion.
461        async fn get_block_header_by_number(
462            &self,
463            request: tonic::Request<
464                super::super::requests::GetBlockHeaderByNumberRequest,
465            >,
466        ) -> std::result::Result<
467            tonic::Response<super::super::responses::GetBlockHeaderByNumberResponse>,
468            tonic::Status,
469        >;
470        /// Returns a list of notes matching the provided note IDs.
471        async fn get_notes_by_id(
472            &self,
473            request: tonic::Request<super::super::requests::GetNotesByIdRequest>,
474        ) -> std::result::Result<
475            tonic::Response<super::super::responses::GetNotesByIdResponse>,
476            tonic::Status,
477        >;
478        /// Submits proven transaction to the Miden network.
479        async fn submit_proven_transaction(
480            &self,
481            request: tonic::Request<
482                super::super::requests::SubmitProvenTransactionRequest,
483            >,
484        ) -> std::result::Result<
485            tonic::Response<super::super::responses::SubmitProvenTransactionResponse>,
486            tonic::Status,
487        >;
488        /// Returns info which can be used by the client to sync up to the tip of chain for the notes they are interested in.
489        ///
490        /// Client specifies the `note_tags` they are interested in, and the block height from which to search for new for
491        /// matching notes for. The request will then return the next block containing any note matching the provided tags.
492        ///
493        /// The response includes each note's metadata and inclusion proof.
494        ///
495        /// A basic note sync can be implemented by repeatedly requesting the previous response's block until reaching the
496        /// tip of the chain.
497        async fn sync_notes(
498            &self,
499            request: tonic::Request<super::super::requests::SyncNoteRequest>,
500        ) -> std::result::Result<
501            tonic::Response<super::super::responses::SyncNoteResponse>,
502            tonic::Status,
503        >;
504        /// Returns info which can be used by the client to sync up to the latest state of the chain
505        /// for the objects (accounts, notes, nullifiers) the client is interested in.
506        ///
507        /// This request returns the next block containing requested data. It also returns `chain_tip`
508        /// which is the latest block number in the chain. Client is expected to repeat these requests
509        /// in a loop until `response.block_header.block_num == response.chain_tip`, at which point
510        /// the client is fully synchronized with the chain.
511        ///
512        /// Each request also returns info about new notes, nullifiers etc. created. It also returns
513        /// Chain MMR delta that can be used to update the state of Chain MMR. This includes both chain
514        /// MMR peaks and chain MMR nodes.
515        ///
516        /// For preserving some degree of privacy, note tags and nullifiers filters contain only high
517        /// part of hashes. Thus, returned data contains excessive notes and nullifiers, client can make
518        /// additional filtering of that data on its side.
519        async fn sync_state(
520            &self,
521            request: tonic::Request<super::super::requests::SyncStateRequest>,
522        ) -> std::result::Result<
523            tonic::Response<super::super::responses::SyncStateResponse>,
524            tonic::Status,
525        >;
526    }
527    #[derive(Debug)]
528    pub struct ApiServer<T> {
529        inner: Arc<T>,
530        accept_compression_encodings: EnabledCompressionEncodings,
531        send_compression_encodings: EnabledCompressionEncodings,
532        max_decoding_message_size: Option<usize>,
533        max_encoding_message_size: Option<usize>,
534    }
535    impl<T> ApiServer<T> {
536        pub fn new(inner: T) -> Self {
537            Self::from_arc(Arc::new(inner))
538        }
539        pub fn from_arc(inner: Arc<T>) -> Self {
540            Self {
541                inner,
542                accept_compression_encodings: Default::default(),
543                send_compression_encodings: Default::default(),
544                max_decoding_message_size: None,
545                max_encoding_message_size: None,
546            }
547        }
548        pub fn with_interceptor<F>(
549            inner: T,
550            interceptor: F,
551        ) -> InterceptedService<Self, F>
552        where
553            F: tonic::service::Interceptor,
554        {
555            InterceptedService::new(Self::new(inner), interceptor)
556        }
557        /// Enable decompressing requests with the given encoding.
558        #[must_use]
559        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
560            self.accept_compression_encodings.enable(encoding);
561            self
562        }
563        /// Compress responses with the given encoding, if the client supports it.
564        #[must_use]
565        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
566            self.send_compression_encodings.enable(encoding);
567            self
568        }
569        /// Limits the maximum size of a decoded message.
570        ///
571        /// Default: `4MB`
572        #[must_use]
573        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
574            self.max_decoding_message_size = Some(limit);
575            self
576        }
577        /// Limits the maximum size of an encoded message.
578        ///
579        /// Default: `usize::MAX`
580        #[must_use]
581        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
582            self.max_encoding_message_size = Some(limit);
583            self
584        }
585    }
586    impl<T, B> tonic::codegen::Service<http::Request<B>> for ApiServer<T>
587    where
588        T: Api,
589        B: Body + std::marker::Send + 'static,
590        B::Error: Into<StdError> + std::marker::Send + 'static,
591    {
592        type Response = http::Response<tonic::body::BoxBody>;
593        type Error = std::convert::Infallible;
594        type Future = BoxFuture<Self::Response, Self::Error>;
595        fn poll_ready(
596            &mut self,
597            _cx: &mut Context<'_>,
598        ) -> Poll<std::result::Result<(), Self::Error>> {
599            Poll::Ready(Ok(()))
600        }
601        fn call(&mut self, req: http::Request<B>) -> Self::Future {
602            match req.uri().path() {
603                "/rpc.Api/CheckNullifiers" => {
604                    #[allow(non_camel_case_types)]
605                    struct CheckNullifiersSvc<T: Api>(pub Arc<T>);
606                    impl<
607                        T: Api,
608                    > tonic::server::UnaryService<
609                        super::super::requests::CheckNullifiersRequest,
610                    > for CheckNullifiersSvc<T> {
611                        type Response = super::super::responses::CheckNullifiersResponse;
612                        type Future = BoxFuture<
613                            tonic::Response<Self::Response>,
614                            tonic::Status,
615                        >;
616                        fn call(
617                            &mut self,
618                            request: tonic::Request<
619                                super::super::requests::CheckNullifiersRequest,
620                            >,
621                        ) -> Self::Future {
622                            let inner = Arc::clone(&self.0);
623                            let fut = async move {
624                                <T as Api>::check_nullifiers(&inner, request).await
625                            };
626                            Box::pin(fut)
627                        }
628                    }
629                    let accept_compression_encodings = self.accept_compression_encodings;
630                    let send_compression_encodings = self.send_compression_encodings;
631                    let max_decoding_message_size = self.max_decoding_message_size;
632                    let max_encoding_message_size = self.max_encoding_message_size;
633                    let inner = self.inner.clone();
634                    let fut = async move {
635                        let method = CheckNullifiersSvc(inner);
636                        let codec = tonic::codec::ProstCodec::default();
637                        let mut grpc = tonic::server::Grpc::new(codec)
638                            .apply_compression_config(
639                                accept_compression_encodings,
640                                send_compression_encodings,
641                            )
642                            .apply_max_message_size_config(
643                                max_decoding_message_size,
644                                max_encoding_message_size,
645                            );
646                        let res = grpc.unary(method, req).await;
647                        Ok(res)
648                    };
649                    Box::pin(fut)
650                }
651                "/rpc.Api/CheckNullifiersByPrefix" => {
652                    #[allow(non_camel_case_types)]
653                    struct CheckNullifiersByPrefixSvc<T: Api>(pub Arc<T>);
654                    impl<
655                        T: Api,
656                    > tonic::server::UnaryService<
657                        super::super::requests::CheckNullifiersByPrefixRequest,
658                    > for CheckNullifiersByPrefixSvc<T> {
659                        type Response = super::super::responses::CheckNullifiersByPrefixResponse;
660                        type Future = BoxFuture<
661                            tonic::Response<Self::Response>,
662                            tonic::Status,
663                        >;
664                        fn call(
665                            &mut self,
666                            request: tonic::Request<
667                                super::super::requests::CheckNullifiersByPrefixRequest,
668                            >,
669                        ) -> Self::Future {
670                            let inner = Arc::clone(&self.0);
671                            let fut = async move {
672                                <T as Api>::check_nullifiers_by_prefix(&inner, request)
673                                    .await
674                            };
675                            Box::pin(fut)
676                        }
677                    }
678                    let accept_compression_encodings = self.accept_compression_encodings;
679                    let send_compression_encodings = self.send_compression_encodings;
680                    let max_decoding_message_size = self.max_decoding_message_size;
681                    let max_encoding_message_size = self.max_encoding_message_size;
682                    let inner = self.inner.clone();
683                    let fut = async move {
684                        let method = CheckNullifiersByPrefixSvc(inner);
685                        let codec = tonic::codec::ProstCodec::default();
686                        let mut grpc = tonic::server::Grpc::new(codec)
687                            .apply_compression_config(
688                                accept_compression_encodings,
689                                send_compression_encodings,
690                            )
691                            .apply_max_message_size_config(
692                                max_decoding_message_size,
693                                max_encoding_message_size,
694                            );
695                        let res = grpc.unary(method, req).await;
696                        Ok(res)
697                    };
698                    Box::pin(fut)
699                }
700                "/rpc.Api/GetAccountDetails" => {
701                    #[allow(non_camel_case_types)]
702                    struct GetAccountDetailsSvc<T: Api>(pub Arc<T>);
703                    impl<
704                        T: Api,
705                    > tonic::server::UnaryService<
706                        super::super::requests::GetAccountDetailsRequest,
707                    > for GetAccountDetailsSvc<T> {
708                        type Response = super::super::responses::GetAccountDetailsResponse;
709                        type Future = BoxFuture<
710                            tonic::Response<Self::Response>,
711                            tonic::Status,
712                        >;
713                        fn call(
714                            &mut self,
715                            request: tonic::Request<
716                                super::super::requests::GetAccountDetailsRequest,
717                            >,
718                        ) -> Self::Future {
719                            let inner = Arc::clone(&self.0);
720                            let fut = async move {
721                                <T as Api>::get_account_details(&inner, request).await
722                            };
723                            Box::pin(fut)
724                        }
725                    }
726                    let accept_compression_encodings = self.accept_compression_encodings;
727                    let send_compression_encodings = self.send_compression_encodings;
728                    let max_decoding_message_size = self.max_decoding_message_size;
729                    let max_encoding_message_size = self.max_encoding_message_size;
730                    let inner = self.inner.clone();
731                    let fut = async move {
732                        let method = GetAccountDetailsSvc(inner);
733                        let codec = tonic::codec::ProstCodec::default();
734                        let mut grpc = tonic::server::Grpc::new(codec)
735                            .apply_compression_config(
736                                accept_compression_encodings,
737                                send_compression_encodings,
738                            )
739                            .apply_max_message_size_config(
740                                max_decoding_message_size,
741                                max_encoding_message_size,
742                            );
743                        let res = grpc.unary(method, req).await;
744                        Ok(res)
745                    };
746                    Box::pin(fut)
747                }
748                "/rpc.Api/GetAccountProofs" => {
749                    #[allow(non_camel_case_types)]
750                    struct GetAccountProofsSvc<T: Api>(pub Arc<T>);
751                    impl<
752                        T: Api,
753                    > tonic::server::UnaryService<
754                        super::super::requests::GetAccountProofsRequest,
755                    > for GetAccountProofsSvc<T> {
756                        type Response = super::super::responses::GetAccountProofsResponse;
757                        type Future = BoxFuture<
758                            tonic::Response<Self::Response>,
759                            tonic::Status,
760                        >;
761                        fn call(
762                            &mut self,
763                            request: tonic::Request<
764                                super::super::requests::GetAccountProofsRequest,
765                            >,
766                        ) -> Self::Future {
767                            let inner = Arc::clone(&self.0);
768                            let fut = async move {
769                                <T as Api>::get_account_proofs(&inner, request).await
770                            };
771                            Box::pin(fut)
772                        }
773                    }
774                    let accept_compression_encodings = self.accept_compression_encodings;
775                    let send_compression_encodings = self.send_compression_encodings;
776                    let max_decoding_message_size = self.max_decoding_message_size;
777                    let max_encoding_message_size = self.max_encoding_message_size;
778                    let inner = self.inner.clone();
779                    let fut = async move {
780                        let method = GetAccountProofsSvc(inner);
781                        let codec = tonic::codec::ProstCodec::default();
782                        let mut grpc = tonic::server::Grpc::new(codec)
783                            .apply_compression_config(
784                                accept_compression_encodings,
785                                send_compression_encodings,
786                            )
787                            .apply_max_message_size_config(
788                                max_decoding_message_size,
789                                max_encoding_message_size,
790                            );
791                        let res = grpc.unary(method, req).await;
792                        Ok(res)
793                    };
794                    Box::pin(fut)
795                }
796                "/rpc.Api/GetAccountStateDelta" => {
797                    #[allow(non_camel_case_types)]
798                    struct GetAccountStateDeltaSvc<T: Api>(pub Arc<T>);
799                    impl<
800                        T: Api,
801                    > tonic::server::UnaryService<
802                        super::super::requests::GetAccountStateDeltaRequest,
803                    > for GetAccountStateDeltaSvc<T> {
804                        type Response = super::super::responses::GetAccountStateDeltaResponse;
805                        type Future = BoxFuture<
806                            tonic::Response<Self::Response>,
807                            tonic::Status,
808                        >;
809                        fn call(
810                            &mut self,
811                            request: tonic::Request<
812                                super::super::requests::GetAccountStateDeltaRequest,
813                            >,
814                        ) -> Self::Future {
815                            let inner = Arc::clone(&self.0);
816                            let fut = async move {
817                                <T as Api>::get_account_state_delta(&inner, request).await
818                            };
819                            Box::pin(fut)
820                        }
821                    }
822                    let accept_compression_encodings = self.accept_compression_encodings;
823                    let send_compression_encodings = self.send_compression_encodings;
824                    let max_decoding_message_size = self.max_decoding_message_size;
825                    let max_encoding_message_size = self.max_encoding_message_size;
826                    let inner = self.inner.clone();
827                    let fut = async move {
828                        let method = GetAccountStateDeltaSvc(inner);
829                        let codec = tonic::codec::ProstCodec::default();
830                        let mut grpc = tonic::server::Grpc::new(codec)
831                            .apply_compression_config(
832                                accept_compression_encodings,
833                                send_compression_encodings,
834                            )
835                            .apply_max_message_size_config(
836                                max_decoding_message_size,
837                                max_encoding_message_size,
838                            );
839                        let res = grpc.unary(method, req).await;
840                        Ok(res)
841                    };
842                    Box::pin(fut)
843                }
844                "/rpc.Api/GetBlockByNumber" => {
845                    #[allow(non_camel_case_types)]
846                    struct GetBlockByNumberSvc<T: Api>(pub Arc<T>);
847                    impl<
848                        T: Api,
849                    > tonic::server::UnaryService<
850                        super::super::requests::GetBlockByNumberRequest,
851                    > for GetBlockByNumberSvc<T> {
852                        type Response = super::super::responses::GetBlockByNumberResponse;
853                        type Future = BoxFuture<
854                            tonic::Response<Self::Response>,
855                            tonic::Status,
856                        >;
857                        fn call(
858                            &mut self,
859                            request: tonic::Request<
860                                super::super::requests::GetBlockByNumberRequest,
861                            >,
862                        ) -> Self::Future {
863                            let inner = Arc::clone(&self.0);
864                            let fut = async move {
865                                <T as Api>::get_block_by_number(&inner, request).await
866                            };
867                            Box::pin(fut)
868                        }
869                    }
870                    let accept_compression_encodings = self.accept_compression_encodings;
871                    let send_compression_encodings = self.send_compression_encodings;
872                    let max_decoding_message_size = self.max_decoding_message_size;
873                    let max_encoding_message_size = self.max_encoding_message_size;
874                    let inner = self.inner.clone();
875                    let fut = async move {
876                        let method = GetBlockByNumberSvc(inner);
877                        let codec = tonic::codec::ProstCodec::default();
878                        let mut grpc = tonic::server::Grpc::new(codec)
879                            .apply_compression_config(
880                                accept_compression_encodings,
881                                send_compression_encodings,
882                            )
883                            .apply_max_message_size_config(
884                                max_decoding_message_size,
885                                max_encoding_message_size,
886                            );
887                        let res = grpc.unary(method, req).await;
888                        Ok(res)
889                    };
890                    Box::pin(fut)
891                }
892                "/rpc.Api/GetBlockHeaderByNumber" => {
893                    #[allow(non_camel_case_types)]
894                    struct GetBlockHeaderByNumberSvc<T: Api>(pub Arc<T>);
895                    impl<
896                        T: Api,
897                    > tonic::server::UnaryService<
898                        super::super::requests::GetBlockHeaderByNumberRequest,
899                    > for GetBlockHeaderByNumberSvc<T> {
900                        type Response = super::super::responses::GetBlockHeaderByNumberResponse;
901                        type Future = BoxFuture<
902                            tonic::Response<Self::Response>,
903                            tonic::Status,
904                        >;
905                        fn call(
906                            &mut self,
907                            request: tonic::Request<
908                                super::super::requests::GetBlockHeaderByNumberRequest,
909                            >,
910                        ) -> Self::Future {
911                            let inner = Arc::clone(&self.0);
912                            let fut = async move {
913                                <T as Api>::get_block_header_by_number(&inner, request)
914                                    .await
915                            };
916                            Box::pin(fut)
917                        }
918                    }
919                    let accept_compression_encodings = self.accept_compression_encodings;
920                    let send_compression_encodings = self.send_compression_encodings;
921                    let max_decoding_message_size = self.max_decoding_message_size;
922                    let max_encoding_message_size = self.max_encoding_message_size;
923                    let inner = self.inner.clone();
924                    let fut = async move {
925                        let method = GetBlockHeaderByNumberSvc(inner);
926                        let codec = tonic::codec::ProstCodec::default();
927                        let mut grpc = tonic::server::Grpc::new(codec)
928                            .apply_compression_config(
929                                accept_compression_encodings,
930                                send_compression_encodings,
931                            )
932                            .apply_max_message_size_config(
933                                max_decoding_message_size,
934                                max_encoding_message_size,
935                            );
936                        let res = grpc.unary(method, req).await;
937                        Ok(res)
938                    };
939                    Box::pin(fut)
940                }
941                "/rpc.Api/GetNotesById" => {
942                    #[allow(non_camel_case_types)]
943                    struct GetNotesByIdSvc<T: Api>(pub Arc<T>);
944                    impl<
945                        T: Api,
946                    > tonic::server::UnaryService<
947                        super::super::requests::GetNotesByIdRequest,
948                    > for GetNotesByIdSvc<T> {
949                        type Response = super::super::responses::GetNotesByIdResponse;
950                        type Future = BoxFuture<
951                            tonic::Response<Self::Response>,
952                            tonic::Status,
953                        >;
954                        fn call(
955                            &mut self,
956                            request: tonic::Request<
957                                super::super::requests::GetNotesByIdRequest,
958                            >,
959                        ) -> Self::Future {
960                            let inner = Arc::clone(&self.0);
961                            let fut = async move {
962                                <T as Api>::get_notes_by_id(&inner, request).await
963                            };
964                            Box::pin(fut)
965                        }
966                    }
967                    let accept_compression_encodings = self.accept_compression_encodings;
968                    let send_compression_encodings = self.send_compression_encodings;
969                    let max_decoding_message_size = self.max_decoding_message_size;
970                    let max_encoding_message_size = self.max_encoding_message_size;
971                    let inner = self.inner.clone();
972                    let fut = async move {
973                        let method = GetNotesByIdSvc(inner);
974                        let codec = tonic::codec::ProstCodec::default();
975                        let mut grpc = tonic::server::Grpc::new(codec)
976                            .apply_compression_config(
977                                accept_compression_encodings,
978                                send_compression_encodings,
979                            )
980                            .apply_max_message_size_config(
981                                max_decoding_message_size,
982                                max_encoding_message_size,
983                            );
984                        let res = grpc.unary(method, req).await;
985                        Ok(res)
986                    };
987                    Box::pin(fut)
988                }
989                "/rpc.Api/SubmitProvenTransaction" => {
990                    #[allow(non_camel_case_types)]
991                    struct SubmitProvenTransactionSvc<T: Api>(pub Arc<T>);
992                    impl<
993                        T: Api,
994                    > tonic::server::UnaryService<
995                        super::super::requests::SubmitProvenTransactionRequest,
996                    > for SubmitProvenTransactionSvc<T> {
997                        type Response = super::super::responses::SubmitProvenTransactionResponse;
998                        type Future = BoxFuture<
999                            tonic::Response<Self::Response>,
1000                            tonic::Status,
1001                        >;
1002                        fn call(
1003                            &mut self,
1004                            request: tonic::Request<
1005                                super::super::requests::SubmitProvenTransactionRequest,
1006                            >,
1007                        ) -> Self::Future {
1008                            let inner = Arc::clone(&self.0);
1009                            let fut = async move {
1010                                <T as Api>::submit_proven_transaction(&inner, request).await
1011                            };
1012                            Box::pin(fut)
1013                        }
1014                    }
1015                    let accept_compression_encodings = self.accept_compression_encodings;
1016                    let send_compression_encodings = self.send_compression_encodings;
1017                    let max_decoding_message_size = self.max_decoding_message_size;
1018                    let max_encoding_message_size = self.max_encoding_message_size;
1019                    let inner = self.inner.clone();
1020                    let fut = async move {
1021                        let method = SubmitProvenTransactionSvc(inner);
1022                        let codec = tonic::codec::ProstCodec::default();
1023                        let mut grpc = tonic::server::Grpc::new(codec)
1024                            .apply_compression_config(
1025                                accept_compression_encodings,
1026                                send_compression_encodings,
1027                            )
1028                            .apply_max_message_size_config(
1029                                max_decoding_message_size,
1030                                max_encoding_message_size,
1031                            );
1032                        let res = grpc.unary(method, req).await;
1033                        Ok(res)
1034                    };
1035                    Box::pin(fut)
1036                }
1037                "/rpc.Api/SyncNotes" => {
1038                    #[allow(non_camel_case_types)]
1039                    struct SyncNotesSvc<T: Api>(pub Arc<T>);
1040                    impl<
1041                        T: Api,
1042                    > tonic::server::UnaryService<
1043                        super::super::requests::SyncNoteRequest,
1044                    > for SyncNotesSvc<T> {
1045                        type Response = super::super::responses::SyncNoteResponse;
1046                        type Future = BoxFuture<
1047                            tonic::Response<Self::Response>,
1048                            tonic::Status,
1049                        >;
1050                        fn call(
1051                            &mut self,
1052                            request: tonic::Request<
1053                                super::super::requests::SyncNoteRequest,
1054                            >,
1055                        ) -> Self::Future {
1056                            let inner = Arc::clone(&self.0);
1057                            let fut = async move {
1058                                <T as Api>::sync_notes(&inner, request).await
1059                            };
1060                            Box::pin(fut)
1061                        }
1062                    }
1063                    let accept_compression_encodings = self.accept_compression_encodings;
1064                    let send_compression_encodings = self.send_compression_encodings;
1065                    let max_decoding_message_size = self.max_decoding_message_size;
1066                    let max_encoding_message_size = self.max_encoding_message_size;
1067                    let inner = self.inner.clone();
1068                    let fut = async move {
1069                        let method = SyncNotesSvc(inner);
1070                        let codec = tonic::codec::ProstCodec::default();
1071                        let mut grpc = tonic::server::Grpc::new(codec)
1072                            .apply_compression_config(
1073                                accept_compression_encodings,
1074                                send_compression_encodings,
1075                            )
1076                            .apply_max_message_size_config(
1077                                max_decoding_message_size,
1078                                max_encoding_message_size,
1079                            );
1080                        let res = grpc.unary(method, req).await;
1081                        Ok(res)
1082                    };
1083                    Box::pin(fut)
1084                }
1085                "/rpc.Api/SyncState" => {
1086                    #[allow(non_camel_case_types)]
1087                    struct SyncStateSvc<T: Api>(pub Arc<T>);
1088                    impl<
1089                        T: Api,
1090                    > tonic::server::UnaryService<
1091                        super::super::requests::SyncStateRequest,
1092                    > for SyncStateSvc<T> {
1093                        type Response = super::super::responses::SyncStateResponse;
1094                        type Future = BoxFuture<
1095                            tonic::Response<Self::Response>,
1096                            tonic::Status,
1097                        >;
1098                        fn call(
1099                            &mut self,
1100                            request: tonic::Request<
1101                                super::super::requests::SyncStateRequest,
1102                            >,
1103                        ) -> Self::Future {
1104                            let inner = Arc::clone(&self.0);
1105                            let fut = async move {
1106                                <T as Api>::sync_state(&inner, request).await
1107                            };
1108                            Box::pin(fut)
1109                        }
1110                    }
1111                    let accept_compression_encodings = self.accept_compression_encodings;
1112                    let send_compression_encodings = self.send_compression_encodings;
1113                    let max_decoding_message_size = self.max_decoding_message_size;
1114                    let max_encoding_message_size = self.max_encoding_message_size;
1115                    let inner = self.inner.clone();
1116                    let fut = async move {
1117                        let method = SyncStateSvc(inner);
1118                        let codec = tonic::codec::ProstCodec::default();
1119                        let mut grpc = tonic::server::Grpc::new(codec)
1120                            .apply_compression_config(
1121                                accept_compression_encodings,
1122                                send_compression_encodings,
1123                            )
1124                            .apply_max_message_size_config(
1125                                max_decoding_message_size,
1126                                max_encoding_message_size,
1127                            );
1128                        let res = grpc.unary(method, req).await;
1129                        Ok(res)
1130                    };
1131                    Box::pin(fut)
1132                }
1133                _ => {
1134                    Box::pin(async move {
1135                        let mut response = http::Response::new(empty_body());
1136                        let headers = response.headers_mut();
1137                        headers
1138                            .insert(
1139                                tonic::Status::GRPC_STATUS,
1140                                (tonic::Code::Unimplemented as i32).into(),
1141                            );
1142                        headers
1143                            .insert(
1144                                http::header::CONTENT_TYPE,
1145                                tonic::metadata::GRPC_CONTENT_TYPE,
1146                            );
1147                        Ok(response)
1148                    })
1149                }
1150            }
1151        }
1152    }
1153    impl<T> Clone for ApiServer<T> {
1154        fn clone(&self) -> Self {
1155            let inner = self.inner.clone();
1156            Self {
1157                inner,
1158                accept_compression_encodings: self.accept_compression_encodings,
1159                send_compression_encodings: self.send_compression_encodings,
1160                max_decoding_message_size: self.max_decoding_message_size,
1161                max_encoding_message_size: self.max_encoding_message_size,
1162            }
1163        }
1164    }
1165    /// Generated gRPC service name
1166    pub const SERVICE_NAME: &str = "rpc.Api";
1167    impl<T> tonic::server::NamedService for ApiServer<T> {
1168        const NAME: &'static str = SERVICE_NAME;
1169    }
1170}