/// ModuleDescriptor describes an app module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleDescriptor { /// go_import names the package that should be imported by an app to load the /// module in the runtime module registry. It is required to make debugging /// of configuration errors easier for users. #[prost(string, tag = "1")] pub go_import: ::prost::alloc::string::String, /// use_package refers to a protobuf package that this module /// uses and exposes to the world. In an app, only one module should "use" /// or own a single protobuf package. It is assumed that the module uses /// all of the .proto files in a single package. #[prost(message, repeated, tag = "2")] pub use_package: ::prost::alloc::vec::Vec, /// can_migrate_from defines which module versions this module can migrate /// state from. The framework will check that one module version is able to /// migrate from a previous module version before attempting to update its /// config. It is assumed that modules can transitively migrate from earlier /// versions. For instance if v3 declares it can migrate from v2, and v2 /// declares it can migrate from v1, the framework knows how to migrate /// from v1 to v3, assuming all 3 module versions are registered at runtime. #[prost(message, repeated, tag = "3")] pub can_migrate_from: ::prost::alloc::vec::Vec, } /// PackageReference is a reference to a protobuf package used by a module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackageReference { /// name is the fully-qualified name of the package. #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, /// revision is the optional revision of the package that is being used. /// Protobuf packages used in Cosmos should generally have a major version /// as the last part of the package name, ex. foo.bar.baz.v1. /// The revision of a package can be thought of as the minor version of a /// package which has additional backwards compatible definitions that weren't /// present in a previous version. /// /// A package should indicate its revision with a source code comment /// above the package declaration in one of its files containing the /// text "Revision N" where N is an integer revision. All packages start /// at revision 0 the first time they are released in a module. /// /// When a new version of a module is released and items are added to existing /// .proto files, these definitions should contain comments of the form /// "Since Revision N" where N is an integer revision. /// /// When the module runtime starts up, it will check the pinned proto /// image and panic if there are runtime protobuf definitions that are not /// in the pinned descriptor which do not have /// a "Since Revision N" comment or have a "Since Revision N" comment where /// N is <= to the revision specified here. This indicates that the protobuf /// files have been updated, but the pinned file descriptor hasn't. /// /// If there are items in the pinned file descriptor with a revision /// greater than the value indicated here, this will also cause a panic /// as it may mean that the pinned descriptor for a legacy module has been /// improperly updated or that there is some other versioning discrepancy. /// Runtime protobuf definitions will also be checked for compatibility /// with pinned file descriptors to make sure there are no incompatible changes. /// /// This behavior ensures that: /// * pinned proto images are up-to-date /// * protobuf files are carefully annotated with revision comments which /// are important good client UX /// * protobuf files are changed in backwards and forwards compatible ways #[prost(uint32, tag = "2")] pub revision: u32, } /// MigrateFromInfo is information on a module version that a newer module /// can migrate from. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MigrateFromInfo { /// module is the fully-qualified protobuf name of the module config object /// for the previous module version, ex: "cosmos.group.module.v1.Module". #[prost(string, tag = "1")] pub module: ::prost::alloc::string::String, } /// Config represents the configuration for a Cosmos SDK ABCI app. /// It is intended that all state machine logic including the version of /// baseapp and tx handlers (and possibly even Tendermint) that an app needs /// can be described in a config object. For compatibility, the framework should /// allow a mixture of declarative and imperative app wiring, however, apps /// that strive for the maximum ease of maintainability should be able to describe /// their state machine with a config object alone. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Config { /// modules are the module configurations for the app. #[prost(message, repeated, tag = "1")] pub modules: ::prost::alloc::vec::Vec, /// golang_bindings specifies explicit interface to implementation type bindings which /// depinject uses to resolve interface inputs to provider functions. The scope of this /// field's configuration is global (not module specific). #[prost(message, repeated, tag = "2")] pub golang_bindings: ::prost::alloc::vec::Vec, } /// ModuleConfig is a module configuration for an app. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleConfig { /// name is the unique name of the module within the app. It should be a name /// that persists between different versions of a module so that modules /// can be smoothly upgraded to new versions. /// /// For example, for the module cosmos.bank.module.v1.Module, we may chose /// to simply name the module "bank" in the app. When we upgrade to /// cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same /// and the framework knows that the v2 module should receive all the same state /// that the v1 module had. Note: modules should provide info on which versions /// they can migrate from in the ModuleDescriptor.can_migration_from field. #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, /// config is the config object for the module. Module config messages should /// define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. #[prost(message, optional, tag = "2")] pub config: ::core::option::Option<::prost_types::Any>, /// golang_bindings specifies explicit interface to implementation type bindings which /// depinject uses to resolve interface inputs to provider functions. The scope of this /// field's configuration is module specific. #[prost(message, repeated, tag = "3")] pub golang_bindings: ::prost::alloc::vec::Vec, } /// GolangBinding is an explicit interface type to implementing type binding for dependency injection. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GolangBinding { /// interface_type is the interface type which will be bound to a specific implementation type #[prost(string, tag = "1")] pub interface_type: ::prost::alloc::string::String, /// implementation is the implementing type which will be supplied when an input of type interface is requested #[prost(string, tag = "2")] pub implementation: ::prost::alloc::string::String, } /// QueryConfigRequest is the Query/Config request type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConfigRequest {} /// QueryConfigRequest is the Query/Config response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConfigResponse { /// config is the current app config. #[prost(message, optional, tag = "1")] pub config: ::core::option::Option, } /// Generated client implementations. #[cfg(feature = "grpc")] #[cfg_attr(docsrs, doc(cfg(feature = "grpc")))] pub mod query_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::http::Uri; use tonic::codegen::*; /// Query is the app module query service. #[derive(Debug, Clone)] pub struct QueryClient { inner: tonic::client::Grpc, } #[cfg(feature = "grpc-transport")] #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))] impl QueryClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl QueryClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> QueryClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, >>::Error: Into + Send + Sync, { QueryClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Config returns the current app config. pub async fn config( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/cosmos.app.v1alpha1.Query/Config"); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. #[cfg(feature = "grpc")] #[cfg_attr(docsrs, doc(cfg(feature = "grpc")))] pub mod query_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with QueryServer. #[async_trait] pub trait Query: Send + Sync + 'static { /// Config returns the current app config. async fn config( &self, request: tonic::Request, ) -> Result, tonic::Status>; } /// Query is the app module query service. #[derive(Debug)] pub struct QueryServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl QueryServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for QueryServer where T: Query, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/cosmos.app.v1alpha1.Query/Config" => { #[allow(non_camel_case_types)] struct ConfigSvc(pub Arc); impl tonic::server::UnaryService for ConfigSvc { type Response = super::QueryConfigResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).config(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = ConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => Box::pin(async move { Ok(http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap()) }), } } } impl Clone for QueryServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for QueryServer { const NAME: &'static str = "cosmos.app.v1alpha1.Query"; } }