juno_rust_proto/prost/cosmos-sdk/
cosmos.authz.v1beta1.rs

1/// EventGrant is emitted on Msg/Grant
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct EventGrant {
5    /// Msg type URL for which an autorization is granted
6    #[prost(string, tag = "2")]
7    pub msg_type_url: ::prost::alloc::string::String,
8    /// Granter account address
9    #[prost(string, tag = "3")]
10    pub granter: ::prost::alloc::string::String,
11    /// Grantee account address
12    #[prost(string, tag = "4")]
13    pub grantee: ::prost::alloc::string::String,
14}
15/// EventRevoke is emitted on Msg/Revoke
16#[allow(clippy::derive_partial_eq_without_eq)]
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct EventRevoke {
19    /// Msg type URL for which an autorization is revoked
20    #[prost(string, tag = "2")]
21    pub msg_type_url: ::prost::alloc::string::String,
22    /// Granter account address
23    #[prost(string, tag = "3")]
24    pub granter: ::prost::alloc::string::String,
25    /// Grantee account address
26    #[prost(string, tag = "4")]
27    pub grantee: ::prost::alloc::string::String,
28}
29/// GenericAuthorization gives the grantee unrestricted permissions to execute
30/// the provided method on behalf of the granter's account.
31#[allow(clippy::derive_partial_eq_without_eq)]
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct GenericAuthorization {
34    /// Msg, identified by it's type URL, to grant unrestricted permissions to execute
35    #[prost(string, tag = "1")]
36    pub msg: ::prost::alloc::string::String,
37}
38/// Grant gives permissions to execute
39/// the provide method with expiration time.
40#[allow(clippy::derive_partial_eq_without_eq)]
41#[derive(Clone, PartialEq, ::prost::Message)]
42pub struct Grant {
43    #[prost(message, optional, tag = "1")]
44    pub authorization: ::core::option::Option<::prost_types::Any>,
45    #[prost(message, optional, tag = "2")]
46    pub expiration: ::core::option::Option<::prost_types::Timestamp>,
47}
48/// GrantAuthorization extends a grant with both the addresses of the grantee and granter.
49/// It is used in genesis.proto and query.proto
50///
51/// Since: cosmos-sdk 0.45.2
52#[allow(clippy::derive_partial_eq_without_eq)]
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct GrantAuthorization {
55    #[prost(string, tag = "1")]
56    pub granter: ::prost::alloc::string::String,
57    #[prost(string, tag = "2")]
58    pub grantee: ::prost::alloc::string::String,
59    #[prost(message, optional, tag = "3")]
60    pub authorization: ::core::option::Option<::prost_types::Any>,
61    #[prost(message, optional, tag = "4")]
62    pub expiration: ::core::option::Option<::prost_types::Timestamp>,
63}
64/// MsgGrant is a request type for Grant method. It declares authorization to the grantee
65/// on behalf of the granter with the provided expiration time.
66#[allow(clippy::derive_partial_eq_without_eq)]
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct MsgGrant {
69    #[prost(string, tag = "1")]
70    pub granter: ::prost::alloc::string::String,
71    #[prost(string, tag = "2")]
72    pub grantee: ::prost::alloc::string::String,
73    #[prost(message, optional, tag = "3")]
74    pub grant: ::core::option::Option<Grant>,
75}
76/// MsgExecResponse defines the Msg/MsgExecResponse response type.
77#[allow(clippy::derive_partial_eq_without_eq)]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct MsgExecResponse {
80    #[prost(bytes = "vec", repeated, tag = "1")]
81    pub results: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
82}
83/// MsgExec attempts to execute the provided messages using
84/// authorizations granted to the grantee. Each message should have only
85/// one signer corresponding to the granter of the authorization.
86#[allow(clippy::derive_partial_eq_without_eq)]
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct MsgExec {
89    #[prost(string, tag = "1")]
90    pub grantee: ::prost::alloc::string::String,
91    /// Authorization Msg requests to execute. Each msg must implement Authorization interface
92    /// The x/authz will try to find a grant matching (msg.signers\[0\], grantee, MsgTypeURL(msg))
93    /// triple and validate it.
94    #[prost(message, repeated, tag = "2")]
95    pub msgs: ::prost::alloc::vec::Vec<::prost_types::Any>,
96}
97/// MsgGrantResponse defines the Msg/MsgGrant response type.
98#[allow(clippy::derive_partial_eq_without_eq)]
99#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct MsgGrantResponse {}
101/// MsgRevoke revokes any authorization with the provided sdk.Msg type on the
102/// granter's account with that has been granted to the grantee.
103#[allow(clippy::derive_partial_eq_without_eq)]
104#[derive(Clone, PartialEq, ::prost::Message)]
105pub struct MsgRevoke {
106    #[prost(string, tag = "1")]
107    pub granter: ::prost::alloc::string::String,
108    #[prost(string, tag = "2")]
109    pub grantee: ::prost::alloc::string::String,
110    #[prost(string, tag = "3")]
111    pub msg_type_url: ::prost::alloc::string::String,
112}
113/// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type.
114#[allow(clippy::derive_partial_eq_without_eq)]
115#[derive(Clone, PartialEq, ::prost::Message)]
116pub struct MsgRevokeResponse {}
117/// Generated client implementations.
118#[cfg(feature = "grpc")]
119#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
120pub mod msg_client {
121    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
122    use tonic::codegen::http::Uri;
123    use tonic::codegen::*;
124    /// Msg defines the authz Msg service.
125    #[derive(Debug, Clone)]
126    pub struct MsgClient<T> {
127        inner: tonic::client::Grpc<T>,
128    }
129    #[cfg(feature = "grpc-transport")]
130    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
131    impl MsgClient<tonic::transport::Channel> {
132        /// Attempt to create a new client by connecting to a given endpoint.
133        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
134        where
135            D: std::convert::TryInto<tonic::transport::Endpoint>,
136            D::Error: Into<StdError>,
137        {
138            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
139            Ok(Self::new(conn))
140        }
141    }
142    impl<T> MsgClient<T>
143    where
144        T: tonic::client::GrpcService<tonic::body::BoxBody>,
145        T::Error: Into<StdError>,
146        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
147        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
148    {
149        pub fn new(inner: T) -> Self {
150            let inner = tonic::client::Grpc::new(inner);
151            Self { inner }
152        }
153        pub fn with_origin(inner: T, origin: Uri) -> Self {
154            let inner = tonic::client::Grpc::with_origin(inner, origin);
155            Self { inner }
156        }
157        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
158        where
159            F: tonic::service::Interceptor,
160            T::ResponseBody: Default,
161            T: tonic::codegen::Service<
162                http::Request<tonic::body::BoxBody>,
163                Response = http::Response<
164                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
165                >,
166            >,
167            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
168                Into<StdError> + Send + Sync,
169        {
170            MsgClient::new(InterceptedService::new(inner, interceptor))
171        }
172        /// Compress requests with the given encoding.
173        ///
174        /// This requires the server to support it otherwise it might respond with an
175        /// error.
176        #[must_use]
177        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
178            self.inner = self.inner.send_compressed(encoding);
179            self
180        }
181        /// Enable decompressing responses.
182        #[must_use]
183        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
184            self.inner = self.inner.accept_compressed(encoding);
185            self
186        }
187        /// Grant grants the provided authorization to the grantee on the granter's
188        /// account with the provided expiration time. If there is already a grant
189        /// for the given (granter, grantee, Authorization) triple, then the grant
190        /// will be overwritten.
191        pub async fn grant(
192            &mut self,
193            request: impl tonic::IntoRequest<super::MsgGrant>,
194        ) -> Result<tonic::Response<super::MsgGrantResponse>, tonic::Status> {
195            self.inner.ready().await.map_err(|e| {
196                tonic::Status::new(
197                    tonic::Code::Unknown,
198                    format!("Service was not ready: {}", e.into()),
199                )
200            })?;
201            let codec = tonic::codec::ProstCodec::default();
202            let path = http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Msg/Grant");
203            self.inner.unary(request.into_request(), path, codec).await
204        }
205        /// Exec attempts to execute the provided messages using
206        /// authorizations granted to the grantee. Each message should have only
207        /// one signer corresponding to the granter of the authorization.
208        pub async fn exec(
209            &mut self,
210            request: impl tonic::IntoRequest<super::MsgExec>,
211        ) -> Result<tonic::Response<super::MsgExecResponse>, tonic::Status> {
212            self.inner.ready().await.map_err(|e| {
213                tonic::Status::new(
214                    tonic::Code::Unknown,
215                    format!("Service was not ready: {}", e.into()),
216                )
217            })?;
218            let codec = tonic::codec::ProstCodec::default();
219            let path = http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Msg/Exec");
220            self.inner.unary(request.into_request(), path, codec).await
221        }
222        /// Revoke revokes any authorization corresponding to the provided method name on the
223        /// granter's account that has been granted to the grantee.
224        pub async fn revoke(
225            &mut self,
226            request: impl tonic::IntoRequest<super::MsgRevoke>,
227        ) -> Result<tonic::Response<super::MsgRevokeResponse>, tonic::Status> {
228            self.inner.ready().await.map_err(|e| {
229                tonic::Status::new(
230                    tonic::Code::Unknown,
231                    format!("Service was not ready: {}", e.into()),
232                )
233            })?;
234            let codec = tonic::codec::ProstCodec::default();
235            let path = http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Msg/Revoke");
236            self.inner.unary(request.into_request(), path, codec).await
237        }
238    }
239}
240/// Generated server implementations.
241#[cfg(feature = "grpc")]
242#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
243pub mod msg_server {
244    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
245    use tonic::codegen::*;
246    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
247    #[async_trait]
248    pub trait Msg: Send + Sync + 'static {
249        /// Grant grants the provided authorization to the grantee on the granter's
250        /// account with the provided expiration time. If there is already a grant
251        /// for the given (granter, grantee, Authorization) triple, then the grant
252        /// will be overwritten.
253        async fn grant(
254            &self,
255            request: tonic::Request<super::MsgGrant>,
256        ) -> Result<tonic::Response<super::MsgGrantResponse>, tonic::Status>;
257        /// Exec attempts to execute the provided messages using
258        /// authorizations granted to the grantee. Each message should have only
259        /// one signer corresponding to the granter of the authorization.
260        async fn exec(
261            &self,
262            request: tonic::Request<super::MsgExec>,
263        ) -> Result<tonic::Response<super::MsgExecResponse>, tonic::Status>;
264        /// Revoke revokes any authorization corresponding to the provided method name on the
265        /// granter's account that has been granted to the grantee.
266        async fn revoke(
267            &self,
268            request: tonic::Request<super::MsgRevoke>,
269        ) -> Result<tonic::Response<super::MsgRevokeResponse>, tonic::Status>;
270    }
271    /// Msg defines the authz Msg service.
272    #[derive(Debug)]
273    pub struct MsgServer<T: Msg> {
274        inner: _Inner<T>,
275        accept_compression_encodings: EnabledCompressionEncodings,
276        send_compression_encodings: EnabledCompressionEncodings,
277    }
278    struct _Inner<T>(Arc<T>);
279    impl<T: Msg> MsgServer<T> {
280        pub fn new(inner: T) -> Self {
281            Self::from_arc(Arc::new(inner))
282        }
283        pub fn from_arc(inner: Arc<T>) -> Self {
284            let inner = _Inner(inner);
285            Self {
286                inner,
287                accept_compression_encodings: Default::default(),
288                send_compression_encodings: Default::default(),
289            }
290        }
291        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
292        where
293            F: tonic::service::Interceptor,
294        {
295            InterceptedService::new(Self::new(inner), interceptor)
296        }
297        /// Enable decompressing requests with the given encoding.
298        #[must_use]
299        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
300            self.accept_compression_encodings.enable(encoding);
301            self
302        }
303        /// Compress responses with the given encoding, if the client supports it.
304        #[must_use]
305        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
306            self.send_compression_encodings.enable(encoding);
307            self
308        }
309    }
310    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
311    where
312        T: Msg,
313        B: Body + Send + 'static,
314        B::Error: Into<StdError> + Send + 'static,
315    {
316        type Response = http::Response<tonic::body::BoxBody>;
317        type Error = std::convert::Infallible;
318        type Future = BoxFuture<Self::Response, Self::Error>;
319        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
320            Poll::Ready(Ok(()))
321        }
322        fn call(&mut self, req: http::Request<B>) -> Self::Future {
323            let inner = self.inner.clone();
324            match req.uri().path() {
325                "/cosmos.authz.v1beta1.Msg/Grant" => {
326                    #[allow(non_camel_case_types)]
327                    struct GrantSvc<T: Msg>(pub Arc<T>);
328                    impl<T: Msg> tonic::server::UnaryService<super::MsgGrant> for GrantSvc<T> {
329                        type Response = super::MsgGrantResponse;
330                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
331                        fn call(
332                            &mut self,
333                            request: tonic::Request<super::MsgGrant>,
334                        ) -> Self::Future {
335                            let inner = self.0.clone();
336                            let fut = async move { (*inner).grant(request).await };
337                            Box::pin(fut)
338                        }
339                    }
340                    let accept_compression_encodings = self.accept_compression_encodings;
341                    let send_compression_encodings = self.send_compression_encodings;
342                    let inner = self.inner.clone();
343                    let fut = async move {
344                        let inner = inner.0;
345                        let method = GrantSvc(inner);
346                        let codec = tonic::codec::ProstCodec::default();
347                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
348                            accept_compression_encodings,
349                            send_compression_encodings,
350                        );
351                        let res = grpc.unary(method, req).await;
352                        Ok(res)
353                    };
354                    Box::pin(fut)
355                }
356                "/cosmos.authz.v1beta1.Msg/Exec" => {
357                    #[allow(non_camel_case_types)]
358                    struct ExecSvc<T: Msg>(pub Arc<T>);
359                    impl<T: Msg> tonic::server::UnaryService<super::MsgExec> for ExecSvc<T> {
360                        type Response = super::MsgExecResponse;
361                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
362                        fn call(
363                            &mut self,
364                            request: tonic::Request<super::MsgExec>,
365                        ) -> Self::Future {
366                            let inner = self.0.clone();
367                            let fut = async move { (*inner).exec(request).await };
368                            Box::pin(fut)
369                        }
370                    }
371                    let accept_compression_encodings = self.accept_compression_encodings;
372                    let send_compression_encodings = self.send_compression_encodings;
373                    let inner = self.inner.clone();
374                    let fut = async move {
375                        let inner = inner.0;
376                        let method = ExecSvc(inner);
377                        let codec = tonic::codec::ProstCodec::default();
378                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
379                            accept_compression_encodings,
380                            send_compression_encodings,
381                        );
382                        let res = grpc.unary(method, req).await;
383                        Ok(res)
384                    };
385                    Box::pin(fut)
386                }
387                "/cosmos.authz.v1beta1.Msg/Revoke" => {
388                    #[allow(non_camel_case_types)]
389                    struct RevokeSvc<T: Msg>(pub Arc<T>);
390                    impl<T: Msg> tonic::server::UnaryService<super::MsgRevoke> for RevokeSvc<T> {
391                        type Response = super::MsgRevokeResponse;
392                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
393                        fn call(
394                            &mut self,
395                            request: tonic::Request<super::MsgRevoke>,
396                        ) -> Self::Future {
397                            let inner = self.0.clone();
398                            let fut = async move { (*inner).revoke(request).await };
399                            Box::pin(fut)
400                        }
401                    }
402                    let accept_compression_encodings = self.accept_compression_encodings;
403                    let send_compression_encodings = self.send_compression_encodings;
404                    let inner = self.inner.clone();
405                    let fut = async move {
406                        let inner = inner.0;
407                        let method = RevokeSvc(inner);
408                        let codec = tonic::codec::ProstCodec::default();
409                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
410                            accept_compression_encodings,
411                            send_compression_encodings,
412                        );
413                        let res = grpc.unary(method, req).await;
414                        Ok(res)
415                    };
416                    Box::pin(fut)
417                }
418                _ => Box::pin(async move {
419                    Ok(http::Response::builder()
420                        .status(200)
421                        .header("grpc-status", "12")
422                        .header("content-type", "application/grpc")
423                        .body(empty_body())
424                        .unwrap())
425                }),
426            }
427        }
428    }
429    impl<T: Msg> Clone for MsgServer<T> {
430        fn clone(&self) -> Self {
431            let inner = self.inner.clone();
432            Self {
433                inner,
434                accept_compression_encodings: self.accept_compression_encodings,
435                send_compression_encodings: self.send_compression_encodings,
436            }
437        }
438    }
439    impl<T: Msg> Clone for _Inner<T> {
440        fn clone(&self) -> Self {
441            Self(self.0.clone())
442        }
443    }
444    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
445        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
446            write!(f, "{:?}", self.0)
447        }
448    }
449    impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
450        const NAME: &'static str = "cosmos.authz.v1beta1.Msg";
451    }
452}
453/// QueryGrantsRequest is the request type for the Query/Grants RPC method.
454#[allow(clippy::derive_partial_eq_without_eq)]
455#[derive(Clone, PartialEq, ::prost::Message)]
456pub struct QueryGrantsRequest {
457    #[prost(string, tag = "1")]
458    pub granter: ::prost::alloc::string::String,
459    #[prost(string, tag = "2")]
460    pub grantee: ::prost::alloc::string::String,
461    /// Optional, msg_type_url, when set, will query only grants matching given msg type.
462    #[prost(string, tag = "3")]
463    pub msg_type_url: ::prost::alloc::string::String,
464    /// pagination defines an pagination for the request.
465    #[prost(message, optional, tag = "4")]
466    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
467}
468/// QueryGrantsResponse is the response type for the Query/Authorizations RPC method.
469#[allow(clippy::derive_partial_eq_without_eq)]
470#[derive(Clone, PartialEq, ::prost::Message)]
471pub struct QueryGrantsResponse {
472    /// authorizations is a list of grants granted for grantee by granter.
473    #[prost(message, repeated, tag = "1")]
474    pub grants: ::prost::alloc::vec::Vec<Grant>,
475    /// pagination defines an pagination for the response.
476    #[prost(message, optional, tag = "2")]
477    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
478}
479/// QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method.
480#[allow(clippy::derive_partial_eq_without_eq)]
481#[derive(Clone, PartialEq, ::prost::Message)]
482pub struct QueryGranterGrantsRequest {
483    #[prost(string, tag = "1")]
484    pub granter: ::prost::alloc::string::String,
485    /// pagination defines an pagination for the request.
486    #[prost(message, optional, tag = "2")]
487    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
488}
489/// QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method.
490#[allow(clippy::derive_partial_eq_without_eq)]
491#[derive(Clone, PartialEq, ::prost::Message)]
492pub struct QueryGranterGrantsResponse {
493    /// grants is a list of grants granted by the granter.
494    #[prost(message, repeated, tag = "1")]
495    pub grants: ::prost::alloc::vec::Vec<GrantAuthorization>,
496    /// pagination defines an pagination for the response.
497    #[prost(message, optional, tag = "2")]
498    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
499}
500/// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method.
501#[allow(clippy::derive_partial_eq_without_eq)]
502#[derive(Clone, PartialEq, ::prost::Message)]
503pub struct QueryGranteeGrantsRequest {
504    #[prost(string, tag = "1")]
505    pub grantee: ::prost::alloc::string::String,
506    /// pagination defines an pagination for the request.
507    #[prost(message, optional, tag = "2")]
508    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
509}
510/// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method.
511#[allow(clippy::derive_partial_eq_without_eq)]
512#[derive(Clone, PartialEq, ::prost::Message)]
513pub struct QueryGranteeGrantsResponse {
514    /// grants is a list of grants granted to the grantee.
515    #[prost(message, repeated, tag = "1")]
516    pub grants: ::prost::alloc::vec::Vec<GrantAuthorization>,
517    /// pagination defines an pagination for the response.
518    #[prost(message, optional, tag = "2")]
519    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
520}
521/// Generated client implementations.
522#[cfg(feature = "grpc")]
523#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
524pub mod query_client {
525    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
526    use tonic::codegen::http::Uri;
527    use tonic::codegen::*;
528    /// Query defines the gRPC querier service.
529    #[derive(Debug, Clone)]
530    pub struct QueryClient<T> {
531        inner: tonic::client::Grpc<T>,
532    }
533    #[cfg(feature = "grpc-transport")]
534    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
535    impl QueryClient<tonic::transport::Channel> {
536        /// Attempt to create a new client by connecting to a given endpoint.
537        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
538        where
539            D: std::convert::TryInto<tonic::transport::Endpoint>,
540            D::Error: Into<StdError>,
541        {
542            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
543            Ok(Self::new(conn))
544        }
545    }
546    impl<T> QueryClient<T>
547    where
548        T: tonic::client::GrpcService<tonic::body::BoxBody>,
549        T::Error: Into<StdError>,
550        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
551        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
552    {
553        pub fn new(inner: T) -> Self {
554            let inner = tonic::client::Grpc::new(inner);
555            Self { inner }
556        }
557        pub fn with_origin(inner: T, origin: Uri) -> Self {
558            let inner = tonic::client::Grpc::with_origin(inner, origin);
559            Self { inner }
560        }
561        pub fn with_interceptor<F>(
562            inner: T,
563            interceptor: F,
564        ) -> QueryClient<InterceptedService<T, F>>
565        where
566            F: tonic::service::Interceptor,
567            T::ResponseBody: Default,
568            T: tonic::codegen::Service<
569                http::Request<tonic::body::BoxBody>,
570                Response = http::Response<
571                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
572                >,
573            >,
574            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
575                Into<StdError> + Send + Sync,
576        {
577            QueryClient::new(InterceptedService::new(inner, interceptor))
578        }
579        /// Compress requests with the given encoding.
580        ///
581        /// This requires the server to support it otherwise it might respond with an
582        /// error.
583        #[must_use]
584        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
585            self.inner = self.inner.send_compressed(encoding);
586            self
587        }
588        /// Enable decompressing responses.
589        #[must_use]
590        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
591            self.inner = self.inner.accept_compressed(encoding);
592            self
593        }
594        /// Returns list of `Authorization`, granted to the grantee by the granter.
595        pub async fn grants(
596            &mut self,
597            request: impl tonic::IntoRequest<super::QueryGrantsRequest>,
598        ) -> Result<tonic::Response<super::QueryGrantsResponse>, tonic::Status> {
599            self.inner.ready().await.map_err(|e| {
600                tonic::Status::new(
601                    tonic::Code::Unknown,
602                    format!("Service was not ready: {}", e.into()),
603                )
604            })?;
605            let codec = tonic::codec::ProstCodec::default();
606            let path = http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Query/Grants");
607            self.inner.unary(request.into_request(), path, codec).await
608        }
609        /// GranterGrants returns list of `GrantAuthorization`, granted by granter.
610        ///
611        /// Since: cosmos-sdk 0.45.2
612        pub async fn granter_grants(
613            &mut self,
614            request: impl tonic::IntoRequest<super::QueryGranterGrantsRequest>,
615        ) -> Result<tonic::Response<super::QueryGranterGrantsResponse>, tonic::Status> {
616            self.inner.ready().await.map_err(|e| {
617                tonic::Status::new(
618                    tonic::Code::Unknown,
619                    format!("Service was not ready: {}", e.into()),
620                )
621            })?;
622            let codec = tonic::codec::ProstCodec::default();
623            let path =
624                http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Query/GranterGrants");
625            self.inner.unary(request.into_request(), path, codec).await
626        }
627        /// GranteeGrants returns a list of `GrantAuthorization` by grantee.
628        ///
629        /// Since: cosmos-sdk 0.45.2
630        pub async fn grantee_grants(
631            &mut self,
632            request: impl tonic::IntoRequest<super::QueryGranteeGrantsRequest>,
633        ) -> Result<tonic::Response<super::QueryGranteeGrantsResponse>, tonic::Status> {
634            self.inner.ready().await.map_err(|e| {
635                tonic::Status::new(
636                    tonic::Code::Unknown,
637                    format!("Service was not ready: {}", e.into()),
638                )
639            })?;
640            let codec = tonic::codec::ProstCodec::default();
641            let path =
642                http::uri::PathAndQuery::from_static("/cosmos.authz.v1beta1.Query/GranteeGrants");
643            self.inner.unary(request.into_request(), path, codec).await
644        }
645    }
646}
647/// Generated server implementations.
648#[cfg(feature = "grpc")]
649#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
650pub mod query_server {
651    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
652    use tonic::codegen::*;
653    /// Generated trait containing gRPC methods that should be implemented for use with QueryServer.
654    #[async_trait]
655    pub trait Query: Send + Sync + 'static {
656        /// Returns list of `Authorization`, granted to the grantee by the granter.
657        async fn grants(
658            &self,
659            request: tonic::Request<super::QueryGrantsRequest>,
660        ) -> Result<tonic::Response<super::QueryGrantsResponse>, tonic::Status>;
661        /// GranterGrants returns list of `GrantAuthorization`, granted by granter.
662        ///
663        /// Since: cosmos-sdk 0.45.2
664        async fn granter_grants(
665            &self,
666            request: tonic::Request<super::QueryGranterGrantsRequest>,
667        ) -> Result<tonic::Response<super::QueryGranterGrantsResponse>, tonic::Status>;
668        /// GranteeGrants returns a list of `GrantAuthorization` by grantee.
669        ///
670        /// Since: cosmos-sdk 0.45.2
671        async fn grantee_grants(
672            &self,
673            request: tonic::Request<super::QueryGranteeGrantsRequest>,
674        ) -> Result<tonic::Response<super::QueryGranteeGrantsResponse>, tonic::Status>;
675    }
676    /// Query defines the gRPC querier service.
677    #[derive(Debug)]
678    pub struct QueryServer<T: Query> {
679        inner: _Inner<T>,
680        accept_compression_encodings: EnabledCompressionEncodings,
681        send_compression_encodings: EnabledCompressionEncodings,
682    }
683    struct _Inner<T>(Arc<T>);
684    impl<T: Query> QueryServer<T> {
685        pub fn new(inner: T) -> Self {
686            Self::from_arc(Arc::new(inner))
687        }
688        pub fn from_arc(inner: Arc<T>) -> Self {
689            let inner = _Inner(inner);
690            Self {
691                inner,
692                accept_compression_encodings: Default::default(),
693                send_compression_encodings: Default::default(),
694            }
695        }
696        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
697        where
698            F: tonic::service::Interceptor,
699        {
700            InterceptedService::new(Self::new(inner), interceptor)
701        }
702        /// Enable decompressing requests with the given encoding.
703        #[must_use]
704        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
705            self.accept_compression_encodings.enable(encoding);
706            self
707        }
708        /// Compress responses with the given encoding, if the client supports it.
709        #[must_use]
710        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
711            self.send_compression_encodings.enable(encoding);
712            self
713        }
714    }
715    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
716    where
717        T: Query,
718        B: Body + Send + 'static,
719        B::Error: Into<StdError> + Send + 'static,
720    {
721        type Response = http::Response<tonic::body::BoxBody>;
722        type Error = std::convert::Infallible;
723        type Future = BoxFuture<Self::Response, Self::Error>;
724        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
725            Poll::Ready(Ok(()))
726        }
727        fn call(&mut self, req: http::Request<B>) -> Self::Future {
728            let inner = self.inner.clone();
729            match req.uri().path() {
730                "/cosmos.authz.v1beta1.Query/Grants" => {
731                    #[allow(non_camel_case_types)]
732                    struct GrantsSvc<T: Query>(pub Arc<T>);
733                    impl<T: Query> tonic::server::UnaryService<super::QueryGrantsRequest> for GrantsSvc<T> {
734                        type Response = super::QueryGrantsResponse;
735                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
736                        fn call(
737                            &mut self,
738                            request: tonic::Request<super::QueryGrantsRequest>,
739                        ) -> Self::Future {
740                            let inner = self.0.clone();
741                            let fut = async move { (*inner).grants(request).await };
742                            Box::pin(fut)
743                        }
744                    }
745                    let accept_compression_encodings = self.accept_compression_encodings;
746                    let send_compression_encodings = self.send_compression_encodings;
747                    let inner = self.inner.clone();
748                    let fut = async move {
749                        let inner = inner.0;
750                        let method = GrantsSvc(inner);
751                        let codec = tonic::codec::ProstCodec::default();
752                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
753                            accept_compression_encodings,
754                            send_compression_encodings,
755                        );
756                        let res = grpc.unary(method, req).await;
757                        Ok(res)
758                    };
759                    Box::pin(fut)
760                }
761                "/cosmos.authz.v1beta1.Query/GranterGrants" => {
762                    #[allow(non_camel_case_types)]
763                    struct GranterGrantsSvc<T: Query>(pub Arc<T>);
764                    impl<T: Query> tonic::server::UnaryService<super::QueryGranterGrantsRequest>
765                        for GranterGrantsSvc<T>
766                    {
767                        type Response = super::QueryGranterGrantsResponse;
768                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
769                        fn call(
770                            &mut self,
771                            request: tonic::Request<super::QueryGranterGrantsRequest>,
772                        ) -> Self::Future {
773                            let inner = self.0.clone();
774                            let fut = async move { (*inner).granter_grants(request).await };
775                            Box::pin(fut)
776                        }
777                    }
778                    let accept_compression_encodings = self.accept_compression_encodings;
779                    let send_compression_encodings = self.send_compression_encodings;
780                    let inner = self.inner.clone();
781                    let fut = async move {
782                        let inner = inner.0;
783                        let method = GranterGrantsSvc(inner);
784                        let codec = tonic::codec::ProstCodec::default();
785                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
786                            accept_compression_encodings,
787                            send_compression_encodings,
788                        );
789                        let res = grpc.unary(method, req).await;
790                        Ok(res)
791                    };
792                    Box::pin(fut)
793                }
794                "/cosmos.authz.v1beta1.Query/GranteeGrants" => {
795                    #[allow(non_camel_case_types)]
796                    struct GranteeGrantsSvc<T: Query>(pub Arc<T>);
797                    impl<T: Query> tonic::server::UnaryService<super::QueryGranteeGrantsRequest>
798                        for GranteeGrantsSvc<T>
799                    {
800                        type Response = super::QueryGranteeGrantsResponse;
801                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
802                        fn call(
803                            &mut self,
804                            request: tonic::Request<super::QueryGranteeGrantsRequest>,
805                        ) -> Self::Future {
806                            let inner = self.0.clone();
807                            let fut = async move { (*inner).grantee_grants(request).await };
808                            Box::pin(fut)
809                        }
810                    }
811                    let accept_compression_encodings = self.accept_compression_encodings;
812                    let send_compression_encodings = self.send_compression_encodings;
813                    let inner = self.inner.clone();
814                    let fut = async move {
815                        let inner = inner.0;
816                        let method = GranteeGrantsSvc(inner);
817                        let codec = tonic::codec::ProstCodec::default();
818                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
819                            accept_compression_encodings,
820                            send_compression_encodings,
821                        );
822                        let res = grpc.unary(method, req).await;
823                        Ok(res)
824                    };
825                    Box::pin(fut)
826                }
827                _ => Box::pin(async move {
828                    Ok(http::Response::builder()
829                        .status(200)
830                        .header("grpc-status", "12")
831                        .header("content-type", "application/grpc")
832                        .body(empty_body())
833                        .unwrap())
834                }),
835            }
836        }
837    }
838    impl<T: Query> Clone for QueryServer<T> {
839        fn clone(&self) -> Self {
840            let inner = self.inner.clone();
841            Self {
842                inner,
843                accept_compression_encodings: self.accept_compression_encodings,
844                send_compression_encodings: self.send_compression_encodings,
845            }
846        }
847    }
848    impl<T: Query> Clone for _Inner<T> {
849        fn clone(&self) -> Self {
850            Self(self.0.clone())
851        }
852    }
853    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
854        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
855            write!(f, "{:?}", self.0)
856        }
857    }
858    impl<T: Query> tonic::server::NamedService for QueryServer<T> {
859        const NAME: &'static str = "cosmos.authz.v1beta1.Query";
860    }
861}
862/// GenesisState defines the authz module's genesis state.
863#[allow(clippy::derive_partial_eq_without_eq)]
864#[derive(Clone, PartialEq, ::prost::Message)]
865pub struct GenesisState {
866    #[prost(message, repeated, tag = "1")]
867    pub authorization: ::prost::alloc::vec::Vec<GrantAuthorization>,
868}