penumbra_sdk_proto/gen/
penumbra.custody.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct AuthorizeRequest {
4    /// The transaction plan to authorize.
5    #[prost(message, optional, tag = "1")]
6    pub plan: ::core::option::Option<
7        super::super::core::transaction::v1::TransactionPlan,
8    >,
9    /// Optionally, pre-authorization data, if required by the custodian.
10    ///
11    /// Pre-authorization data is backend-specific, and backends are free to ignore it.
12    ///
13    /// Multiple `PreAuthorization` packets can be included in a single request,
14    /// to support multi-party pre-authorizations.
15    #[prost(message, repeated, tag = "3")]
16    pub pre_authorizations: ::prost::alloc::vec::Vec<PreAuthorization>,
17}
18impl ::prost::Name for AuthorizeRequest {
19    const NAME: &'static str = "AuthorizeRequest";
20    const PACKAGE: &'static str = "penumbra.custody.v1";
21    fn full_name() -> ::prost::alloc::string::String {
22        "penumbra.custody.v1.AuthorizeRequest".into()
23    }
24    fn type_url() -> ::prost::alloc::string::String {
25        "/penumbra.custody.v1.AuthorizeRequest".into()
26    }
27}
28#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct AuthorizeResponse {
30    #[prost(message, optional, tag = "1")]
31    pub data: ::core::option::Option<
32        super::super::core::transaction::v1::AuthorizationData,
33    >,
34}
35impl ::prost::Name for AuthorizeResponse {
36    const NAME: &'static str = "AuthorizeResponse";
37    const PACKAGE: &'static str = "penumbra.custody.v1";
38    fn full_name() -> ::prost::alloc::string::String {
39        "penumbra.custody.v1.AuthorizeResponse".into()
40    }
41    fn type_url() -> ::prost::alloc::string::String {
42        "/penumbra.custody.v1.AuthorizeResponse".into()
43    }
44}
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct AuthorizeValidatorDefinitionRequest {
47    /// The validator definition to authorize.
48    #[prost(message, optional, tag = "1")]
49    pub validator_definition: ::core::option::Option<
50        super::super::core::component::stake::v1::Validator,
51    >,
52    /// Optionally, pre-authorization data, if required by the custodian.
53    ///
54    /// Pre-authorization data is backend-specific, and backends are free to ignore it.
55    ///
56    /// Multiple `PreAuthorization` packets can be included in a single request,
57    /// to support multi-party pre-authorizations.
58    #[prost(message, repeated, tag = "3")]
59    pub pre_authorizations: ::prost::alloc::vec::Vec<PreAuthorization>,
60}
61impl ::prost::Name for AuthorizeValidatorDefinitionRequest {
62    const NAME: &'static str = "AuthorizeValidatorDefinitionRequest";
63    const PACKAGE: &'static str = "penumbra.custody.v1";
64    fn full_name() -> ::prost::alloc::string::String {
65        "penumbra.custody.v1.AuthorizeValidatorDefinitionRequest".into()
66    }
67    fn type_url() -> ::prost::alloc::string::String {
68        "/penumbra.custody.v1.AuthorizeValidatorDefinitionRequest".into()
69    }
70}
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct AuthorizeValidatorDefinitionResponse {
73    /// The authorization signature for the validator definition.
74    #[prost(message, optional, tag = "1")]
75    pub validator_definition_auth: ::core::option::Option<
76        super::super::crypto::decaf377_rdsa::v1::SpendAuthSignature,
77    >,
78}
79impl ::prost::Name for AuthorizeValidatorDefinitionResponse {
80    const NAME: &'static str = "AuthorizeValidatorDefinitionResponse";
81    const PACKAGE: &'static str = "penumbra.custody.v1";
82    fn full_name() -> ::prost::alloc::string::String {
83        "penumbra.custody.v1.AuthorizeValidatorDefinitionResponse".into()
84    }
85    fn type_url() -> ::prost::alloc::string::String {
86        "/penumbra.custody.v1.AuthorizeValidatorDefinitionResponse".into()
87    }
88}
89#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct AuthorizeValidatorVoteRequest {
91    /// The validator vote to authorize.
92    #[prost(message, optional, tag = "1")]
93    pub validator_vote: ::core::option::Option<
94        super::super::core::component::governance::v1::ValidatorVoteBody,
95    >,
96    /// Optionally, pre-authorization data, if required by the custodian.
97    ///
98    /// Pre-authorization data is backend-specific, and backends are free to ignore it.
99    ///
100    /// Multiple `PreAuthorization` packets can be included in a single request,
101    /// to support multi-party pre-authorizations.
102    #[prost(message, repeated, tag = "3")]
103    pub pre_authorizations: ::prost::alloc::vec::Vec<PreAuthorization>,
104}
105impl ::prost::Name for AuthorizeValidatorVoteRequest {
106    const NAME: &'static str = "AuthorizeValidatorVoteRequest";
107    const PACKAGE: &'static str = "penumbra.custody.v1";
108    fn full_name() -> ::prost::alloc::string::String {
109        "penumbra.custody.v1.AuthorizeValidatorVoteRequest".into()
110    }
111    fn type_url() -> ::prost::alloc::string::String {
112        "/penumbra.custody.v1.AuthorizeValidatorVoteRequest".into()
113    }
114}
115#[derive(Clone, PartialEq, ::prost::Message)]
116pub struct AuthorizeValidatorVoteResponse {
117    /// The authorization signature for the validator vote.
118    #[prost(message, optional, tag = "1")]
119    pub validator_vote_auth: ::core::option::Option<
120        super::super::crypto::decaf377_rdsa::v1::SpendAuthSignature,
121    >,
122}
123impl ::prost::Name for AuthorizeValidatorVoteResponse {
124    const NAME: &'static str = "AuthorizeValidatorVoteResponse";
125    const PACKAGE: &'static str = "penumbra.custody.v1";
126    fn full_name() -> ::prost::alloc::string::String {
127        "penumbra.custody.v1.AuthorizeValidatorVoteResponse".into()
128    }
129    fn type_url() -> ::prost::alloc::string::String {
130        "/penumbra.custody.v1.AuthorizeValidatorVoteResponse".into()
131    }
132}
133/// A pre-authorization packet.  This allows a custodian to delegate (partial)
134/// signing authority to other authorization mechanisms.  Details of how a
135/// custodian manages those keys are out-of-scope for the custody protocol and
136/// are custodian-specific.
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct PreAuthorization {
139    #[prost(oneof = "pre_authorization::PreAuthorization", tags = "1")]
140    pub pre_authorization: ::core::option::Option<pre_authorization::PreAuthorization>,
141}
142/// Nested message and enum types in `PreAuthorization`.
143pub mod pre_authorization {
144    /// An Ed25519-based preauthorization, containing an Ed25519 signature over the
145    /// `TransactionPlan`.
146    #[derive(Clone, PartialEq, ::prost::Message)]
147    pub struct Ed25519 {
148        /// The Ed25519 verification key used to verify the signature.
149        #[prost(bytes = "vec", tag = "1")]
150        pub vk: ::prost::alloc::vec::Vec<u8>,
151        /// The Ed25519 signature over the `TransactionPlan`.
152        #[prost(bytes = "vec", tag = "2")]
153        pub sig: ::prost::alloc::vec::Vec<u8>,
154    }
155    impl ::prost::Name for Ed25519 {
156        const NAME: &'static str = "Ed25519";
157        const PACKAGE: &'static str = "penumbra.custody.v1";
158        fn full_name() -> ::prost::alloc::string::String {
159            "penumbra.custody.v1.PreAuthorization.Ed25519".into()
160        }
161        fn type_url() -> ::prost::alloc::string::String {
162            "/penumbra.custody.v1.PreAuthorization.Ed25519".into()
163        }
164    }
165    #[derive(Clone, PartialEq, ::prost::Oneof)]
166    pub enum PreAuthorization {
167        #[prost(message, tag = "1")]
168        Ed25519(Ed25519),
169    }
170}
171impl ::prost::Name for PreAuthorization {
172    const NAME: &'static str = "PreAuthorization";
173    const PACKAGE: &'static str = "penumbra.custody.v1";
174    fn full_name() -> ::prost::alloc::string::String {
175        "penumbra.custody.v1.PreAuthorization".into()
176    }
177    fn type_url() -> ::prost::alloc::string::String {
178        "/penumbra.custody.v1.PreAuthorization".into()
179    }
180}
181#[derive(Clone, Copy, PartialEq, ::prost::Message)]
182pub struct ExportFullViewingKeyRequest {}
183impl ::prost::Name for ExportFullViewingKeyRequest {
184    const NAME: &'static str = "ExportFullViewingKeyRequest";
185    const PACKAGE: &'static str = "penumbra.custody.v1";
186    fn full_name() -> ::prost::alloc::string::String {
187        "penumbra.custody.v1.ExportFullViewingKeyRequest".into()
188    }
189    fn type_url() -> ::prost::alloc::string::String {
190        "/penumbra.custody.v1.ExportFullViewingKeyRequest".into()
191    }
192}
193#[derive(Clone, PartialEq, ::prost::Message)]
194pub struct ExportFullViewingKeyResponse {
195    /// The full viewing key.
196    #[prost(message, optional, tag = "1")]
197    pub full_viewing_key: ::core::option::Option<
198        super::super::core::keys::v1::FullViewingKey,
199    >,
200}
201impl ::prost::Name for ExportFullViewingKeyResponse {
202    const NAME: &'static str = "ExportFullViewingKeyResponse";
203    const PACKAGE: &'static str = "penumbra.custody.v1";
204    fn full_name() -> ::prost::alloc::string::String {
205        "penumbra.custody.v1.ExportFullViewingKeyResponse".into()
206    }
207    fn type_url() -> ::prost::alloc::string::String {
208        "/penumbra.custody.v1.ExportFullViewingKeyResponse".into()
209    }
210}
211#[derive(Clone, PartialEq, ::prost::Message)]
212pub struct ConfirmAddressRequest {
213    #[prost(message, optional, tag = "1")]
214    pub address_index: ::core::option::Option<
215        super::super::core::keys::v1::AddressIndex,
216    >,
217}
218impl ::prost::Name for ConfirmAddressRequest {
219    const NAME: &'static str = "ConfirmAddressRequest";
220    const PACKAGE: &'static str = "penumbra.custody.v1";
221    fn full_name() -> ::prost::alloc::string::String {
222        "penumbra.custody.v1.ConfirmAddressRequest".into()
223    }
224    fn type_url() -> ::prost::alloc::string::String {
225        "/penumbra.custody.v1.ConfirmAddressRequest".into()
226    }
227}
228#[derive(Clone, PartialEq, ::prost::Message)]
229pub struct ConfirmAddressResponse {
230    #[prost(message, optional, tag = "1")]
231    pub address: ::core::option::Option<super::super::core::keys::v1::Address>,
232}
233impl ::prost::Name for ConfirmAddressResponse {
234    const NAME: &'static str = "ConfirmAddressResponse";
235    const PACKAGE: &'static str = "penumbra.custody.v1";
236    fn full_name() -> ::prost::alloc::string::String {
237        "penumbra.custody.v1.ConfirmAddressResponse".into()
238    }
239    fn type_url() -> ::prost::alloc::string::String {
240        "/penumbra.custody.v1.ConfirmAddressResponse".into()
241    }
242}
243/// Generated client implementations.
244#[cfg(feature = "rpc")]
245pub mod custody_service_client {
246    #![allow(
247        unused_variables,
248        dead_code,
249        missing_docs,
250        clippy::wildcard_imports,
251        clippy::let_unit_value,
252    )]
253    use tonic::codegen::*;
254    use tonic::codegen::http::Uri;
255    /// The custody protocol is used by a wallet client to request authorization for
256    /// a transaction they've constructed.
257    ///
258    /// Modeling transaction authorization as an asynchronous RPC call encourages
259    /// software to be written in a way that has a compatible data flow with a "soft
260    /// HSM", threshold signing, a hardware wallet, etc.
261    ///
262    /// The custody protocol does not trust the client to authorize spends, so
263    /// custody requests must contain sufficient information for the custodian to
264    /// understand the transaction and determine whether or not it should be
265    /// authorized.
266    #[derive(Debug, Clone)]
267    pub struct CustodyServiceClient<T> {
268        inner: tonic::client::Grpc<T>,
269    }
270    impl CustodyServiceClient<tonic::transport::Channel> {
271        /// Attempt to create a new client by connecting to a given endpoint.
272        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
273        where
274            D: TryInto<tonic::transport::Endpoint>,
275            D::Error: Into<StdError>,
276        {
277            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
278            Ok(Self::new(conn))
279        }
280    }
281    impl<T> CustodyServiceClient<T>
282    where
283        T: tonic::client::GrpcService<tonic::body::BoxBody>,
284        T::Error: Into<StdError>,
285        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
286        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
287    {
288        pub fn new(inner: T) -> Self {
289            let inner = tonic::client::Grpc::new(inner);
290            Self { inner }
291        }
292        pub fn with_origin(inner: T, origin: Uri) -> Self {
293            let inner = tonic::client::Grpc::with_origin(inner, origin);
294            Self { inner }
295        }
296        pub fn with_interceptor<F>(
297            inner: T,
298            interceptor: F,
299        ) -> CustodyServiceClient<InterceptedService<T, F>>
300        where
301            F: tonic::service::Interceptor,
302            T::ResponseBody: Default,
303            T: tonic::codegen::Service<
304                http::Request<tonic::body::BoxBody>,
305                Response = http::Response<
306                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
307                >,
308            >,
309            <T as tonic::codegen::Service<
310                http::Request<tonic::body::BoxBody>,
311            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
312        {
313            CustodyServiceClient::new(InterceptedService::new(inner, interceptor))
314        }
315        /// Compress requests with the given encoding.
316        ///
317        /// This requires the server to support it otherwise it might respond with an
318        /// error.
319        #[must_use]
320        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
321            self.inner = self.inner.send_compressed(encoding);
322            self
323        }
324        /// Enable decompressing responses.
325        #[must_use]
326        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
327            self.inner = self.inner.accept_compressed(encoding);
328            self
329        }
330        /// Limits the maximum size of a decoded message.
331        ///
332        /// Default: `4MB`
333        #[must_use]
334        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
335            self.inner = self.inner.max_decoding_message_size(limit);
336            self
337        }
338        /// Limits the maximum size of an encoded message.
339        ///
340        /// Default: `usize::MAX`
341        #[must_use]
342        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
343            self.inner = self.inner.max_encoding_message_size(limit);
344            self
345        }
346        /// Requests authorization of the transaction with the given description.
347        pub async fn authorize(
348            &mut self,
349            request: impl tonic::IntoRequest<super::AuthorizeRequest>,
350        ) -> std::result::Result<
351            tonic::Response<super::AuthorizeResponse>,
352            tonic::Status,
353        > {
354            self.inner
355                .ready()
356                .await
357                .map_err(|e| {
358                    tonic::Status::unknown(
359                        format!("Service was not ready: {}", e.into()),
360                    )
361                })?;
362            let codec = tonic::codec::ProstCodec::default();
363            let path = http::uri::PathAndQuery::from_static(
364                "/penumbra.custody.v1.CustodyService/Authorize",
365            );
366            let mut req = request.into_request();
367            req.extensions_mut()
368                .insert(
369                    GrpcMethod::new("penumbra.custody.v1.CustodyService", "Authorize"),
370                );
371            self.inner.unary(req, path, codec).await
372        }
373        /// Requests authorization of the given validator definition update.
374        pub async fn authorize_validator_definition(
375            &mut self,
376            request: impl tonic::IntoRequest<super::AuthorizeValidatorDefinitionRequest>,
377        ) -> std::result::Result<
378            tonic::Response<super::AuthorizeValidatorDefinitionResponse>,
379            tonic::Status,
380        > {
381            self.inner
382                .ready()
383                .await
384                .map_err(|e| {
385                    tonic::Status::unknown(
386                        format!("Service was not ready: {}", e.into()),
387                    )
388                })?;
389            let codec = tonic::codec::ProstCodec::default();
390            let path = http::uri::PathAndQuery::from_static(
391                "/penumbra.custody.v1.CustodyService/AuthorizeValidatorDefinition",
392            );
393            let mut req = request.into_request();
394            req.extensions_mut()
395                .insert(
396                    GrpcMethod::new(
397                        "penumbra.custody.v1.CustodyService",
398                        "AuthorizeValidatorDefinition",
399                    ),
400                );
401            self.inner.unary(req, path, codec).await
402        }
403        /// Requests authorization of the given validator vote.
404        pub async fn authorize_validator_vote(
405            &mut self,
406            request: impl tonic::IntoRequest<super::AuthorizeValidatorVoteRequest>,
407        ) -> std::result::Result<
408            tonic::Response<super::AuthorizeValidatorVoteResponse>,
409            tonic::Status,
410        > {
411            self.inner
412                .ready()
413                .await
414                .map_err(|e| {
415                    tonic::Status::unknown(
416                        format!("Service was not ready: {}", e.into()),
417                    )
418                })?;
419            let codec = tonic::codec::ProstCodec::default();
420            let path = http::uri::PathAndQuery::from_static(
421                "/penumbra.custody.v1.CustodyService/AuthorizeValidatorVote",
422            );
423            let mut req = request.into_request();
424            req.extensions_mut()
425                .insert(
426                    GrpcMethod::new(
427                        "penumbra.custody.v1.CustodyService",
428                        "AuthorizeValidatorVote",
429                    ),
430                );
431            self.inner.unary(req, path, codec).await
432        }
433        /// Requests the full viewing key from the custodian.
434        ///
435        /// Custody backends should decide whether to honor this request, and how to
436        /// control access to it.
437        pub async fn export_full_viewing_key(
438            &mut self,
439            request: impl tonic::IntoRequest<super::ExportFullViewingKeyRequest>,
440        ) -> std::result::Result<
441            tonic::Response<super::ExportFullViewingKeyResponse>,
442            tonic::Status,
443        > {
444            self.inner
445                .ready()
446                .await
447                .map_err(|e| {
448                    tonic::Status::unknown(
449                        format!("Service was not ready: {}", e.into()),
450                    )
451                })?;
452            let codec = tonic::codec::ProstCodec::default();
453            let path = http::uri::PathAndQuery::from_static(
454                "/penumbra.custody.v1.CustodyService/ExportFullViewingKey",
455            );
456            let mut req = request.into_request();
457            req.extensions_mut()
458                .insert(
459                    GrpcMethod::new(
460                        "penumbra.custody.v1.CustodyService",
461                        "ExportFullViewingKey",
462                    ),
463                );
464            self.inner.unary(req, path, codec).await
465        }
466        /// Displays an address to a user for confirmation.
467        ///
468        /// Custody backends with user interaction should present the address to the
469        /// user and wait for explicit confirmation before returning.
470        ///
471        /// Non-interactive custody backends may return immediately.
472        pub async fn confirm_address(
473            &mut self,
474            request: impl tonic::IntoRequest<super::ConfirmAddressRequest>,
475        ) -> std::result::Result<
476            tonic::Response<super::ConfirmAddressResponse>,
477            tonic::Status,
478        > {
479            self.inner
480                .ready()
481                .await
482                .map_err(|e| {
483                    tonic::Status::unknown(
484                        format!("Service was not ready: {}", e.into()),
485                    )
486                })?;
487            let codec = tonic::codec::ProstCodec::default();
488            let path = http::uri::PathAndQuery::from_static(
489                "/penumbra.custody.v1.CustodyService/ConfirmAddress",
490            );
491            let mut req = request.into_request();
492            req.extensions_mut()
493                .insert(
494                    GrpcMethod::new(
495                        "penumbra.custody.v1.CustodyService",
496                        "ConfirmAddress",
497                    ),
498                );
499            self.inner.unary(req, path, codec).await
500        }
501    }
502}
503/// Generated server implementations.
504#[cfg(feature = "rpc")]
505pub mod custody_service_server {
506    #![allow(
507        unused_variables,
508        dead_code,
509        missing_docs,
510        clippy::wildcard_imports,
511        clippy::let_unit_value,
512    )]
513    use tonic::codegen::*;
514    /// Generated trait containing gRPC methods that should be implemented for use with CustodyServiceServer.
515    #[async_trait]
516    pub trait CustodyService: std::marker::Send + std::marker::Sync + 'static {
517        /// Requests authorization of the transaction with the given description.
518        async fn authorize(
519            &self,
520            request: tonic::Request<super::AuthorizeRequest>,
521        ) -> std::result::Result<
522            tonic::Response<super::AuthorizeResponse>,
523            tonic::Status,
524        >;
525        /// Requests authorization of the given validator definition update.
526        async fn authorize_validator_definition(
527            &self,
528            request: tonic::Request<super::AuthorizeValidatorDefinitionRequest>,
529        ) -> std::result::Result<
530            tonic::Response<super::AuthorizeValidatorDefinitionResponse>,
531            tonic::Status,
532        >;
533        /// Requests authorization of the given validator vote.
534        async fn authorize_validator_vote(
535            &self,
536            request: tonic::Request<super::AuthorizeValidatorVoteRequest>,
537        ) -> std::result::Result<
538            tonic::Response<super::AuthorizeValidatorVoteResponse>,
539            tonic::Status,
540        >;
541        /// Requests the full viewing key from the custodian.
542        ///
543        /// Custody backends should decide whether to honor this request, and how to
544        /// control access to it.
545        async fn export_full_viewing_key(
546            &self,
547            request: tonic::Request<super::ExportFullViewingKeyRequest>,
548        ) -> std::result::Result<
549            tonic::Response<super::ExportFullViewingKeyResponse>,
550            tonic::Status,
551        >;
552        /// Displays an address to a user for confirmation.
553        ///
554        /// Custody backends with user interaction should present the address to the
555        /// user and wait for explicit confirmation before returning.
556        ///
557        /// Non-interactive custody backends may return immediately.
558        async fn confirm_address(
559            &self,
560            request: tonic::Request<super::ConfirmAddressRequest>,
561        ) -> std::result::Result<
562            tonic::Response<super::ConfirmAddressResponse>,
563            tonic::Status,
564        >;
565    }
566    /// The custody protocol is used by a wallet client to request authorization for
567    /// a transaction they've constructed.
568    ///
569    /// Modeling transaction authorization as an asynchronous RPC call encourages
570    /// software to be written in a way that has a compatible data flow with a "soft
571    /// HSM", threshold signing, a hardware wallet, etc.
572    ///
573    /// The custody protocol does not trust the client to authorize spends, so
574    /// custody requests must contain sufficient information for the custodian to
575    /// understand the transaction and determine whether or not it should be
576    /// authorized.
577    #[derive(Debug)]
578    pub struct CustodyServiceServer<T> {
579        inner: Arc<T>,
580        accept_compression_encodings: EnabledCompressionEncodings,
581        send_compression_encodings: EnabledCompressionEncodings,
582        max_decoding_message_size: Option<usize>,
583        max_encoding_message_size: Option<usize>,
584    }
585    impl<T> CustodyServiceServer<T> {
586        pub fn new(inner: T) -> Self {
587            Self::from_arc(Arc::new(inner))
588        }
589        pub fn from_arc(inner: Arc<T>) -> Self {
590            Self {
591                inner,
592                accept_compression_encodings: Default::default(),
593                send_compression_encodings: Default::default(),
594                max_decoding_message_size: None,
595                max_encoding_message_size: None,
596            }
597        }
598        pub fn with_interceptor<F>(
599            inner: T,
600            interceptor: F,
601        ) -> InterceptedService<Self, F>
602        where
603            F: tonic::service::Interceptor,
604        {
605            InterceptedService::new(Self::new(inner), interceptor)
606        }
607        /// Enable decompressing requests with the given encoding.
608        #[must_use]
609        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
610            self.accept_compression_encodings.enable(encoding);
611            self
612        }
613        /// Compress responses with the given encoding, if the client supports it.
614        #[must_use]
615        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
616            self.send_compression_encodings.enable(encoding);
617            self
618        }
619        /// Limits the maximum size of a decoded message.
620        ///
621        /// Default: `4MB`
622        #[must_use]
623        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
624            self.max_decoding_message_size = Some(limit);
625            self
626        }
627        /// Limits the maximum size of an encoded message.
628        ///
629        /// Default: `usize::MAX`
630        #[must_use]
631        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
632            self.max_encoding_message_size = Some(limit);
633            self
634        }
635    }
636    impl<T, B> tonic::codegen::Service<http::Request<B>> for CustodyServiceServer<T>
637    where
638        T: CustodyService,
639        B: Body + std::marker::Send + 'static,
640        B::Error: Into<StdError> + std::marker::Send + 'static,
641    {
642        type Response = http::Response<tonic::body::BoxBody>;
643        type Error = std::convert::Infallible;
644        type Future = BoxFuture<Self::Response, Self::Error>;
645        fn poll_ready(
646            &mut self,
647            _cx: &mut Context<'_>,
648        ) -> Poll<std::result::Result<(), Self::Error>> {
649            Poll::Ready(Ok(()))
650        }
651        fn call(&mut self, req: http::Request<B>) -> Self::Future {
652            match req.uri().path() {
653                "/penumbra.custody.v1.CustodyService/Authorize" => {
654                    #[allow(non_camel_case_types)]
655                    struct AuthorizeSvc<T: CustodyService>(pub Arc<T>);
656                    impl<
657                        T: CustodyService,
658                    > tonic::server::UnaryService<super::AuthorizeRequest>
659                    for AuthorizeSvc<T> {
660                        type Response = super::AuthorizeResponse;
661                        type Future = BoxFuture<
662                            tonic::Response<Self::Response>,
663                            tonic::Status,
664                        >;
665                        fn call(
666                            &mut self,
667                            request: tonic::Request<super::AuthorizeRequest>,
668                        ) -> Self::Future {
669                            let inner = Arc::clone(&self.0);
670                            let fut = async move {
671                                <T as CustodyService>::authorize(&inner, request).await
672                            };
673                            Box::pin(fut)
674                        }
675                    }
676                    let accept_compression_encodings = self.accept_compression_encodings;
677                    let send_compression_encodings = self.send_compression_encodings;
678                    let max_decoding_message_size = self.max_decoding_message_size;
679                    let max_encoding_message_size = self.max_encoding_message_size;
680                    let inner = self.inner.clone();
681                    let fut = async move {
682                        let method = AuthorizeSvc(inner);
683                        let codec = tonic::codec::ProstCodec::default();
684                        let mut grpc = tonic::server::Grpc::new(codec)
685                            .apply_compression_config(
686                                accept_compression_encodings,
687                                send_compression_encodings,
688                            )
689                            .apply_max_message_size_config(
690                                max_decoding_message_size,
691                                max_encoding_message_size,
692                            );
693                        let res = grpc.unary(method, req).await;
694                        Ok(res)
695                    };
696                    Box::pin(fut)
697                }
698                "/penumbra.custody.v1.CustodyService/AuthorizeValidatorDefinition" => {
699                    #[allow(non_camel_case_types)]
700                    struct AuthorizeValidatorDefinitionSvc<T: CustodyService>(
701                        pub Arc<T>,
702                    );
703                    impl<
704                        T: CustodyService,
705                    > tonic::server::UnaryService<
706                        super::AuthorizeValidatorDefinitionRequest,
707                    > for AuthorizeValidatorDefinitionSvc<T> {
708                        type Response = super::AuthorizeValidatorDefinitionResponse;
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::AuthorizeValidatorDefinitionRequest,
717                            >,
718                        ) -> Self::Future {
719                            let inner = Arc::clone(&self.0);
720                            let fut = async move {
721                                <T as CustodyService>::authorize_validator_definition(
722                                        &inner,
723                                        request,
724                                    )
725                                    .await
726                            };
727                            Box::pin(fut)
728                        }
729                    }
730                    let accept_compression_encodings = self.accept_compression_encodings;
731                    let send_compression_encodings = self.send_compression_encodings;
732                    let max_decoding_message_size = self.max_decoding_message_size;
733                    let max_encoding_message_size = self.max_encoding_message_size;
734                    let inner = self.inner.clone();
735                    let fut = async move {
736                        let method = AuthorizeValidatorDefinitionSvc(inner);
737                        let codec = tonic::codec::ProstCodec::default();
738                        let mut grpc = tonic::server::Grpc::new(codec)
739                            .apply_compression_config(
740                                accept_compression_encodings,
741                                send_compression_encodings,
742                            )
743                            .apply_max_message_size_config(
744                                max_decoding_message_size,
745                                max_encoding_message_size,
746                            );
747                        let res = grpc.unary(method, req).await;
748                        Ok(res)
749                    };
750                    Box::pin(fut)
751                }
752                "/penumbra.custody.v1.CustodyService/AuthorizeValidatorVote" => {
753                    #[allow(non_camel_case_types)]
754                    struct AuthorizeValidatorVoteSvc<T: CustodyService>(pub Arc<T>);
755                    impl<
756                        T: CustodyService,
757                    > tonic::server::UnaryService<super::AuthorizeValidatorVoteRequest>
758                    for AuthorizeValidatorVoteSvc<T> {
759                        type Response = super::AuthorizeValidatorVoteResponse;
760                        type Future = BoxFuture<
761                            tonic::Response<Self::Response>,
762                            tonic::Status,
763                        >;
764                        fn call(
765                            &mut self,
766                            request: tonic::Request<super::AuthorizeValidatorVoteRequest>,
767                        ) -> Self::Future {
768                            let inner = Arc::clone(&self.0);
769                            let fut = async move {
770                                <T as CustodyService>::authorize_validator_vote(
771                                        &inner,
772                                        request,
773                                    )
774                                    .await
775                            };
776                            Box::pin(fut)
777                        }
778                    }
779                    let accept_compression_encodings = self.accept_compression_encodings;
780                    let send_compression_encodings = self.send_compression_encodings;
781                    let max_decoding_message_size = self.max_decoding_message_size;
782                    let max_encoding_message_size = self.max_encoding_message_size;
783                    let inner = self.inner.clone();
784                    let fut = async move {
785                        let method = AuthorizeValidatorVoteSvc(inner);
786                        let codec = tonic::codec::ProstCodec::default();
787                        let mut grpc = tonic::server::Grpc::new(codec)
788                            .apply_compression_config(
789                                accept_compression_encodings,
790                                send_compression_encodings,
791                            )
792                            .apply_max_message_size_config(
793                                max_decoding_message_size,
794                                max_encoding_message_size,
795                            );
796                        let res = grpc.unary(method, req).await;
797                        Ok(res)
798                    };
799                    Box::pin(fut)
800                }
801                "/penumbra.custody.v1.CustodyService/ExportFullViewingKey" => {
802                    #[allow(non_camel_case_types)]
803                    struct ExportFullViewingKeySvc<T: CustodyService>(pub Arc<T>);
804                    impl<
805                        T: CustodyService,
806                    > tonic::server::UnaryService<super::ExportFullViewingKeyRequest>
807                    for ExportFullViewingKeySvc<T> {
808                        type Response = super::ExportFullViewingKeyResponse;
809                        type Future = BoxFuture<
810                            tonic::Response<Self::Response>,
811                            tonic::Status,
812                        >;
813                        fn call(
814                            &mut self,
815                            request: tonic::Request<super::ExportFullViewingKeyRequest>,
816                        ) -> Self::Future {
817                            let inner = Arc::clone(&self.0);
818                            let fut = async move {
819                                <T as CustodyService>::export_full_viewing_key(
820                                        &inner,
821                                        request,
822                                    )
823                                    .await
824                            };
825                            Box::pin(fut)
826                        }
827                    }
828                    let accept_compression_encodings = self.accept_compression_encodings;
829                    let send_compression_encodings = self.send_compression_encodings;
830                    let max_decoding_message_size = self.max_decoding_message_size;
831                    let max_encoding_message_size = self.max_encoding_message_size;
832                    let inner = self.inner.clone();
833                    let fut = async move {
834                        let method = ExportFullViewingKeySvc(inner);
835                        let codec = tonic::codec::ProstCodec::default();
836                        let mut grpc = tonic::server::Grpc::new(codec)
837                            .apply_compression_config(
838                                accept_compression_encodings,
839                                send_compression_encodings,
840                            )
841                            .apply_max_message_size_config(
842                                max_decoding_message_size,
843                                max_encoding_message_size,
844                            );
845                        let res = grpc.unary(method, req).await;
846                        Ok(res)
847                    };
848                    Box::pin(fut)
849                }
850                "/penumbra.custody.v1.CustodyService/ConfirmAddress" => {
851                    #[allow(non_camel_case_types)]
852                    struct ConfirmAddressSvc<T: CustodyService>(pub Arc<T>);
853                    impl<
854                        T: CustodyService,
855                    > tonic::server::UnaryService<super::ConfirmAddressRequest>
856                    for ConfirmAddressSvc<T> {
857                        type Response = super::ConfirmAddressResponse;
858                        type Future = BoxFuture<
859                            tonic::Response<Self::Response>,
860                            tonic::Status,
861                        >;
862                        fn call(
863                            &mut self,
864                            request: tonic::Request<super::ConfirmAddressRequest>,
865                        ) -> Self::Future {
866                            let inner = Arc::clone(&self.0);
867                            let fut = async move {
868                                <T as CustodyService>::confirm_address(&inner, request)
869                                    .await
870                            };
871                            Box::pin(fut)
872                        }
873                    }
874                    let accept_compression_encodings = self.accept_compression_encodings;
875                    let send_compression_encodings = self.send_compression_encodings;
876                    let max_decoding_message_size = self.max_decoding_message_size;
877                    let max_encoding_message_size = self.max_encoding_message_size;
878                    let inner = self.inner.clone();
879                    let fut = async move {
880                        let method = ConfirmAddressSvc(inner);
881                        let codec = tonic::codec::ProstCodec::default();
882                        let mut grpc = tonic::server::Grpc::new(codec)
883                            .apply_compression_config(
884                                accept_compression_encodings,
885                                send_compression_encodings,
886                            )
887                            .apply_max_message_size_config(
888                                max_decoding_message_size,
889                                max_encoding_message_size,
890                            );
891                        let res = grpc.unary(method, req).await;
892                        Ok(res)
893                    };
894                    Box::pin(fut)
895                }
896                _ => {
897                    Box::pin(async move {
898                        let mut response = http::Response::new(empty_body());
899                        let headers = response.headers_mut();
900                        headers
901                            .insert(
902                                tonic::Status::GRPC_STATUS,
903                                (tonic::Code::Unimplemented as i32).into(),
904                            );
905                        headers
906                            .insert(
907                                http::header::CONTENT_TYPE,
908                                tonic::metadata::GRPC_CONTENT_TYPE,
909                            );
910                        Ok(response)
911                    })
912                }
913            }
914        }
915    }
916    impl<T> Clone for CustodyServiceServer<T> {
917        fn clone(&self) -> Self {
918            let inner = self.inner.clone();
919            Self {
920                inner,
921                accept_compression_encodings: self.accept_compression_encodings,
922                send_compression_encodings: self.send_compression_encodings,
923                max_decoding_message_size: self.max_decoding_message_size,
924                max_encoding_message_size: self.max_encoding_message_size,
925            }
926        }
927    }
928    /// Generated gRPC service name
929    pub const SERVICE_NAME: &str = "penumbra.custody.v1.CustodyService";
930    impl<T> tonic::server::NamedService for CustodyServiceServer<T> {
931        const NAME: &'static str = SERVICE_NAME;
932    }
933}