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

1/// MsgVerifyInvariant represents a message to verify a particular invariance.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct MsgVerifyInvariant {
5    #[prost(string, tag = "1")]
6    pub sender: ::prost::alloc::string::String,
7    #[prost(string, tag = "2")]
8    pub invariant_module_name: ::prost::alloc::string::String,
9    #[prost(string, tag = "3")]
10    pub invariant_route: ::prost::alloc::string::String,
11}
12/// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.
13#[allow(clippy::derive_partial_eq_without_eq)]
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct MsgVerifyInvariantResponse {}
16/// Generated client implementations.
17#[cfg(feature = "grpc")]
18#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
19pub mod msg_client {
20    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
21    use tonic::codegen::http::Uri;
22    use tonic::codegen::*;
23    /// Msg defines the bank Msg service.
24    #[derive(Debug, Clone)]
25    pub struct MsgClient<T> {
26        inner: tonic::client::Grpc<T>,
27    }
28    #[cfg(feature = "grpc-transport")]
29    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
30    impl MsgClient<tonic::transport::Channel> {
31        /// Attempt to create a new client by connecting to a given endpoint.
32        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
33        where
34            D: std::convert::TryInto<tonic::transport::Endpoint>,
35            D::Error: Into<StdError>,
36        {
37            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
38            Ok(Self::new(conn))
39        }
40    }
41    impl<T> MsgClient<T>
42    where
43        T: tonic::client::GrpcService<tonic::body::BoxBody>,
44        T::Error: Into<StdError>,
45        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
46        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
47    {
48        pub fn new(inner: T) -> Self {
49            let inner = tonic::client::Grpc::new(inner);
50            Self { inner }
51        }
52        pub fn with_origin(inner: T, origin: Uri) -> Self {
53            let inner = tonic::client::Grpc::with_origin(inner, origin);
54            Self { inner }
55        }
56        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
57        where
58            F: tonic::service::Interceptor,
59            T::ResponseBody: Default,
60            T: tonic::codegen::Service<
61                http::Request<tonic::body::BoxBody>,
62                Response = http::Response<
63                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
64                >,
65            >,
66            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
67                Into<StdError> + Send + Sync,
68        {
69            MsgClient::new(InterceptedService::new(inner, interceptor))
70        }
71        /// Compress requests with the given encoding.
72        ///
73        /// This requires the server to support it otherwise it might respond with an
74        /// error.
75        #[must_use]
76        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
77            self.inner = self.inner.send_compressed(encoding);
78            self
79        }
80        /// Enable decompressing responses.
81        #[must_use]
82        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
83            self.inner = self.inner.accept_compressed(encoding);
84            self
85        }
86        /// VerifyInvariant defines a method to verify a particular invariance.
87        pub async fn verify_invariant(
88            &mut self,
89            request: impl tonic::IntoRequest<super::MsgVerifyInvariant>,
90        ) -> Result<tonic::Response<super::MsgVerifyInvariantResponse>, tonic::Status> {
91            self.inner.ready().await.map_err(|e| {
92                tonic::Status::new(
93                    tonic::Code::Unknown,
94                    format!("Service was not ready: {}", e.into()),
95                )
96            })?;
97            let codec = tonic::codec::ProstCodec::default();
98            let path =
99                http::uri::PathAndQuery::from_static("/cosmos.crisis.v1beta1.Msg/VerifyInvariant");
100            self.inner.unary(request.into_request(), path, codec).await
101        }
102    }
103}
104/// Generated server implementations.
105#[cfg(feature = "grpc")]
106#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
107pub mod msg_server {
108    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
109    use tonic::codegen::*;
110    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
111    #[async_trait]
112    pub trait Msg: Send + Sync + 'static {
113        /// VerifyInvariant defines a method to verify a particular invariance.
114        async fn verify_invariant(
115            &self,
116            request: tonic::Request<super::MsgVerifyInvariant>,
117        ) -> Result<tonic::Response<super::MsgVerifyInvariantResponse>, tonic::Status>;
118    }
119    /// Msg defines the bank Msg service.
120    #[derive(Debug)]
121    pub struct MsgServer<T: Msg> {
122        inner: _Inner<T>,
123        accept_compression_encodings: EnabledCompressionEncodings,
124        send_compression_encodings: EnabledCompressionEncodings,
125    }
126    struct _Inner<T>(Arc<T>);
127    impl<T: Msg> MsgServer<T> {
128        pub fn new(inner: T) -> Self {
129            Self::from_arc(Arc::new(inner))
130        }
131        pub fn from_arc(inner: Arc<T>) -> Self {
132            let inner = _Inner(inner);
133            Self {
134                inner,
135                accept_compression_encodings: Default::default(),
136                send_compression_encodings: Default::default(),
137            }
138        }
139        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
140        where
141            F: tonic::service::Interceptor,
142        {
143            InterceptedService::new(Self::new(inner), interceptor)
144        }
145        /// Enable decompressing requests with the given encoding.
146        #[must_use]
147        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
148            self.accept_compression_encodings.enable(encoding);
149            self
150        }
151        /// Compress responses with the given encoding, if the client supports it.
152        #[must_use]
153        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
154            self.send_compression_encodings.enable(encoding);
155            self
156        }
157    }
158    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
159    where
160        T: Msg,
161        B: Body + Send + 'static,
162        B::Error: Into<StdError> + Send + 'static,
163    {
164        type Response = http::Response<tonic::body::BoxBody>;
165        type Error = std::convert::Infallible;
166        type Future = BoxFuture<Self::Response, Self::Error>;
167        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
168            Poll::Ready(Ok(()))
169        }
170        fn call(&mut self, req: http::Request<B>) -> Self::Future {
171            let inner = self.inner.clone();
172            match req.uri().path() {
173                "/cosmos.crisis.v1beta1.Msg/VerifyInvariant" => {
174                    #[allow(non_camel_case_types)]
175                    struct VerifyInvariantSvc<T: Msg>(pub Arc<T>);
176                    impl<T: Msg> tonic::server::UnaryService<super::MsgVerifyInvariant> for VerifyInvariantSvc<T> {
177                        type Response = super::MsgVerifyInvariantResponse;
178                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
179                        fn call(
180                            &mut self,
181                            request: tonic::Request<super::MsgVerifyInvariant>,
182                        ) -> Self::Future {
183                            let inner = self.0.clone();
184                            let fut = async move { (*inner).verify_invariant(request).await };
185                            Box::pin(fut)
186                        }
187                    }
188                    let accept_compression_encodings = self.accept_compression_encodings;
189                    let send_compression_encodings = self.send_compression_encodings;
190                    let inner = self.inner.clone();
191                    let fut = async move {
192                        let inner = inner.0;
193                        let method = VerifyInvariantSvc(inner);
194                        let codec = tonic::codec::ProstCodec::default();
195                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
196                            accept_compression_encodings,
197                            send_compression_encodings,
198                        );
199                        let res = grpc.unary(method, req).await;
200                        Ok(res)
201                    };
202                    Box::pin(fut)
203                }
204                _ => Box::pin(async move {
205                    Ok(http::Response::builder()
206                        .status(200)
207                        .header("grpc-status", "12")
208                        .header("content-type", "application/grpc")
209                        .body(empty_body())
210                        .unwrap())
211                }),
212            }
213        }
214    }
215    impl<T: Msg> Clone for MsgServer<T> {
216        fn clone(&self) -> Self {
217            let inner = self.inner.clone();
218            Self {
219                inner,
220                accept_compression_encodings: self.accept_compression_encodings,
221                send_compression_encodings: self.send_compression_encodings,
222            }
223        }
224    }
225    impl<T: Msg> Clone for _Inner<T> {
226        fn clone(&self) -> Self {
227            Self(self.0.clone())
228        }
229    }
230    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
231        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
232            write!(f, "{:?}", self.0)
233        }
234    }
235    impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
236        const NAME: &'static str = "cosmos.crisis.v1beta1.Msg";
237    }
238}
239/// GenesisState defines the crisis module's genesis state.
240#[allow(clippy::derive_partial_eq_without_eq)]
241#[derive(Clone, PartialEq, ::prost::Message)]
242pub struct GenesisState {
243    /// constant_fee is the fee used to verify the invariant in the crisis
244    /// module.
245    #[prost(message, optional, tag = "3")]
246    pub constant_fee: ::core::option::Option<super::super::base::v1beta1::Coin>,
247}