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

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