juno_rust_proto/prost/cosmos-sdk/
cosmos.params.v1beta1.rs1#[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#[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#[allow(clippy::derive_partial_eq_without_eq)]
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct QueryParamsRequest {
28 #[prost(string, tag = "1")]
30 pub subspace: ::prost::alloc::string::String,
31 #[prost(string, tag = "2")]
33 pub key: ::prost::alloc::string::String,
34}
35#[allow(clippy::derive_partial_eq_without_eq)]
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct QueryParamsResponse {
39 #[prost(message, optional, tag = "1")]
41 pub param: ::core::option::Option<ParamChange>,
42}
43#[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 #[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 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 #[must_use]
106 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
107 self.inner = self.inner.send_compressed(encoding);
108 self
109 }
110 #[must_use]
112 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
113 self.inner = self.inner.accept_compressed(encoding);
114 self
115 }
116 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#[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 #[async_trait]
142 pub trait Query: Send + Sync + 'static {
143 async fn params(
146 &self,
147 request: tonic::Request<super::QueryParamsRequest>,
148 ) -> Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>;
149 }
150 #[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 #[must_use]
178 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
179 self.accept_compression_encodings.enable(encoding);
180 self
181 }
182 #[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}