1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Plan {
5 #[prost(string, tag = "1")]
13 pub name: ::prost::alloc::string::String,
14 #[deprecated]
18 #[prost(message, optional, tag = "2")]
19 pub time: ::core::option::Option<::prost_types::Timestamp>,
20 #[prost(int64, tag = "3")]
23 pub height: i64,
24 #[prost(string, tag = "4")]
27 pub info: ::prost::alloc::string::String,
28 #[deprecated]
32 #[prost(message, optional, tag = "5")]
33 pub upgraded_client_state: ::core::option::Option<::prost_types::Any>,
34}
35#[allow(clippy::derive_partial_eq_without_eq)]
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct SoftwareUpgradeProposal {
40 #[prost(string, tag = "1")]
41 pub title: ::prost::alloc::string::String,
42 #[prost(string, tag = "2")]
43 pub description: ::prost::alloc::string::String,
44 #[prost(message, optional, tag = "3")]
45 pub plan: ::core::option::Option<Plan>,
46}
47#[allow(clippy::derive_partial_eq_without_eq)]
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct CancelSoftwareUpgradeProposal {
52 #[prost(string, tag = "1")]
53 pub title: ::prost::alloc::string::String,
54 #[prost(string, tag = "2")]
55 pub description: ::prost::alloc::string::String,
56}
57#[allow(clippy::derive_partial_eq_without_eq)]
61#[derive(Clone, PartialEq, ::prost::Message)]
62pub struct ModuleVersion {
63 #[prost(string, tag = "1")]
65 pub name: ::prost::alloc::string::String,
66 #[prost(uint64, tag = "2")]
68 pub version: u64,
69}
70#[allow(clippy::derive_partial_eq_without_eq)]
73#[derive(Clone, PartialEq, ::prost::Message)]
74pub struct QueryCurrentPlanRequest {}
75#[allow(clippy::derive_partial_eq_without_eq)]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct QueryCurrentPlanResponse {
80 #[prost(message, optional, tag = "1")]
82 pub plan: ::core::option::Option<Plan>,
83}
84#[allow(clippy::derive_partial_eq_without_eq)]
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct QueryAppliedPlanRequest {
89 #[prost(string, tag = "1")]
91 pub name: ::prost::alloc::string::String,
92}
93#[allow(clippy::derive_partial_eq_without_eq)]
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct QueryAppliedPlanResponse {
98 #[prost(int64, tag = "1")]
100 pub height: i64,
101}
102#[allow(clippy::derive_partial_eq_without_eq)]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct QueryUpgradedConsensusStateRequest {
107 #[prost(int64, tag = "1")]
110 pub last_height: i64,
111}
112#[allow(clippy::derive_partial_eq_without_eq)]
115#[derive(Clone, PartialEq, ::prost::Message)]
116pub struct QueryUpgradedConsensusStateResponse {
117 #[prost(bytes = "vec", tag = "2")]
119 pub upgraded_consensus_state: ::prost::alloc::vec::Vec<u8>,
120}
121#[allow(clippy::derive_partial_eq_without_eq)]
126#[derive(Clone, PartialEq, ::prost::Message)]
127pub struct QueryModuleVersionsRequest {
128 #[prost(string, tag = "1")]
132 pub module_name: ::prost::alloc::string::String,
133}
134#[allow(clippy::derive_partial_eq_without_eq)]
139#[derive(Clone, PartialEq, ::prost::Message)]
140pub struct QueryModuleVersionsResponse {
141 #[prost(message, repeated, tag = "1")]
143 pub module_versions: ::prost::alloc::vec::Vec<ModuleVersion>,
144}
145#[cfg(feature = "grpc")]
147#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
148pub mod query_client {
149 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
150 use tonic::codegen::http::Uri;
151 use tonic::codegen::*;
152 #[derive(Debug, Clone)]
154 pub struct QueryClient<T> {
155 inner: tonic::client::Grpc<T>,
156 }
157 #[cfg(feature = "grpc-transport")]
158 #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
159 impl QueryClient<tonic::transport::Channel> {
160 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
162 where
163 D: std::convert::TryInto<tonic::transport::Endpoint>,
164 D::Error: Into<StdError>,
165 {
166 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
167 Ok(Self::new(conn))
168 }
169 }
170 impl<T> QueryClient<T>
171 where
172 T: tonic::client::GrpcService<tonic::body::BoxBody>,
173 T::Error: Into<StdError>,
174 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
175 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
176 {
177 pub fn new(inner: T) -> Self {
178 let inner = tonic::client::Grpc::new(inner);
179 Self { inner }
180 }
181 pub fn with_origin(inner: T, origin: Uri) -> Self {
182 let inner = tonic::client::Grpc::with_origin(inner, origin);
183 Self { inner }
184 }
185 pub fn with_interceptor<F>(
186 inner: T,
187 interceptor: F,
188 ) -> QueryClient<InterceptedService<T, F>>
189 where
190 F: tonic::service::Interceptor,
191 T::ResponseBody: Default,
192 T: tonic::codegen::Service<
193 http::Request<tonic::body::BoxBody>,
194 Response = http::Response<
195 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
196 >,
197 >,
198 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
199 Into<StdError> + Send + Sync,
200 {
201 QueryClient::new(InterceptedService::new(inner, interceptor))
202 }
203 #[must_use]
208 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
209 self.inner = self.inner.send_compressed(encoding);
210 self
211 }
212 #[must_use]
214 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
215 self.inner = self.inner.accept_compressed(encoding);
216 self
217 }
218 pub async fn current_plan(
220 &mut self,
221 request: impl tonic::IntoRequest<super::QueryCurrentPlanRequest>,
222 ) -> Result<tonic::Response<super::QueryCurrentPlanResponse>, tonic::Status> {
223 self.inner.ready().await.map_err(|e| {
224 tonic::Status::new(
225 tonic::Code::Unknown,
226 format!("Service was not ready: {}", e.into()),
227 )
228 })?;
229 let codec = tonic::codec::ProstCodec::default();
230 let path =
231 http::uri::PathAndQuery::from_static("/cosmos.upgrade.v1beta1.Query/CurrentPlan");
232 self.inner.unary(request.into_request(), path, codec).await
233 }
234 pub async fn applied_plan(
236 &mut self,
237 request: impl tonic::IntoRequest<super::QueryAppliedPlanRequest>,
238 ) -> Result<tonic::Response<super::QueryAppliedPlanResponse>, tonic::Status> {
239 self.inner.ready().await.map_err(|e| {
240 tonic::Status::new(
241 tonic::Code::Unknown,
242 format!("Service was not ready: {}", e.into()),
243 )
244 })?;
245 let codec = tonic::codec::ProstCodec::default();
246 let path =
247 http::uri::PathAndQuery::from_static("/cosmos.upgrade.v1beta1.Query/AppliedPlan");
248 self.inner.unary(request.into_request(), path, codec).await
249 }
250 pub async fn upgraded_consensus_state(
257 &mut self,
258 request: impl tonic::IntoRequest<super::QueryUpgradedConsensusStateRequest>,
259 ) -> Result<tonic::Response<super::QueryUpgradedConsensusStateResponse>, tonic::Status>
260 {
261 self.inner.ready().await.map_err(|e| {
262 tonic::Status::new(
263 tonic::Code::Unknown,
264 format!("Service was not ready: {}", e.into()),
265 )
266 })?;
267 let codec = tonic::codec::ProstCodec::default();
268 let path = http::uri::PathAndQuery::from_static(
269 "/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState",
270 );
271 self.inner.unary(request.into_request(), path, codec).await
272 }
273 pub async fn module_versions(
277 &mut self,
278 request: impl tonic::IntoRequest<super::QueryModuleVersionsRequest>,
279 ) -> Result<tonic::Response<super::QueryModuleVersionsResponse>, tonic::Status> {
280 self.inner.ready().await.map_err(|e| {
281 tonic::Status::new(
282 tonic::Code::Unknown,
283 format!("Service was not ready: {}", e.into()),
284 )
285 })?;
286 let codec = tonic::codec::ProstCodec::default();
287 let path = http::uri::PathAndQuery::from_static(
288 "/cosmos.upgrade.v1beta1.Query/ModuleVersions",
289 );
290 self.inner.unary(request.into_request(), path, codec).await
291 }
292 }
293}
294#[cfg(feature = "grpc")]
296#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
297pub mod query_server {
298 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
299 use tonic::codegen::*;
300 #[async_trait]
302 pub trait Query: Send + Sync + 'static {
303 async fn current_plan(
305 &self,
306 request: tonic::Request<super::QueryCurrentPlanRequest>,
307 ) -> Result<tonic::Response<super::QueryCurrentPlanResponse>, tonic::Status>;
308 async fn applied_plan(
310 &self,
311 request: tonic::Request<super::QueryAppliedPlanRequest>,
312 ) -> Result<tonic::Response<super::QueryAppliedPlanResponse>, tonic::Status>;
313 async fn upgraded_consensus_state(
320 &self,
321 request: tonic::Request<super::QueryUpgradedConsensusStateRequest>,
322 ) -> Result<tonic::Response<super::QueryUpgradedConsensusStateResponse>, tonic::Status>;
323 async fn module_versions(
327 &self,
328 request: tonic::Request<super::QueryModuleVersionsRequest>,
329 ) -> Result<tonic::Response<super::QueryModuleVersionsResponse>, tonic::Status>;
330 }
331 #[derive(Debug)]
333 pub struct QueryServer<T: Query> {
334 inner: _Inner<T>,
335 accept_compression_encodings: EnabledCompressionEncodings,
336 send_compression_encodings: EnabledCompressionEncodings,
337 }
338 struct _Inner<T>(Arc<T>);
339 impl<T: Query> QueryServer<T> {
340 pub fn new(inner: T) -> Self {
341 Self::from_arc(Arc::new(inner))
342 }
343 pub fn from_arc(inner: Arc<T>) -> Self {
344 let inner = _Inner(inner);
345 Self {
346 inner,
347 accept_compression_encodings: Default::default(),
348 send_compression_encodings: Default::default(),
349 }
350 }
351 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
352 where
353 F: tonic::service::Interceptor,
354 {
355 InterceptedService::new(Self::new(inner), interceptor)
356 }
357 #[must_use]
359 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
360 self.accept_compression_encodings.enable(encoding);
361 self
362 }
363 #[must_use]
365 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
366 self.send_compression_encodings.enable(encoding);
367 self
368 }
369 }
370 impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
371 where
372 T: Query,
373 B: Body + Send + 'static,
374 B::Error: Into<StdError> + Send + 'static,
375 {
376 type Response = http::Response<tonic::body::BoxBody>;
377 type Error = std::convert::Infallible;
378 type Future = BoxFuture<Self::Response, Self::Error>;
379 fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
380 Poll::Ready(Ok(()))
381 }
382 fn call(&mut self, req: http::Request<B>) -> Self::Future {
383 let inner = self.inner.clone();
384 match req.uri().path() {
385 "/cosmos.upgrade.v1beta1.Query/CurrentPlan" => {
386 #[allow(non_camel_case_types)]
387 struct CurrentPlanSvc<T: Query>(pub Arc<T>);
388 impl<T: Query> tonic::server::UnaryService<super::QueryCurrentPlanRequest> for CurrentPlanSvc<T> {
389 type Response = super::QueryCurrentPlanResponse;
390 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
391 fn call(
392 &mut self,
393 request: tonic::Request<super::QueryCurrentPlanRequest>,
394 ) -> Self::Future {
395 let inner = self.0.clone();
396 let fut = async move { (*inner).current_plan(request).await };
397 Box::pin(fut)
398 }
399 }
400 let accept_compression_encodings = self.accept_compression_encodings;
401 let send_compression_encodings = self.send_compression_encodings;
402 let inner = self.inner.clone();
403 let fut = async move {
404 let inner = inner.0;
405 let method = CurrentPlanSvc(inner);
406 let codec = tonic::codec::ProstCodec::default();
407 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
408 accept_compression_encodings,
409 send_compression_encodings,
410 );
411 let res = grpc.unary(method, req).await;
412 Ok(res)
413 };
414 Box::pin(fut)
415 }
416 "/cosmos.upgrade.v1beta1.Query/AppliedPlan" => {
417 #[allow(non_camel_case_types)]
418 struct AppliedPlanSvc<T: Query>(pub Arc<T>);
419 impl<T: Query> tonic::server::UnaryService<super::QueryAppliedPlanRequest> for AppliedPlanSvc<T> {
420 type Response = super::QueryAppliedPlanResponse;
421 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
422 fn call(
423 &mut self,
424 request: tonic::Request<super::QueryAppliedPlanRequest>,
425 ) -> Self::Future {
426 let inner = self.0.clone();
427 let fut = async move { (*inner).applied_plan(request).await };
428 Box::pin(fut)
429 }
430 }
431 let accept_compression_encodings = self.accept_compression_encodings;
432 let send_compression_encodings = self.send_compression_encodings;
433 let inner = self.inner.clone();
434 let fut = async move {
435 let inner = inner.0;
436 let method = AppliedPlanSvc(inner);
437 let codec = tonic::codec::ProstCodec::default();
438 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
439 accept_compression_encodings,
440 send_compression_encodings,
441 );
442 let res = grpc.unary(method, req).await;
443 Ok(res)
444 };
445 Box::pin(fut)
446 }
447 "/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState" => {
448 #[allow(non_camel_case_types)]
449 struct UpgradedConsensusStateSvc<T: Query>(pub Arc<T>);
450 impl<T: Query>
451 tonic::server::UnaryService<super::QueryUpgradedConsensusStateRequest>
452 for UpgradedConsensusStateSvc<T>
453 {
454 type Response = super::QueryUpgradedConsensusStateResponse;
455 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
456 fn call(
457 &mut self,
458 request: tonic::Request<super::QueryUpgradedConsensusStateRequest>,
459 ) -> Self::Future {
460 let inner = self.0.clone();
461 let fut =
462 async move { (*inner).upgraded_consensus_state(request).await };
463 Box::pin(fut)
464 }
465 }
466 let accept_compression_encodings = self.accept_compression_encodings;
467 let send_compression_encodings = self.send_compression_encodings;
468 let inner = self.inner.clone();
469 let fut = async move {
470 let inner = inner.0;
471 let method = UpgradedConsensusStateSvc(inner);
472 let codec = tonic::codec::ProstCodec::default();
473 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
474 accept_compression_encodings,
475 send_compression_encodings,
476 );
477 let res = grpc.unary(method, req).await;
478 Ok(res)
479 };
480 Box::pin(fut)
481 }
482 "/cosmos.upgrade.v1beta1.Query/ModuleVersions" => {
483 #[allow(non_camel_case_types)]
484 struct ModuleVersionsSvc<T: Query>(pub Arc<T>);
485 impl<T: Query> tonic::server::UnaryService<super::QueryModuleVersionsRequest>
486 for ModuleVersionsSvc<T>
487 {
488 type Response = super::QueryModuleVersionsResponse;
489 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
490 fn call(
491 &mut self,
492 request: tonic::Request<super::QueryModuleVersionsRequest>,
493 ) -> Self::Future {
494 let inner = self.0.clone();
495 let fut = async move { (*inner).module_versions(request).await };
496 Box::pin(fut)
497 }
498 }
499 let accept_compression_encodings = self.accept_compression_encodings;
500 let send_compression_encodings = self.send_compression_encodings;
501 let inner = self.inner.clone();
502 let fut = async move {
503 let inner = inner.0;
504 let method = ModuleVersionsSvc(inner);
505 let codec = tonic::codec::ProstCodec::default();
506 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
507 accept_compression_encodings,
508 send_compression_encodings,
509 );
510 let res = grpc.unary(method, req).await;
511 Ok(res)
512 };
513 Box::pin(fut)
514 }
515 _ => Box::pin(async move {
516 Ok(http::Response::builder()
517 .status(200)
518 .header("grpc-status", "12")
519 .header("content-type", "application/grpc")
520 .body(empty_body())
521 .unwrap())
522 }),
523 }
524 }
525 }
526 impl<T: Query> Clone for QueryServer<T> {
527 fn clone(&self) -> Self {
528 let inner = self.inner.clone();
529 Self {
530 inner,
531 accept_compression_encodings: self.accept_compression_encodings,
532 send_compression_encodings: self.send_compression_encodings,
533 }
534 }
535 }
536 impl<T: Query> Clone for _Inner<T> {
537 fn clone(&self) -> Self {
538 Self(self.0.clone())
539 }
540 }
541 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
542 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
543 write!(f, "{:?}", self.0)
544 }
545 }
546 impl<T: Query> tonic::server::NamedService for QueryServer<T> {
547 const NAME: &'static str = "cosmos.upgrade.v1beta1.Query";
548 }
549}