From ae9898f4e51bd121def6f51b0868c2e50acd94f0 Mon Sep 17 00:00:00 2001 From: Davirain Date: Fri, 19 May 2023 09:30:40 +0800 Subject: [PATCH 1/2] add full cosmos type --- src/lib.rs | 142 +- src/prost/cosmos.app.module.v1alpha1.rs | 4 + src/prost/cosmos.app.v1alpha1.rs | 422 +++ src/prost/cosmos.authz.v1beta1.rs | 1139 +++++++ src/prost/cosmos.capability.v1beta1.rs | 49 + src/prost/cosmos.crisis.v1beta1.rs | 321 ++ src/prost/cosmos.crypto.ed25519.rs | 19 + src/prost/cosmos.crypto.hd.v1.rs | 21 + src/prost/cosmos.crypto.keyring.v1.rs | 61 + src/prost/cosmos.crypto.multisig.rs | 13 + src/prost/cosmos.crypto.secp256k1.rs | 18 + src/prost/cosmos.crypto.secp256r1.rs | 17 + src/prost/cosmos.distribution.v1beta1.rs | 2072 ++++++++++++ src/prost/cosmos.evidence.v1beta1.rs | 745 +++++ src/prost/cosmos.feegrant.v1beta1.rs | 1031 ++++++ src/prost/cosmos.genutil.v1beta1.rs | 8 + src/prost/cosmos.group.v1.rs | 3728 ++++++++++++++++++++++ src/prost/cosmos.mint.v1beta1.rs | 539 ++++ src/prost/cosmos.nft.v1beta1.rs | 1293 ++++++++ src/prost/cosmos.orm.module.v1alpha1.rs | 6 + src/prost/cosmos.orm.v1.rs | 92 + src/prost/cosmos.orm.v1alpha1.rs | 93 + src/prost/cosmos.params.v1beta1.rs | 450 +++ src/prost/cosmos.slashing.v1beta1.rs | 915 ++++++ src/prost/cosmos.vesting.v1beta1.rs | 619 ++++ tools/proto-compiler/src/cmd/compile.rs | 25 +- 26 files changed, 13824 insertions(+), 18 deletions(-) create mode 100644 src/prost/cosmos.app.module.v1alpha1.rs create mode 100644 src/prost/cosmos.app.v1alpha1.rs create mode 100644 src/prost/cosmos.authz.v1beta1.rs create mode 100644 src/prost/cosmos.capability.v1beta1.rs create mode 100644 src/prost/cosmos.crisis.v1beta1.rs create mode 100644 src/prost/cosmos.crypto.ed25519.rs create mode 100644 src/prost/cosmos.crypto.hd.v1.rs create mode 100644 src/prost/cosmos.crypto.keyring.v1.rs create mode 100644 src/prost/cosmos.crypto.multisig.rs create mode 100644 src/prost/cosmos.crypto.secp256k1.rs create mode 100644 src/prost/cosmos.crypto.secp256r1.rs create mode 100644 src/prost/cosmos.distribution.v1beta1.rs create mode 100644 src/prost/cosmos.feegrant.v1beta1.rs create mode 100644 src/prost/cosmos.genutil.v1beta1.rs create mode 100644 src/prost/cosmos.group.v1.rs create mode 100644 src/prost/cosmos.mint.v1beta1.rs create mode 100644 src/prost/cosmos.nft.v1beta1.rs create mode 100644 src/prost/cosmos.orm.module.v1alpha1.rs create mode 100644 src/prost/cosmos.orm.v1.rs create mode 100644 src/prost/cosmos.orm.v1alpha1.rs create mode 100644 src/prost/cosmos.params.v1beta1.rs create mode 100644 src/prost/cosmos.slashing.v1beta1.rs create mode 100644 src/prost/cosmos.vesting.v1beta1.rs diff --git a/src/lib.rs b/src/lib.rs index 01c49304..777cafe1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,69 +49,176 @@ pub mod cosmos { } } } - pub mod evidence { - pub mod v1beta1 { - include_proto!("cosmos.evidence.v1beta1.rs"); - } - } - pub mod staking { + + /// Granting of arbitrary privileges from one account to another. + pub mod authz { pub mod v1beta1 { - include_proto!("cosmos.staking.v1beta1.rs"); + include_proto!("cosmos.authz.v1beta1.rs"); } } + + /// Balances. pub mod bank { pub mod v1beta1 { include_proto!("cosmos.bank.v1beta1.rs"); } } + + /// Base functionality. pub mod base { + /// Application BlockChain Interface (ABCI). + /// + /// Interface that defines the boundary between the replication engine + /// (the blockchain), and the state machine (the application). pub mod abci { pub mod v1beta1 { include_proto!("cosmos.base.abci.v1beta1.rs"); } } + + /// Key-value pairs. pub mod kv { pub mod v1beta1 { include_proto!("cosmos.base.kv.v1beta1.rs"); } } - pub mod node { - pub mod v1beta1 { - include_proto!("cosmos.base.node.v1beta1.rs"); - } - } + + /// Query support. pub mod query { pub mod v1beta1 { include_proto!("cosmos.base.query.v1beta1.rs"); } } + + /// Reflection support. pub mod reflection { pub mod v1beta1 { include_proto!("cosmos.base.reflection.v1beta1.rs"); } + + pub mod v2alpha1 { + include_proto!("cosmos.base.reflection.v2alpha1.rs"); + } } + + /// Snapshots containing Tendermint state sync info. + pub mod snapshots { + pub mod v1beta1 { + include_proto!("cosmos.base.snapshots.v1beta1.rs"); + } + } + + /// Data structure that holds the state of the application. pub mod store { pub mod v1beta1 { include_proto!("cosmos.base.store.v1beta1.rs"); } } + pub mod v1beta1 { include_proto!("cosmos.base.v1beta1.rs"); } + pub mod tendermint { pub mod v1beta1 { include_proto!("cosmos.base.tendermint.v1beta1.rs"); } } } + + /// Crisis handling + pub mod crisis { + pub mod v1beta1 { + include_proto!("cosmos.crisis.v1beta1.rs"); + } + } + + /// Cryptographic primitives. pub mod crypto { + /// Multi-signature support. pub mod multisig { + include_proto!("cosmos.crypto.multisig.rs"); pub mod v1beta1 { include_proto!("cosmos.crypto.multisig.v1beta1.rs"); } } + pub mod ed25519 { + include_proto!("cosmos.crypto.ed25519.rs"); + } + pub mod secp256k1 { + include_proto!("cosmos.crypto.secp256k1.rs"); + } + pub mod secp256r1 { + include_proto!("cosmos.crypto.secp256r1.rs"); + } + } + + /// Messages and services handling token distribution + pub mod distribution { + pub mod v1beta1 { + include_proto!("cosmos.distribution.v1beta1.rs"); + } } + + /// Messages and services handling evidence + pub mod evidence { + pub mod v1beta1 { + include_proto!("cosmos.evidence.v1beta1.rs"); + } + } + + /// Allows accounts to grant fee allowances and to use fees from their accounts. + pub mod feegrant { + pub mod v1beta1 { + include_proto!("cosmos.feegrant.v1beta1.rs"); + } + } + + /// Messages and services handling gentx's + pub mod genutil { + pub mod v1beta1 { + include_proto!("cosmos.genutil.v1beta1.rs"); + } + } + + /// Messages and services handling governance + pub mod gov { + pub mod v1beta1 { + include_proto!("cosmos.gov.v1beta1.rs"); + } + } + + /// Messages and services handling minting + pub mod mint { + pub mod v1beta1 { + include_proto!("cosmos.mint.v1beta1.rs"); + } + } + + /// Messages and services handling chain parameters + pub mod params { + pub mod v1beta1 { + include_proto!("cosmos.params.v1beta1.rs"); + } + } + + /// Handling slashing parameters and unjailing + pub mod slashing { + pub mod v1beta1 { + include_proto!("cosmos.slashing.v1beta1.rs"); + } + } + + /// Proof-of-Stake layer for public blockchains. + pub mod staking { + pub mod v1beta1 { + include_proto!("cosmos.staking.v1beta1.rs"); + } + } + + /// Transactions. pub mod tx { + /// Transaction signing support. pub mod signing { pub mod v1beta1 { include_proto!("cosmos.tx.signing.v1beta1.rs"); @@ -121,18 +228,23 @@ pub mod cosmos { include_proto!("cosmos.tx.v1beta1.rs"); } } + + /// Services for the upgrade module. pub mod upgrade { pub mod v1beta1 { include_proto!("cosmos.upgrade.v1beta1.rs"); } } - pub mod gov { + + /// Services and tx's for the vesting module. + pub mod vesting { pub mod v1beta1 { - include_proto!("cosmos.gov.v1beta1.rs"); + include_proto!("cosmos.vesting.v1beta1.rs"); } } + pub mod ics23 { - pub use ics23 as v1; + pub use ics23 as v1; } } diff --git a/src/prost/cosmos.app.module.v1alpha1.rs b/src/prost/cosmos.app.module.v1alpha1.rs new file mode 100644 index 00000000..b5b987fd --- /dev/null +++ b/src/prost/cosmos.app.module.v1alpha1.rs @@ -0,0 +1,4 @@ +/// Module is the module config object for the cosmos.app v1 app module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module {} diff --git a/src/prost/cosmos.app.v1alpha1.rs b/src/prost/cosmos.app.v1alpha1.rs new file mode 100644 index 00000000..38f47b4e --- /dev/null +++ b/src/prost/cosmos.app.v1alpha1.rs @@ -0,0 +1,422 @@ +/// 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, +} +/// 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, +} +/// 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 = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query is the app module query service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Config returns the current app config. + pub async fn config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.app.v1alpha1.Query", "Config")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query is the app module query service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + 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 max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + 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, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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"; + } +} diff --git a/src/prost/cosmos.authz.v1beta1.rs b/src/prost/cosmos.authz.v1beta1.rs new file mode 100644 index 00000000..9d30af3f --- /dev/null +++ b/src/prost/cosmos.authz.v1beta1.rs @@ -0,0 +1,1139 @@ +/// GenericAuthorization gives the grantee unrestricted permissions to execute +/// the provided method on behalf of the granter's account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenericAuthorization { + /// Msg, identified by it's type URL, to grant unrestricted permissions to execute + #[prost(string, tag = "1")] + pub msg: ::prost::alloc::string::String, +} +/// Grant gives permissions to execute +/// the provide method with expiration time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Grant { + #[prost(message, optional, tag = "1")] + pub authorization: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, + /// time when the grant will expire and will be pruned. If null, then the grant + /// doesn't have a time expiration (other conditions in `authorization` + /// may apply to invalidate the grant) + #[prost(message, optional, tag = "2")] + pub expiration: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// GrantAuthorization extends a grant with both the addresses of the grantee and granter. +/// It is used in genesis.proto and query.proto +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GrantAuthorization { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub authorization: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, + #[prost(message, optional, tag = "4")] + pub expiration: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// GrantQueueItem contains the list of TypeURL of a sdk.Msg. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GrantQueueItem { + /// msg_type_urls contains the list of TypeURL of a sdk.Msg. + #[prost(string, repeated, tag = "1")] + pub msg_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// MsgGrant is a request type for Grant method. It declares authorization to the grantee +/// on behalf of the granter with the provided expiration time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgGrant { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub grant: ::core::option::Option, +} +/// MsgExecResponse defines the Msg/MsgExecResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExecResponse { + #[prost(bytes = "vec", repeated, tag = "1")] + pub results: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +/// MsgExec attempts to execute the provided messages using +/// authorizations granted to the grantee. Each message should have only +/// one signer corresponding to the granter of the authorization. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExec { + #[prost(string, tag = "1")] + pub grantee: ::prost::alloc::string::String, + /// Authorization Msg requests to execute. Each msg must implement Authorization interface + /// The x/authz will try to find a grant matching (msg.signers\[0\], grantee, MsgTypeURL(msg)) + /// triple and validate it. + #[prost(message, repeated, tag = "2")] + pub msgs: ::prost::alloc::vec::Vec, +} +/// MsgGrantResponse defines the Msg/MsgGrant response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgGrantResponse {} +/// MsgRevoke revokes any authorization with the provided sdk.Msg type on the +/// granter's account with that has been granted to the grantee. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRevoke { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub msg_type_url: ::prost::alloc::string::String, +} +/// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRevokeResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the authz Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Grant grants the provided authorization to the grantee on the granter's + /// account with the provided expiration time. If there is already a grant + /// for the given (granter, grantee, Authorization) triple, then the grant + /// will be overwritten. + pub async fn grant( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Msg/Grant", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Msg", "Grant")); + self.inner.unary(req, path, codec).await + } + /// Exec attempts to execute the provided messages using + /// authorizations granted to the grantee. Each message should have only + /// one signer corresponding to the granter of the authorization. + pub async fn exec( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Msg/Exec", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Msg", "Exec")); + self.inner.unary(req, path, codec).await + } + /// Revoke revokes any authorization corresponding to the provided method name on the + /// granter's account that has been granted to the grantee. + pub async fn revoke( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Msg/Revoke", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Msg", "Revoke")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// Grant grants the provided authorization to the grantee on the granter's + /// account with the provided expiration time. If there is already a grant + /// for the given (granter, grantee, Authorization) triple, then the grant + /// will be overwritten. + async fn grant( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Exec attempts to execute the provided messages using + /// authorizations granted to the grantee. Each message should have only + /// one signer corresponding to the granter of the authorization. + async fn exec( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Revoke revokes any authorization corresponding to the provided method name on the + /// granter's account that has been granted to the grantee. + async fn revoke( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the authz Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.authz.v1beta1.Msg/Grant" => { + #[allow(non_camel_case_types)] + struct GrantSvc(pub Arc); + impl tonic::server::UnaryService + for GrantSvc { + type Response = super::MsgGrantResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).grant(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GrantSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.authz.v1beta1.Msg/Exec" => { + #[allow(non_camel_case_types)] + struct ExecSvc(pub Arc); + impl tonic::server::UnaryService + for ExecSvc { + type Response = super::MsgExecResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).exec(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ExecSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.authz.v1beta1.Msg/Revoke" => { + #[allow(non_camel_case_types)] + struct RevokeSvc(pub Arc); + impl tonic::server::UnaryService + for RevokeSvc { + type Response = super::MsgRevokeResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).revoke(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = RevokeSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.authz.v1beta1.Msg"; + } +} +/// QueryGrantsRequest is the request type for the Query/Grants RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGrantsRequest { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + /// Optional, msg_type_url, when set, will query only grants matching given msg type. + #[prost(string, tag = "3")] + pub msg_type_url: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "4")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGrantsResponse is the response type for the Query/Authorizations RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGrantsResponse { + /// authorizations is a list of grants granted for grantee by granter. + #[prost(message, repeated, tag = "1")] + pub grants: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGranterGrantsRequest { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGranterGrantsResponse { + /// grants is a list of grants granted by the granter. + #[prost(message, repeated, tag = "1")] + pub grants: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGranteeGrantsRequest { + #[prost(string, tag = "1")] + pub grantee: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGranteeGrantsResponse { + /// grants is a list of grants granted to the grantee. + #[prost(message, repeated, tag = "1")] + pub grants: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Returns list of `Authorization`, granted to the grantee by the granter. + pub async fn grants( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Query/Grants", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Query", "Grants")); + self.inner.unary(req, path, codec).await + } + /// GranterGrants returns list of `GrantAuthorization`, granted by granter. + /// + /// Since: cosmos-sdk 0.46 + pub async fn granter_grants( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Query/GranterGrants", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Query", "GranterGrants")); + self.inner.unary(req, path, codec).await + } + /// GranteeGrants returns a list of `GrantAuthorization` by grantee. + /// + /// Since: cosmos-sdk 0.46 + pub async fn grantee_grants( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.authz.v1beta1.Query/GranteeGrants", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.authz.v1beta1.Query", "GranteeGrants")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Returns list of `Authorization`, granted to the grantee by the granter. + async fn grants( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GranterGrants returns list of `GrantAuthorization`, granted by granter. + /// + /// Since: cosmos-sdk 0.46 + async fn granter_grants( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GranteeGrants returns a list of `GrantAuthorization` by grantee. + /// + /// Since: cosmos-sdk 0.46 + async fn grantee_grants( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.authz.v1beta1.Query/Grants" => { + #[allow(non_camel_case_types)] + struct GrantsSvc(pub Arc); + impl tonic::server::UnaryService + for GrantsSvc { + type Response = super::QueryGrantsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).grants(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GrantsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.authz.v1beta1.Query/GranterGrants" => { + #[allow(non_camel_case_types)] + struct GranterGrantsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GranterGrantsSvc { + type Response = super::QueryGranterGrantsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).granter_grants(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GranterGrantsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.authz.v1beta1.Query/GranteeGrants" => { + #[allow(non_camel_case_types)] + struct GranteeGrantsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GranteeGrantsSvc { + type Response = super::QueryGranteeGrantsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).grantee_grants(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GranteeGrantsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.authz.v1beta1.Query"; + } +} +/// EventGrant is emitted on Msg/Grant +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventGrant { + /// Msg type URL for which an autorization is granted + #[prost(string, tag = "2")] + pub msg_type_url: ::prost::alloc::string::String, + /// Granter account address + #[prost(string, tag = "3")] + pub granter: ::prost::alloc::string::String, + /// Grantee account address + #[prost(string, tag = "4")] + pub grantee: ::prost::alloc::string::String, +} +/// EventRevoke is emitted on Msg/Revoke +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventRevoke { + /// Msg type URL for which an autorization is revoked + #[prost(string, tag = "2")] + pub msg_type_url: ::prost::alloc::string::String, + /// Granter account address + #[prost(string, tag = "3")] + pub granter: ::prost::alloc::string::String, + /// Grantee account address + #[prost(string, tag = "4")] + pub grantee: ::prost::alloc::string::String, +} +/// GenesisState defines the authz module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub authorization: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.capability.v1beta1.rs b/src/prost/cosmos.capability.v1beta1.rs new file mode 100644 index 00000000..ca0fad09 --- /dev/null +++ b/src/prost/cosmos.capability.v1beta1.rs @@ -0,0 +1,49 @@ +/// Capability defines an implementation of an object capability. The index +/// provided to a Capability must be globally unique. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Capability { + #[prost(uint64, tag = "1")] + pub index: u64, +} +/// Owner defines a single capability owner. An owner is defined by the name of +/// capability and the module name. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Owner { + #[prost(string, tag = "1")] + pub module: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +/// CapabilityOwners defines a set of owners of a single Capability. The set of +/// owners must be unique. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CapabilityOwners { + #[prost(message, repeated, tag = "1")] + pub owners: ::prost::alloc::vec::Vec, +} +/// GenesisOwners defines the capability owners with their corresponding index. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisOwners { + /// index is the index of the capability owner. + #[prost(uint64, tag = "1")] + pub index: u64, + /// index_owners are the owners at the given index. + #[prost(message, optional, tag = "2")] + pub index_owners: ::core::option::Option, +} +/// GenesisState defines the capability module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// index is the capability global index. + #[prost(uint64, tag = "1")] + pub index: u64, + /// owners represents a map from index to owners of the capability index + /// index key is string to allow amino marshalling. + #[prost(message, repeated, tag = "2")] + pub owners: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.crisis.v1beta1.rs b/src/prost/cosmos.crisis.v1beta1.rs new file mode 100644 index 00000000..e543f542 --- /dev/null +++ b/src/prost/cosmos.crisis.v1beta1.rs @@ -0,0 +1,321 @@ +/// MsgVerifyInvariant represents a message to verify a particular invariance. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgVerifyInvariant { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub invariant_module_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub invariant_route: ::prost::alloc::string::String, +} +/// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgVerifyInvariantResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the bank Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// VerifyInvariant defines a method to verify a particular invariance. + pub async fn verify_invariant( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.crisis.v1beta1.Msg/VerifyInvariant", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.crisis.v1beta1.Msg", "VerifyInvariant")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// VerifyInvariant defines a method to verify a particular invariance. + async fn verify_invariant( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the bank Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.crisis.v1beta1.Msg/VerifyInvariant" => { + #[allow(non_camel_case_types)] + struct VerifyInvariantSvc(pub Arc); + impl tonic::server::UnaryService + for VerifyInvariantSvc { + type Response = super::MsgVerifyInvariantResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).verify_invariant(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = VerifyInvariantSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.crisis.v1beta1.Msg"; + } +} +/// GenesisState defines the crisis module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// constant_fee is the fee used to verify the invariant in the crisis + /// module. + #[prost(message, optional, tag = "3")] + pub constant_fee: ::core::option::Option, +} diff --git a/src/prost/cosmos.crypto.ed25519.rs b/src/prost/cosmos.crypto.ed25519.rs new file mode 100644 index 00000000..99620e3a --- /dev/null +++ b/src/prost/cosmos.crypto.ed25519.rs @@ -0,0 +1,19 @@ +/// PubKey is an ed25519 public key for handling Tendermint keys in SDK. +/// It's needed for Any serialization and SDK compatibility. +/// It must not be used in a non Tendermint key context because it doesn't implement +/// ADR-28. Nevertheless, you will like to use ed25519 in app user level +/// then you must create a new proto message and follow ADR-28 for Address construction. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKey { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} +/// Deprecated: PrivKey defines a ed25519 private key. +/// NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivKey { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.crypto.hd.v1.rs b/src/prost/cosmos.crypto.hd.v1.rs new file mode 100644 index 00000000..65fdd3fa --- /dev/null +++ b/src/prost/cosmos.crypto.hd.v1.rs @@ -0,0 +1,21 @@ +/// BIP44Params is used as path field in ledger item in Record. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bip44Params { + /// purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation + #[prost(uint32, tag = "1")] + pub purpose: u32, + /// coin_type is a constant that improves privacy + #[prost(uint32, tag = "2")] + pub coin_type: u32, + /// account splits the key space into independent user identities + #[prost(uint32, tag = "3")] + pub account: u32, + /// change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal + /// chain. + #[prost(bool, tag = "4")] + pub change: bool, + /// address_index is used as child index in BIP32 derivation + #[prost(uint32, tag = "5")] + pub address_index: u32, +} diff --git a/src/prost/cosmos.crypto.keyring.v1.rs b/src/prost/cosmos.crypto.keyring.v1.rs new file mode 100644 index 00000000..34ae205c --- /dev/null +++ b/src/prost/cosmos.crypto.keyring.v1.rs @@ -0,0 +1,61 @@ +/// Record is used for representing a key in the keyring. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Record { + /// name represents a name of Record + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// pub_key represents a public key in any format + #[prost(message, optional, tag = "2")] + pub pub_key: ::core::option::Option< + super::super::super::super::google::protobuf::Any, + >, + /// Record contains one of the following items + #[prost(oneof = "record::Item", tags = "3, 4, 5, 6")] + pub item: ::core::option::Option, +} +/// Nested message and enum types in `Record`. +pub mod record { + /// Item is a keyring item stored in a keyring backend. + /// Local item + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Local { + #[prost(message, optional, tag = "1")] + pub priv_key: ::core::option::Option< + super::super::super::super::super::google::protobuf::Any, + >, + } + /// Ledger item + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Ledger { + #[prost(message, optional, tag = "1")] + pub path: ::core::option::Option, + } + /// Multi item + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Multi {} + /// Offline item + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Offline {} + /// Record contains one of the following items + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Item { + /// local stores the private key locally. + #[prost(message, tag = "3")] + Local(Local), + /// ledger stores the information about a Ledger key. + #[prost(message, tag = "4")] + Ledger(Ledger), + /// Multi does not store any other information. + #[prost(message, tag = "5")] + Multi(Multi), + /// Offline does not store any other information. + #[prost(message, tag = "6")] + Offline(Offline), + } +} diff --git a/src/prost/cosmos.crypto.multisig.rs b/src/prost/cosmos.crypto.multisig.rs new file mode 100644 index 00000000..c843eb9f --- /dev/null +++ b/src/prost/cosmos.crypto.multisig.rs @@ -0,0 +1,13 @@ +/// LegacyAminoPubKey specifies a public key type +/// which nests multiple public keys and a threshold, +/// it uses legacy amino address rules. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LegacyAminoPubKey { + #[prost(uint32, tag = "1")] + pub threshold: u32, + #[prost(message, repeated, tag = "2")] + pub public_keys: ::prost::alloc::vec::Vec< + super::super::super::google::protobuf::Any, + >, +} diff --git a/src/prost/cosmos.crypto.secp256k1.rs b/src/prost/cosmos.crypto.secp256k1.rs new file mode 100644 index 00000000..9c8f647b --- /dev/null +++ b/src/prost/cosmos.crypto.secp256k1.rs @@ -0,0 +1,18 @@ +/// PubKey defines a secp256k1 public key +/// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte +/// if the y-coordinate is the lexicographically largest of the two associated with +/// the x-coordinate. Otherwise the first byte is a 0x03. +/// This prefix is followed with the x-coordinate. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKey { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} +/// PrivKey defines a secp256k1 private key. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivKey { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.crypto.secp256r1.rs b/src/prost/cosmos.crypto.secp256r1.rs new file mode 100644 index 00000000..ee82db1e --- /dev/null +++ b/src/prost/cosmos.crypto.secp256r1.rs @@ -0,0 +1,17 @@ +/// PubKey defines a secp256r1 ECDSA public key. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKey { + /// Point on secp256r1 curve in a compressed representation as specified in section + /// 4.3.6 of ANSI X9.62: + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} +/// PrivKey defines a secp256r1 ECDSA private key. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivKey { + /// secret number serialized using big-endian encoding + #[prost(bytes = "vec", tag = "1")] + pub secret: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.distribution.v1beta1.rs b/src/prost/cosmos.distribution.v1beta1.rs new file mode 100644 index 00000000..91639e2a --- /dev/null +++ b/src/prost/cosmos.distribution.v1beta1.rs @@ -0,0 +1,2072 @@ +/// MsgSetWithdrawAddress sets the withdraw address for +/// a delegator (or validator self-delegation). +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetWithdrawAddress { + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub withdraw_address: ::prost::alloc::string::String, +} +/// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetWithdrawAddressResponse {} +/// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator +/// from a single validator. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawDelegatorReward { + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub validator_address: ::prost::alloc::string::String, +} +/// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawDelegatorRewardResponse { + /// Since: cosmos-sdk 0.46 + #[prost(message, repeated, tag = "1")] + pub amount: ::prost::alloc::vec::Vec, +} +/// MsgWithdrawValidatorCommission withdraws the full commission to the validator +/// address. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawValidatorCommission { + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, +} +/// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawValidatorCommissionResponse { + /// Since: cosmos-sdk 0.46 + #[prost(message, repeated, tag = "1")] + pub amount: ::prost::alloc::vec::Vec, +} +/// MsgFundCommunityPool allows an account to directly +/// fund the community pool. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgFundCommunityPool { + #[prost(message, repeated, tag = "1")] + pub amount: ::prost::alloc::vec::Vec, + #[prost(string, tag = "2")] + pub depositor: ::prost::alloc::string::String, +} +/// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgFundCommunityPoolResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the distribution Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// SetWithdrawAddress defines a method to change the withdraw address + /// for a delegator (or validator self-delegation). + pub async fn set_withdraw_address( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Msg/SetWithdrawAddress", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Msg", + "SetWithdrawAddress", + ), + ); + self.inner.unary(req, path, codec).await + } + /// WithdrawDelegatorReward defines a method to withdraw rewards of delegator + /// from a single validator. + pub async fn withdraw_delegator_reward( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Msg/WithdrawDelegatorReward", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Msg", + "WithdrawDelegatorReward", + ), + ); + self.inner.unary(req, path, codec).await + } + /// WithdrawValidatorCommission defines a method to withdraw the + /// full commission to the validator address. + pub async fn withdraw_validator_commission( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Msg/WithdrawValidatorCommission", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Msg", + "WithdrawValidatorCommission", + ), + ); + self.inner.unary(req, path, codec).await + } + /// FundCommunityPool defines a method to allow an account to directly + /// fund the community pool. + pub async fn fund_community_pool( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Msg/FundCommunityPool", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Msg", + "FundCommunityPool", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// SetWithdrawAddress defines a method to change the withdraw address + /// for a delegator (or validator self-delegation). + async fn set_withdraw_address( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// WithdrawDelegatorReward defines a method to withdraw rewards of delegator + /// from a single validator. + async fn withdraw_delegator_reward( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// WithdrawValidatorCommission defines a method to withdraw the + /// full commission to the validator address. + async fn withdraw_validator_commission( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// FundCommunityPool defines a method to allow an account to directly + /// fund the community pool. + async fn fund_community_pool( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the distribution Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.distribution.v1beta1.Msg/SetWithdrawAddress" => { + #[allow(non_camel_case_types)] + struct SetWithdrawAddressSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for SetWithdrawAddressSvc { + type Response = super::MsgSetWithdrawAddressResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).set_withdraw_address(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SetWithdrawAddressSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward" => { + #[allow(non_camel_case_types)] + struct WithdrawDelegatorRewardSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for WithdrawDelegatorRewardSvc { + type Response = super::MsgWithdrawDelegatorRewardResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).withdraw_delegator_reward(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = WithdrawDelegatorRewardSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission" => { + #[allow(non_camel_case_types)] + struct WithdrawValidatorCommissionSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for WithdrawValidatorCommissionSvc { + type Response = super::MsgWithdrawValidatorCommissionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::MsgWithdrawValidatorCommission, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).withdraw_validator_commission(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = WithdrawValidatorCommissionSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Msg/FundCommunityPool" => { + #[allow(non_camel_case_types)] + struct FundCommunityPoolSvc(pub Arc); + impl tonic::server::UnaryService + for FundCommunityPoolSvc { + type Response = super::MsgFundCommunityPoolResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).fund_community_pool(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = FundCommunityPoolSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.distribution.v1beta1.Msg"; + } +} +/// Params defines the set of params for the distribution module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(string, tag = "1")] + pub community_tax: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub base_proposer_reward: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub bonus_proposer_reward: ::prost::alloc::string::String, + #[prost(bool, tag = "4")] + pub withdraw_addr_enabled: bool, +} +/// ValidatorHistoricalRewards represents historical rewards for a validator. +/// Height is implicit within the store key. +/// Cumulative reward ratio is the sum from the zeroeth period +/// until this period of rewards / tokens, per the spec. +/// The reference count indicates the number of objects +/// which might need to reference this historical entry at any point. +/// ReferenceCount = +/// number of outstanding delegations which ended the associated period (and +/// might need to read that record) +/// + number of slashes which ended the associated period (and might need to +/// read that record) +/// + one per validator for the zeroeth period, set on initialization +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorHistoricalRewards { + #[prost(message, repeated, tag = "1")] + pub cumulative_reward_ratio: ::prost::alloc::vec::Vec< + super::super::base::v1beta1::DecCoin, + >, + #[prost(uint32, tag = "2")] + pub reference_count: u32, +} +/// ValidatorCurrentRewards represents current rewards and current +/// period for a validator kept as a running counter and incremented +/// each block as long as the validator's tokens remain constant. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorCurrentRewards { + #[prost(message, repeated, tag = "1")] + pub rewards: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub period: u64, +} +/// ValidatorAccumulatedCommission represents accumulated commission +/// for a validator kept as a running counter, can be withdrawn at any time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorAccumulatedCommission { + #[prost(message, repeated, tag = "1")] + pub commission: ::prost::alloc::vec::Vec, +} +/// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards +/// for a validator inexpensive to track, allows simple sanity checks. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorOutstandingRewards { + #[prost(message, repeated, tag = "1")] + pub rewards: ::prost::alloc::vec::Vec, +} +/// ValidatorSlashEvent represents a validator slash event. +/// Height is implicit within the store key. +/// This is needed to calculate appropriate amount of staking tokens +/// for delegations which are withdrawn after a slash has occurred. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSlashEvent { + #[prost(uint64, tag = "1")] + pub validator_period: u64, + #[prost(string, tag = "2")] + pub fraction: ::prost::alloc::string::String, +} +/// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSlashEvents { + #[prost(message, repeated, tag = "1")] + pub validator_slash_events: ::prost::alloc::vec::Vec, +} +/// FeePool is the global fee pool for distribution. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FeePool { + #[prost(message, repeated, tag = "1")] + pub community_pool: ::prost::alloc::vec::Vec, +} +/// CommunityPoolSpendProposal details a proposal for use of community funds, +/// together with how many coins are proposed to be spent, and to which +/// recipient account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommunityPoolSpendProposal { + #[prost(string, tag = "1")] + pub title: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub recipient: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub amount: ::prost::alloc::vec::Vec, +} +/// DelegatorStartingInfo represents the starting info for a delegator reward +/// period. It tracks the previous validator period, the delegation's amount of +/// staking token, and the creation height (to check later on if any slashes have +/// occurred). NOTE: Even though validators are slashed to whole staking tokens, +/// the delegators within the validator may be left with less than a full token, +/// thus sdk.Dec is used. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatorStartingInfo { + #[prost(uint64, tag = "1")] + pub previous_period: u64, + #[prost(string, tag = "2")] + pub stake: ::prost::alloc::string::String, + #[prost(uint64, tag = "3")] + pub height: u64, +} +/// DelegationDelegatorReward represents the properties +/// of a delegator's delegation reward. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegationDelegatorReward { + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub reward: ::prost::alloc::vec::Vec, +} +/// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal +/// with a deposit +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommunityPoolSpendProposalWithDeposit { + #[prost(string, tag = "1")] + pub title: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub recipient: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub amount: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub deposit: ::prost::alloc::string::String, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryValidatorOutstandingRewardsRequest is the request type for the +/// Query/ValidatorOutstandingRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorOutstandingRewardsRequest { + /// validator_address defines the validator address to query for. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, +} +/// QueryValidatorOutstandingRewardsResponse is the response type for the +/// Query/ValidatorOutstandingRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorOutstandingRewardsResponse { + #[prost(message, optional, tag = "1")] + pub rewards: ::core::option::Option, +} +/// QueryValidatorCommissionRequest is the request type for the +/// Query/ValidatorCommission RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorCommissionRequest { + /// validator_address defines the validator address to query for. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, +} +/// QueryValidatorCommissionResponse is the response type for the +/// Query/ValidatorCommission RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorCommissionResponse { + /// commission defines the commision the validator received. + #[prost(message, optional, tag = "1")] + pub commission: ::core::option::Option, +} +/// QueryValidatorSlashesRequest is the request type for the +/// Query/ValidatorSlashes RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorSlashesRequest { + /// validator_address defines the validator address to query for. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// starting_height defines the optional starting height to query the slashes. + #[prost(uint64, tag = "2")] + pub starting_height: u64, + /// starting_height defines the optional ending height to query the slashes. + #[prost(uint64, tag = "3")] + pub ending_height: u64, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "4")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryValidatorSlashesResponse is the response type for the +/// Query/ValidatorSlashes RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryValidatorSlashesResponse { + /// slashes defines the slashes the validator received. + #[prost(message, repeated, tag = "1")] + pub slashes: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryDelegationRewardsRequest is the request type for the +/// Query/DelegationRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegationRewardsRequest { + /// delegator_address defines the delegator address to query for. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, + /// validator_address defines the validator address to query for. + #[prost(string, tag = "2")] + pub validator_address: ::prost::alloc::string::String, +} +/// QueryDelegationRewardsResponse is the response type for the +/// Query/DelegationRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegationRewardsResponse { + /// rewards defines the rewards accrued by a delegation. + #[prost(message, repeated, tag = "1")] + pub rewards: ::prost::alloc::vec::Vec, +} +/// QueryDelegationTotalRewardsRequest is the request type for the +/// Query/DelegationTotalRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegationTotalRewardsRequest { + /// delegator_address defines the delegator address to query for. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, +} +/// QueryDelegationTotalRewardsResponse is the response type for the +/// Query/DelegationTotalRewards RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegationTotalRewardsResponse { + /// rewards defines all the rewards accrued by a delegator. + #[prost(message, repeated, tag = "1")] + pub rewards: ::prost::alloc::vec::Vec, + /// total defines the sum of all the rewards. + #[prost(message, repeated, tag = "2")] + pub total: ::prost::alloc::vec::Vec, +} +/// QueryDelegatorValidatorsRequest is the request type for the +/// Query/DelegatorValidators RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegatorValidatorsRequest { + /// delegator_address defines the delegator address to query for. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, +} +/// QueryDelegatorValidatorsResponse is the response type for the +/// Query/DelegatorValidators RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegatorValidatorsResponse { + /// validators defines the validators a delegator is delegating for. + #[prost(string, repeated, tag = "1")] + pub validators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// QueryDelegatorWithdrawAddressRequest is the request type for the +/// Query/DelegatorWithdrawAddress RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegatorWithdrawAddressRequest { + /// delegator_address defines the delegator address to query for. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, +} +/// QueryDelegatorWithdrawAddressResponse is the response type for the +/// Query/DelegatorWithdrawAddress RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDelegatorWithdrawAddressResponse { + /// withdraw_address defines the delegator address to query for. + #[prost(string, tag = "1")] + pub withdraw_address: ::prost::alloc::string::String, +} +/// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCommunityPoolRequest {} +/// QueryCommunityPoolResponse is the response type for the Query/CommunityPool +/// RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCommunityPoolResponse { + /// pool defines community pool's coins. + #[prost(message, repeated, tag = "1")] + pub pool: ::prost::alloc::vec::Vec, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service for distribution module. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Params queries params of the distribution module. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.distribution.v1beta1.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// ValidatorOutstandingRewards queries rewards of a validator address. + pub async fn validator_outstanding_rewards( + &mut self, + request: impl tonic::IntoRequest< + super::QueryValidatorOutstandingRewardsRequest, + >, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/ValidatorOutstandingRewards", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "ValidatorOutstandingRewards", + ), + ); + self.inner.unary(req, path, codec).await + } + /// ValidatorCommission queries accumulated commission for a validator. + pub async fn validator_commission( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/ValidatorCommission", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "ValidatorCommission", + ), + ); + self.inner.unary(req, path, codec).await + } + /// ValidatorSlashes queries slash events of a validator. + pub async fn validator_slashes( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/ValidatorSlashes", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "ValidatorSlashes", + ), + ); + self.inner.unary(req, path, codec).await + } + /// DelegationRewards queries the total rewards accrued by a delegation. + pub async fn delegation_rewards( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/DelegationRewards", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "DelegationRewards", + ), + ); + self.inner.unary(req, path, codec).await + } + /// DelegationTotalRewards queries the total rewards accrued by a each + /// validator. + pub async fn delegation_total_rewards( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/DelegationTotalRewards", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "DelegationTotalRewards", + ), + ); + self.inner.unary(req, path, codec).await + } + /// DelegatorValidators queries the validators of a delegator. + pub async fn delegator_validators( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/DelegatorValidators", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "DelegatorValidators", + ), + ); + self.inner.unary(req, path, codec).await + } + /// DelegatorWithdrawAddress queries withdraw address of a delegator. + pub async fn delegator_withdraw_address( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/DelegatorWithdrawAddress", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.distribution.v1beta1.Query", + "DelegatorWithdrawAddress", + ), + ); + self.inner.unary(req, path, codec).await + } + /// CommunityPool queries the community pool coins. + pub async fn community_pool( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.distribution.v1beta1.Query/CommunityPool", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.distribution.v1beta1.Query", "CommunityPool"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Params queries params of the distribution module. + async fn params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ValidatorOutstandingRewards queries rewards of a validator address. + async fn validator_outstanding_rewards( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ValidatorCommission queries accumulated commission for a validator. + async fn validator_commission( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ValidatorSlashes queries slash events of a validator. + async fn validator_slashes( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// DelegationRewards queries the total rewards accrued by a delegation. + async fn delegation_rewards( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// DelegationTotalRewards queries the total rewards accrued by a each + /// validator. + async fn delegation_total_rewards( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// DelegatorValidators queries the validators of a delegator. + async fn delegator_validators( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// DelegatorWithdrawAddress queries withdraw address of a delegator. + async fn delegator_withdraw_address( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CommunityPool queries the community pool coins. + async fn community_pool( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service for distribution module. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.distribution.v1beta1.Query/Params" => { + #[allow(non_camel_case_types)] + struct ParamsSvc(pub Arc); + impl tonic::server::UnaryService + for ParamsSvc { + type Response = super::QueryParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).params(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/ValidatorOutstandingRewards" => { + #[allow(non_camel_case_types)] + struct ValidatorOutstandingRewardsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryValidatorOutstandingRewardsRequest, + > for ValidatorOutstandingRewardsSvc { + type Response = super::QueryValidatorOutstandingRewardsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryValidatorOutstandingRewardsRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).validator_outstanding_rewards(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ValidatorOutstandingRewardsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/ValidatorCommission" => { + #[allow(non_camel_case_types)] + struct ValidatorCommissionSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ValidatorCommissionSvc { + type Response = super::QueryValidatorCommissionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryValidatorCommissionRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).validator_commission(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ValidatorCommissionSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/ValidatorSlashes" => { + #[allow(non_camel_case_types)] + struct ValidatorSlashesSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ValidatorSlashesSvc { + type Response = super::QueryValidatorSlashesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).validator_slashes(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ValidatorSlashesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/DelegationRewards" => { + #[allow(non_camel_case_types)] + struct DelegationRewardsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for DelegationRewardsSvc { + type Response = super::QueryDelegationRewardsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).delegation_rewards(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = DelegationRewardsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/DelegationTotalRewards" => { + #[allow(non_camel_case_types)] + struct DelegationTotalRewardsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryDelegationTotalRewardsRequest, + > for DelegationTotalRewardsSvc { + type Response = super::QueryDelegationTotalRewardsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryDelegationTotalRewardsRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).delegation_total_rewards(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = DelegationTotalRewardsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/DelegatorValidators" => { + #[allow(non_camel_case_types)] + struct DelegatorValidatorsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for DelegatorValidatorsSvc { + type Response = super::QueryDelegatorValidatorsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryDelegatorValidatorsRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).delegator_validators(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = DelegatorValidatorsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/DelegatorWithdrawAddress" => { + #[allow(non_camel_case_types)] + struct DelegatorWithdrawAddressSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryDelegatorWithdrawAddressRequest, + > for DelegatorWithdrawAddressSvc { + type Response = super::QueryDelegatorWithdrawAddressResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryDelegatorWithdrawAddressRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).delegator_withdraw_address(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = DelegatorWithdrawAddressSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.distribution.v1beta1.Query/CommunityPool" => { + #[allow(non_camel_case_types)] + struct CommunityPoolSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for CommunityPoolSvc { + type Response = super::QueryCommunityPoolResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).community_pool(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CommunityPoolSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.distribution.v1beta1.Query"; + } +} +/// DelegatorWithdrawInfo is the address for where distributions rewards are +/// withdrawn to by default this struct is only used at genesis to feed in +/// default withdraw addresses. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatorWithdrawInfo { + /// delegator_address is the address of the delegator. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, + /// withdraw_address is the address to withdraw the delegation rewards to. + #[prost(string, tag = "2")] + pub withdraw_address: ::prost::alloc::string::String, +} +/// ValidatorOutstandingRewardsRecord is used for import/export via genesis json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorOutstandingRewardsRecord { + /// validator_address is the address of the validator. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// outstanding_rewards represents the oustanding rewards of a validator. + #[prost(message, repeated, tag = "2")] + pub outstanding_rewards: ::prost::alloc::vec::Vec< + super::super::base::v1beta1::DecCoin, + >, +} +/// ValidatorAccumulatedCommissionRecord is used for import / export via genesis +/// json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorAccumulatedCommissionRecord { + /// validator_address is the address of the validator. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// accumulated is the accumulated commission of a validator. + #[prost(message, optional, tag = "2")] + pub accumulated: ::core::option::Option, +} +/// ValidatorHistoricalRewardsRecord is used for import / export via genesis +/// json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorHistoricalRewardsRecord { + /// validator_address is the address of the validator. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// period defines the period the historical rewards apply to. + #[prost(uint64, tag = "2")] + pub period: u64, + /// rewards defines the historical rewards of a validator. + #[prost(message, optional, tag = "3")] + pub rewards: ::core::option::Option, +} +/// ValidatorCurrentRewardsRecord is used for import / export via genesis json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorCurrentRewardsRecord { + /// validator_address is the address of the validator. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// rewards defines the current rewards of a validator. + #[prost(message, optional, tag = "2")] + pub rewards: ::core::option::Option, +} +/// DelegatorStartingInfoRecord used for import / export via genesis json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatorStartingInfoRecord { + /// delegator_address is the address of the delegator. + #[prost(string, tag = "1")] + pub delegator_address: ::prost::alloc::string::String, + /// validator_address is the address of the validator. + #[prost(string, tag = "2")] + pub validator_address: ::prost::alloc::string::String, + /// starting_info defines the starting info of a delegator. + #[prost(message, optional, tag = "3")] + pub starting_info: ::core::option::Option, +} +/// ValidatorSlashEventRecord is used for import / export via genesis json. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSlashEventRecord { + /// validator_address is the address of the validator. + #[prost(string, tag = "1")] + pub validator_address: ::prost::alloc::string::String, + /// height defines the block height at which the slash event occured. + #[prost(uint64, tag = "2")] + pub height: u64, + /// period is the period of the slash event. + #[prost(uint64, tag = "3")] + pub period: u64, + /// validator_slash_event describes the slash event. + #[prost(message, optional, tag = "4")] + pub validator_slash_event: ::core::option::Option, +} +/// GenesisState defines the distribution module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// params defines all the paramaters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// fee_pool defines the fee pool at genesis. + #[prost(message, optional, tag = "2")] + pub fee_pool: ::core::option::Option, + /// fee_pool defines the delegator withdraw infos at genesis. + #[prost(message, repeated, tag = "3")] + pub delegator_withdraw_infos: ::prost::alloc::vec::Vec, + /// fee_pool defines the previous proposer at genesis. + #[prost(string, tag = "4")] + pub previous_proposer: ::prost::alloc::string::String, + /// fee_pool defines the outstanding rewards of all validators at genesis. + #[prost(message, repeated, tag = "5")] + pub outstanding_rewards: ::prost::alloc::vec::Vec, + /// fee_pool defines the accumulated commisions of all validators at genesis. + #[prost(message, repeated, tag = "6")] + pub validator_accumulated_commissions: ::prost::alloc::vec::Vec< + ValidatorAccumulatedCommissionRecord, + >, + /// fee_pool defines the historical rewards of all validators at genesis. + #[prost(message, repeated, tag = "7")] + pub validator_historical_rewards: ::prost::alloc::vec::Vec< + ValidatorHistoricalRewardsRecord, + >, + /// fee_pool defines the current rewards of all validators at genesis. + #[prost(message, repeated, tag = "8")] + pub validator_current_rewards: ::prost::alloc::vec::Vec< + ValidatorCurrentRewardsRecord, + >, + /// fee_pool defines the delegator starting infos at genesis. + #[prost(message, repeated, tag = "9")] + pub delegator_starting_infos: ::prost::alloc::vec::Vec, + /// fee_pool defines the validator slash events at genesis. + #[prost(message, repeated, tag = "10")] + pub validator_slash_events: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.evidence.v1beta1.rs b/src/prost/cosmos.evidence.v1beta1.rs index bf067bba..9bf772fa 100644 --- a/src/prost/cosmos.evidence.v1beta1.rs +++ b/src/prost/cosmos.evidence.v1beta1.rs @@ -1,3 +1,322 @@ +/// MsgSubmitEvidence represents a message that supports submitting arbitrary +/// Evidence of misbehavior such as equivocation or counterfactual signing. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitEvidence { + #[prost(string, tag = "1")] + pub submitter: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub evidence: ::core::option::Option, +} +/// MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitEvidenceResponse { + /// hash defines the hash of the evidence. + #[prost(bytes = "vec", tag = "4")] + pub hash: ::prost::alloc::vec::Vec, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the evidence Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + /// counterfactual signing. + pub async fn submit_evidence( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.evidence.v1beta1.Msg/SubmitEvidence", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.evidence.v1beta1.Msg", "SubmitEvidence"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + /// counterfactual signing. + async fn submit_evidence( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the evidence Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.evidence.v1beta1.Msg/SubmitEvidence" => { + #[allow(non_camel_case_types)] + struct SubmitEvidenceSvc(pub Arc); + impl tonic::server::UnaryService + for SubmitEvidenceSvc { + type Response = super::MsgSubmitEvidenceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).submit_evidence(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SubmitEvidenceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.evidence.v1beta1.Msg"; + } +} /// Equivocation implements the Evidence interface and defines evidence of double /// signing misbehavior. #[allow(clippy::derive_partial_eq_without_eq)] @@ -12,3 +331,429 @@ pub struct Equivocation { #[prost(string, tag = "4")] pub consensus_address: ::prost::alloc::string::String, } +/// QueryEvidenceRequest is the request type for the Query/Evidence RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEvidenceRequest { + /// evidence_hash defines the hash of the requested evidence. + #[prost(bytes = "vec", tag = "1")] + pub evidence_hash: ::prost::alloc::vec::Vec, +} +/// QueryEvidenceResponse is the response type for the Query/Evidence RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEvidenceResponse { + /// evidence returns the requested evidence. + #[prost(message, optional, tag = "1")] + pub evidence: ::core::option::Option, +} +/// QueryEvidenceRequest is the request type for the Query/AllEvidence RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllEvidenceRequest { + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllEvidenceResponse { + /// evidence returns all evidences. + #[prost(message, repeated, tag = "1")] + pub evidence: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Evidence queries evidence based on evidence hash. + pub async fn evidence( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.evidence.v1beta1.Query/Evidence", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.evidence.v1beta1.Query", "Evidence")); + self.inner.unary(req, path, codec).await + } + /// AllEvidence queries all evidence. + pub async fn all_evidence( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.evidence.v1beta1.Query/AllEvidence", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.evidence.v1beta1.Query", "AllEvidence")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Evidence queries evidence based on evidence hash. + async fn evidence( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// AllEvidence queries all evidence. + async fn all_evidence( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.evidence.v1beta1.Query/Evidence" => { + #[allow(non_camel_case_types)] + struct EvidenceSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for EvidenceSvc { + type Response = super::QueryEvidenceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).evidence(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = EvidenceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.evidence.v1beta1.Query/AllEvidence" => { + #[allow(non_camel_case_types)] + struct AllEvidenceSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for AllEvidenceSvc { + type Response = super::QueryAllEvidenceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).all_evidence(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AllEvidenceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.evidence.v1beta1.Query"; + } +} +/// GenesisState defines the evidence module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// evidence defines all the evidence at genesis. + #[prost(message, repeated, tag = "1")] + pub evidence: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.feegrant.v1beta1.rs b/src/prost/cosmos.feegrant.v1beta1.rs new file mode 100644 index 00000000..90b5f4a4 --- /dev/null +++ b/src/prost/cosmos.feegrant.v1beta1.rs @@ -0,0 +1,1031 @@ +/// MsgGrantAllowance adds permission for Grantee to spend up to Allowance +/// of fees from the account of Granter. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgGrantAllowance { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + /// allowance can be any of basic, periodic, allowed fee allowance. + #[prost(message, optional, tag = "3")] + pub allowance: ::core::option::Option, +} +/// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgGrantAllowanceResponse {} +/// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRevokeAllowance { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, +} +/// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRevokeAllowanceResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the feegrant msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// GrantAllowance grants fee allowance to the grantee on the granter's + /// account with the provided expiration time. + pub async fn grant_allowance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.feegrant.v1beta1.Msg/GrantAllowance", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.feegrant.v1beta1.Msg", "GrantAllowance"), + ); + self.inner.unary(req, path, codec).await + } + /// RevokeAllowance revokes any fee allowance of granter's account that + /// has been granted to the grantee. + pub async fn revoke_allowance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.feegrant.v1beta1.Msg/RevokeAllowance", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.feegrant.v1beta1.Msg", "RevokeAllowance"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// GrantAllowance grants fee allowance to the grantee on the granter's + /// account with the provided expiration time. + async fn grant_allowance( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// RevokeAllowance revokes any fee allowance of granter's account that + /// has been granted to the grantee. + async fn revoke_allowance( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the feegrant msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.feegrant.v1beta1.Msg/GrantAllowance" => { + #[allow(non_camel_case_types)] + struct GrantAllowanceSvc(pub Arc); + impl tonic::server::UnaryService + for GrantAllowanceSvc { + type Response = super::MsgGrantAllowanceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).grant_allowance(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GrantAllowanceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.feegrant.v1beta1.Msg/RevokeAllowance" => { + #[allow(non_camel_case_types)] + struct RevokeAllowanceSvc(pub Arc); + impl tonic::server::UnaryService + for RevokeAllowanceSvc { + type Response = super::MsgRevokeAllowanceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).revoke_allowance(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = RevokeAllowanceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.feegrant.v1beta1.Msg"; + } +} +/// BasicAllowance implements Allowance with a one-time grant of coins +/// that optionally expires. The grantee can use up to SpendLimit to cover fees. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BasicAllowance { + /// spend_limit specifies the maximum amount of coins that can be spent + /// by this allowance and will be updated as coins are spent. If it is + /// empty, there is no spend limit and any amount of coins can be spent. + #[prost(message, repeated, tag = "1")] + pub spend_limit: ::prost::alloc::vec::Vec, + /// expiration specifies an optional time when this allowance expires + #[prost(message, optional, tag = "2")] + pub expiration: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// PeriodicAllowance extends Allowance to allow for both a maximum cap, +/// as well as a limit per time period. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeriodicAllowance { + /// basic specifies a struct of `BasicAllowance` + #[prost(message, optional, tag = "1")] + pub basic: ::core::option::Option, + /// period specifies the time duration in which period_spend_limit coins can + /// be spent before that allowance is reset + #[prost(message, optional, tag = "2")] + pub period: ::core::option::Option, + /// period_spend_limit specifies the maximum number of coins that can be spent + /// in the period + #[prost(message, repeated, tag = "3")] + pub period_spend_limit: ::prost::alloc::vec::Vec, + /// period_can_spend is the number of coins left to be spent before the period_reset time + #[prost(message, repeated, tag = "4")] + pub period_can_spend: ::prost::alloc::vec::Vec, + /// period_reset is the time at which this period resets and a new one begins, + /// it is calculated from the start time of the first transaction after the + /// last period ended + #[prost(message, optional, tag = "5")] + pub period_reset: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// AllowedMsgAllowance creates allowance only for specified message types. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AllowedMsgAllowance { + /// allowance can be any of basic and periodic fee allowance. + #[prost(message, optional, tag = "1")] + pub allowance: ::core::option::Option, + /// allowed_messages are the messages for which the grantee has the access. + #[prost(string, repeated, tag = "2")] + pub allowed_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Grant is stored in the KVStore to record a grant with full context +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Grant { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + /// allowance can be any of basic, periodic, allowed fee allowance. + #[prost(message, optional, tag = "3")] + pub allowance: ::core::option::Option, +} +/// QueryAllowanceRequest is the request type for the Query/Allowance RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowanceRequest { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, +} +/// QueryAllowanceResponse is the response type for the Query/Allowance RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowanceResponse { + /// allowance is a allowance granted for grantee by granter. + #[prost(message, optional, tag = "1")] + pub allowance: ::core::option::Option, +} +/// QueryAllowancesRequest is the request type for the Query/Allowances RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowancesRequest { + #[prost(string, tag = "1")] + pub grantee: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryAllowancesResponse is the response type for the Query/Allowances RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowancesResponse { + /// allowances are allowance's granted for grantee by granter. + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowancesByGranterRequest { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllowancesByGranterResponse { + /// allowances that have been issued by the granter. + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Allowance returns fee granted to the grantee by the granter. + pub async fn allowance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.feegrant.v1beta1.Query/Allowance", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.feegrant.v1beta1.Query", "Allowance")); + self.inner.unary(req, path, codec).await + } + /// Allowances returns all the grants for address. + pub async fn allowances( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.feegrant.v1beta1.Query/Allowances", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.feegrant.v1beta1.Query", "Allowances")); + self.inner.unary(req, path, codec).await + } + /// AllowancesByGranter returns all the grants given by an address + /// + /// Since: cosmos-sdk 0.46 + pub async fn allowances_by_granter( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.feegrant.v1beta1.Query/AllowancesByGranter", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.feegrant.v1beta1.Query", + "AllowancesByGranter", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Allowance returns fee granted to the grantee by the granter. + async fn allowance( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Allowances returns all the grants for address. + async fn allowances( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// AllowancesByGranter returns all the grants given by an address + /// + /// Since: cosmos-sdk 0.46 + async fn allowances_by_granter( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.feegrant.v1beta1.Query/Allowance" => { + #[allow(non_camel_case_types)] + struct AllowanceSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for AllowanceSvc { + type Response = super::QueryAllowanceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).allowance(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AllowanceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.feegrant.v1beta1.Query/Allowances" => { + #[allow(non_camel_case_types)] + struct AllowancesSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for AllowancesSvc { + type Response = super::QueryAllowancesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).allowances(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AllowancesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter" => { + #[allow(non_camel_case_types)] + struct AllowancesByGranterSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for AllowancesByGranterSvc { + type Response = super::QueryAllowancesByGranterResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryAllowancesByGranterRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).allowances_by_granter(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AllowancesByGranterSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.feegrant.v1beta1.Query"; + } +} +/// GenesisState contains a set of fee allowances, persisted from the store +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.genutil.v1beta1.rs b/src/prost/cosmos.genutil.v1beta1.rs new file mode 100644 index 00000000..445b4bdc --- /dev/null +++ b/src/prost/cosmos.genutil.v1beta1.rs @@ -0,0 +1,8 @@ +/// GenesisState defines the raw genesis transaction in JSON. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// gen_txs defines the genesis transactions. + #[prost(bytes = "vec", repeated, tag = "1")] + pub gen_txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} diff --git a/src/prost/cosmos.group.v1.rs b/src/prost/cosmos.group.v1.rs new file mode 100644 index 00000000..099019cf --- /dev/null +++ b/src/prost/cosmos.group.v1.rs @@ -0,0 +1,3728 @@ +/// Member represents a group member with an account address, +/// non-zero weight, metadata and added_at timestamp. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Member { + /// address is the member's account address. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// weight is the member's voting weight that should be greater than 0. + #[prost(string, tag = "2")] + pub weight: ::prost::alloc::string::String, + /// metadata is any arbitrary metadata attached to the member. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, + /// added_at is a timestamp specifying when a member was added. + #[prost(message, optional, tag = "4")] + pub added_at: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// MemberRequest represents a group member to be used in Msg server requests. +/// Contrary to `Member`, it doesn't have any `added_at` field +/// since this field cannot be set as part of requests. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MemberRequest { + /// address is the member's account address. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// weight is the member's voting weight that should be greater than 0. + #[prost(string, tag = "2")] + pub weight: ::prost::alloc::string::String, + /// metadata is any arbitrary metadata attached to the member. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, +} +/// ThresholdDecisionPolicy is a decision policy where a proposal passes when it +/// satisfies the two following conditions: +/// 1. The sum of all `YES` voters' weights is greater or equal than the defined +/// `threshold`. +/// 2. The voting and execution periods of the proposal respect the parameters +/// given by `windows`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ThresholdDecisionPolicy { + /// threshold is the minimum weighted sum of `YES` votes that must be met or + /// exceeded for a proposal to succeed. + #[prost(string, tag = "1")] + pub threshold: ::prost::alloc::string::String, + /// windows defines the different windows for voting and execution. + #[prost(message, optional, tag = "2")] + pub windows: ::core::option::Option, +} +/// PercentageDecisionPolicy is a decision policy where a proposal passes when +/// it satisfies the two following conditions: +/// 1. The percentage of all `YES` voters' weights out of the total group weight +/// is greater or equal than the given `percentage`. +/// 2. The voting and execution periods of the proposal respect the parameters +/// given by `windows`. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PercentageDecisionPolicy { + /// percentage is the minimum percentage the weighted sum of `YES` votes must + /// meet for a proposal to succeed. + #[prost(string, tag = "1")] + pub percentage: ::prost::alloc::string::String, + /// windows defines the different windows for voting and execution. + #[prost(message, optional, tag = "2")] + pub windows: ::core::option::Option, +} +/// DecisionPolicyWindows defines the different windows for voting and execution. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecisionPolicyWindows { + /// voting_period is the duration from submission of a proposal to the end of voting period + /// Within this times votes can be submitted with MsgVote. + #[prost(message, optional, tag = "1")] + pub voting_period: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// min_execution_period is the minimum duration after the proposal submission + /// where members can start sending MsgExec. This means that the window for + /// sending a MsgExec transaction is: + /// `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + /// where max_execution_period is a app-specific config, defined in the keeper. + /// If not set, min_execution_period will default to 0. + /// + /// Please make sure to set a `min_execution_period` that is smaller than + /// `voting_period + max_execution_period`, or else the above execution window + /// is empty, meaning that all proposals created with this decision policy + /// won't be able to be executed. + #[prost(message, optional, tag = "2")] + pub min_execution_period: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, +} +/// GroupInfo represents the high-level on-chain information for a group. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupInfo { + /// id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub id: u64, + /// admin is the account address of the group's admin. + #[prost(string, tag = "2")] + pub admin: ::prost::alloc::string::String, + /// metadata is any arbitrary metadata to attached to the group. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, + /// version is used to track changes to a group's membership structure that + /// would break existing proposals. Whenever any members weight is changed, + /// or any member is added or removed this version is incremented and will + /// cause proposals based on older versions of this group to fail + #[prost(uint64, tag = "4")] + pub version: u64, + /// total_weight is the sum of the group members' weights. + #[prost(string, tag = "5")] + pub total_weight: ::prost::alloc::string::String, + /// created_at is a timestamp specifying when a group was created. + #[prost(message, optional, tag = "6")] + pub created_at: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// GroupMember represents the relationship between a group and a member. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupMember { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, + /// member is the member data. + #[prost(message, optional, tag = "2")] + pub member: ::core::option::Option, +} +/// GroupPolicyInfo represents the high-level on-chain information for a group policy. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GroupPolicyInfo { + /// address is the account address of group policy. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, + /// admin is the account address of the group admin. + #[prost(string, tag = "3")] + pub admin: ::prost::alloc::string::String, + /// metadata is any arbitrary metadata to attached to the group policy. + #[prost(string, tag = "4")] + pub metadata: ::prost::alloc::string::String, + /// version is used to track changes to a group's GroupPolicyInfo structure that + /// would create a different result on a running proposal. + #[prost(uint64, tag = "5")] + pub version: u64, + /// decision_policy specifies the group policy's decision policy. + #[prost(message, optional, tag = "6")] + pub decision_policy: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, + /// created_at is a timestamp specifying when a group policy was created. + #[prost(message, optional, tag = "7")] + pub created_at: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// Proposal defines a group proposal. Any member of a group can submit a proposal +/// for a group policy to decide upon. +/// A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal +/// passes as well as some optional metadata associated with the proposal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proposal { + /// id is the unique id of the proposal. + #[prost(uint64, tag = "1")] + pub id: u64, + /// group_policy_address is the account address of group policy. + #[prost(string, tag = "2")] + pub group_policy_address: ::prost::alloc::string::String, + /// metadata is any arbitrary metadata to attached to the proposal. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, + /// proposers are the account addresses of the proposers. + #[prost(string, repeated, tag = "4")] + pub proposers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// submit_time is a timestamp specifying when a proposal was submitted. + #[prost(message, optional, tag = "5")] + pub submit_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// group_version tracks the version of the group at proposal submission. + /// This field is here for informational purposes only. + #[prost(uint64, tag = "6")] + pub group_version: u64, + /// group_policy_version tracks the version of the group policy at proposal submission. + /// When a decision policy is changed, existing proposals from previous policy + /// versions will become invalid with the `ABORTED` status. + /// This field is here for informational purposes only. + #[prost(uint64, tag = "7")] + pub group_policy_version: u64, + /// status represents the high level position in the life cycle of the proposal. Initial value is Submitted. + #[prost(enumeration = "ProposalStatus", tag = "8")] + pub status: i32, + /// final_tally_result contains the sums of all weighted votes for this + /// proposal for each vote option. It is empty at submission, and only + /// populated after tallying, at voting period end or at proposal execution, + /// whichever happens first. + #[prost(message, optional, tag = "9")] + pub final_tally_result: ::core::option::Option, + /// voting_period_end is the timestamp before which voting must be done. + /// Unless a successfull MsgExec is called before (to execute a proposal whose + /// tally is successful before the voting period ends), tallying will be done + /// at this point, and the `final_tally_result`and `status` fields will be + /// accordingly updated. + #[prost(message, optional, tag = "10")] + pub voting_period_end: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// executor_result is the final result of the proposal execution. Initial value is NotRun. + #[prost(enumeration = "ProposalExecutorResult", tag = "11")] + pub executor_result: i32, + /// messages is a list of `sdk.Msg`s that will be executed if the proposal passes. + #[prost(message, repeated, tag = "12")] + pub messages: ::prost::alloc::vec::Vec, +} +/// TallyResult represents the sum of weighted votes for each vote option. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TallyResult { + /// yes_count is the weighted sum of yes votes. + #[prost(string, tag = "1")] + pub yes_count: ::prost::alloc::string::String, + /// abstain_count is the weighted sum of abstainers. + #[prost(string, tag = "2")] + pub abstain_count: ::prost::alloc::string::String, + /// no_count is the weighted sum of no votes. + #[prost(string, tag = "3")] + pub no_count: ::prost::alloc::string::String, + /// no_with_veto_count is the weighted sum of veto. + #[prost(string, tag = "4")] + pub no_with_veto_count: ::prost::alloc::string::String, +} +/// Vote represents a vote for a proposal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Vote { + /// proposal is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// voter is the account address of the voter. + #[prost(string, tag = "2")] + pub voter: ::prost::alloc::string::String, + /// option is the voter's choice on the proposal. + #[prost(enumeration = "VoteOption", tag = "3")] + pub option: i32, + /// metadata is any arbitrary metadata to attached to the vote. + #[prost(string, tag = "4")] + pub metadata: ::prost::alloc::string::String, + /// submit_time is the timestamp when the vote was submitted. + #[prost(message, optional, tag = "5")] + pub submit_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// VoteOption enumerates the valid vote options for a given proposal. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VoteOption { + /// VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + /// return an error. + Unspecified = 0, + /// VOTE_OPTION_YES defines a yes vote option. + Yes = 1, + /// VOTE_OPTION_ABSTAIN defines an abstain vote option. + Abstain = 2, + /// VOTE_OPTION_NO defines a no vote option. + No = 3, + /// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + NoWithVeto = 4, +} +impl VoteOption { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + VoteOption::Unspecified => "VOTE_OPTION_UNSPECIFIED", + VoteOption::Yes => "VOTE_OPTION_YES", + VoteOption::Abstain => "VOTE_OPTION_ABSTAIN", + VoteOption::No => "VOTE_OPTION_NO", + VoteOption::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VOTE_OPTION_UNSPECIFIED" => Some(Self::Unspecified), + "VOTE_OPTION_YES" => Some(Self::Yes), + "VOTE_OPTION_ABSTAIN" => Some(Self::Abstain), + "VOTE_OPTION_NO" => Some(Self::No), + "VOTE_OPTION_NO_WITH_VETO" => Some(Self::NoWithVeto), + _ => None, + } + } +} +/// ProposalStatus defines proposal statuses. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ProposalStatus { + /// An empty value is invalid and not allowed. + Unspecified = 0, + /// Initial status of a proposal when submitted. + Submitted = 1, + /// Final status of a proposal when the final tally is done and the outcome + /// passes the group policy's decision policy. + Accepted = 2, + /// Final status of a proposal when the final tally is done and the outcome + /// is rejected by the group policy's decision policy. + Rejected = 3, + /// Final status of a proposal when the group policy is modified before the + /// final tally. + Aborted = 4, + /// A proposal can be withdrawn before the voting start time by the owner. + /// When this happens the final status is Withdrawn. + Withdrawn = 5, +} +impl ProposalStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ProposalStatus::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", + ProposalStatus::Submitted => "PROPOSAL_STATUS_SUBMITTED", + ProposalStatus::Accepted => "PROPOSAL_STATUS_ACCEPTED", + ProposalStatus::Rejected => "PROPOSAL_STATUS_REJECTED", + ProposalStatus::Aborted => "PROPOSAL_STATUS_ABORTED", + ProposalStatus::Withdrawn => "PROPOSAL_STATUS_WITHDRAWN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PROPOSAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "PROPOSAL_STATUS_SUBMITTED" => Some(Self::Submitted), + "PROPOSAL_STATUS_ACCEPTED" => Some(Self::Accepted), + "PROPOSAL_STATUS_REJECTED" => Some(Self::Rejected), + "PROPOSAL_STATUS_ABORTED" => Some(Self::Aborted), + "PROPOSAL_STATUS_WITHDRAWN" => Some(Self::Withdrawn), + _ => None, + } + } +} +/// ProposalExecutorResult defines types of proposal executor results. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ProposalExecutorResult { + /// An empty value is not allowed. + Unspecified = 0, + /// We have not yet run the executor. + NotRun = 1, + /// The executor was successful and proposed action updated state. + Success = 2, + /// The executor returned an error and proposed action didn't update state. + Failure = 3, +} +impl ProposalExecutorResult { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ProposalExecutorResult::Unspecified => "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED", + ProposalExecutorResult::NotRun => "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + ProposalExecutorResult::Success => "PROPOSAL_EXECUTOR_RESULT_SUCCESS", + ProposalExecutorResult::Failure => "PROPOSAL_EXECUTOR_RESULT_FAILURE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED" => Some(Self::Unspecified), + "PROPOSAL_EXECUTOR_RESULT_NOT_RUN" => Some(Self::NotRun), + "PROPOSAL_EXECUTOR_RESULT_SUCCESS" => Some(Self::Success), + "PROPOSAL_EXECUTOR_RESULT_FAILURE" => Some(Self::Failure), + _ => None, + } + } +} +/// MsgCreateGroup is the Msg/CreateGroup request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroup { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// members defines the group members. + #[prost(message, repeated, tag = "2")] + pub members: ::prost::alloc::vec::Vec, + /// metadata is any arbitrary metadata to attached to the group. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, +} +/// MsgCreateGroupResponse is the Msg/CreateGroup response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroupResponse { + /// group_id is the unique ID of the newly created group. + #[prost(uint64, tag = "1")] + pub group_id: u64, +} +/// MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupMembers { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, + /// member_updates is the list of members to update, + /// set weight to 0 to remove a member. + #[prost(message, repeated, tag = "3")] + pub member_updates: ::prost::alloc::vec::Vec, +} +/// MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupMembersResponse {} +/// MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupAdmin { + /// admin is the current account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, + /// new_admin is the group new admin account address. + #[prost(string, tag = "3")] + pub new_admin: ::prost::alloc::string::String, +} +/// MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupAdminResponse {} +/// MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupMetadata { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, + /// metadata is the updated group's metadata. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, +} +/// MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupMetadataResponse {} +/// MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroupPolicy { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, + /// metadata is any arbitrary metadata attached to the group policy. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, + /// decision_policy specifies the group policy's decision policy. + #[prost(message, optional, tag = "4")] + pub decision_policy: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, +} +/// MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroupPolicyResponse { + /// address is the account address of the newly created group policy. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyAdmin { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_policy_address is the account address of the group policy. + #[prost(string, tag = "2")] + pub group_policy_address: ::prost::alloc::string::String, + /// new_admin is the new group policy admin. + #[prost(string, tag = "3")] + pub new_admin: ::prost::alloc::string::String, +} +/// MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroupWithPolicy { + /// admin is the account address of the group and group policy admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// members defines the group members. + #[prost(message, repeated, tag = "2")] + pub members: ::prost::alloc::vec::Vec, + /// group_metadata is any arbitrary metadata attached to the group. + #[prost(string, tag = "3")] + pub group_metadata: ::prost::alloc::string::String, + /// group_policy_metadata is any arbitrary metadata attached to the group policy. + #[prost(string, tag = "4")] + pub group_policy_metadata: ::prost::alloc::string::String, + /// group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + /// and group policy admin. + #[prost(bool, tag = "5")] + pub group_policy_as_admin: bool, + /// decision_policy specifies the group policy's decision policy. + #[prost(message, optional, tag = "6")] + pub decision_policy: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, +} +/// MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateGroupWithPolicyResponse { + /// group_id is the unique ID of the newly created group with policy. + #[prost(uint64, tag = "1")] + pub group_id: u64, + /// group_policy_address is the account address of the newly created group policy. + #[prost(string, tag = "2")] + pub group_policy_address: ::prost::alloc::string::String, +} +/// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyAdminResponse {} +/// MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyDecisionPolicy { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_policy_address is the account address of group policy. + #[prost(string, tag = "2")] + pub group_policy_address: ::prost::alloc::string::String, + /// decision_policy is the updated group policy's decision policy. + #[prost(message, optional, tag = "3")] + pub decision_policy: ::core::option::Option< + super::super::super::google::protobuf::Any, + >, +} +/// MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyDecisionPolicyResponse {} +/// MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyMetadata { + /// admin is the account address of the group admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// group_policy_address is the account address of group policy. + #[prost(string, tag = "2")] + pub group_policy_address: ::prost::alloc::string::String, + /// metadata is the updated group policy metadata. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, +} +/// MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateGroupPolicyMetadataResponse {} +/// MsgSubmitProposal is the Msg/SubmitProposal request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitProposal { + /// group_policy_address is the account address of group policy. + #[prost(string, tag = "1")] + pub group_policy_address: ::prost::alloc::string::String, + /// proposers are the account addresses of the proposers. + /// Proposers signatures will be counted as yes votes. + #[prost(string, repeated, tag = "2")] + pub proposers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// metadata is any arbitrary metadata to attached to the proposal. + #[prost(string, tag = "3")] + pub metadata: ::prost::alloc::string::String, + /// messages is a list of `sdk.Msg`s that will be executed if the proposal passes. + #[prost(message, repeated, tag = "4")] + pub messages: ::prost::alloc::vec::Vec, + /// exec defines the mode of execution of the proposal, + /// whether it should be executed immediately on creation or not. + /// If so, proposers signatures are considered as Yes votes. + #[prost(enumeration = "Exec", tag = "5")] + pub exec: i32, +} +/// MsgSubmitProposalResponse is the Msg/SubmitProposal response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitProposalResponse { + /// proposal is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// MsgWithdrawProposal is the Msg/WithdrawProposal request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawProposal { + /// proposal is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// address is the admin of the group policy or one of the proposer of the proposal. + #[prost(string, tag = "2")] + pub address: ::prost::alloc::string::String, +} +/// MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawProposalResponse {} +/// MsgVote is the Msg/Vote request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgVote { + /// proposal is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// voter is the voter account address. + #[prost(string, tag = "2")] + pub voter: ::prost::alloc::string::String, + /// option is the voter's choice on the proposal. + #[prost(enumeration = "VoteOption", tag = "3")] + pub option: i32, + /// metadata is any arbitrary metadata to attached to the vote. + #[prost(string, tag = "4")] + pub metadata: ::prost::alloc::string::String, + /// exec defines whether the proposal should be executed + /// immediately after voting or not. + #[prost(enumeration = "Exec", tag = "5")] + pub exec: i32, +} +/// MsgVoteResponse is the Msg/Vote response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgVoteResponse {} +/// MsgExec is the Msg/Exec request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExec { + /// proposal is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// executor is the account address used to execute the proposal. + #[prost(string, tag = "2")] + pub executor: ::prost::alloc::string::String, +} +/// MsgExecResponse is the Msg/Exec request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExecResponse { + /// result is the final result of the proposal execution. + #[prost(enumeration = "ProposalExecutorResult", tag = "2")] + pub result: i32, +} +/// MsgLeaveGroup is the Msg/LeaveGroup request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgLeaveGroup { + /// address is the account address of the group member. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "2")] + pub group_id: u64, +} +/// MsgLeaveGroupResponse is the Msg/LeaveGroup response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgLeaveGroupResponse {} +/// Exec defines modes of execution of a proposal on creation or on new vote. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Exec { + /// An empty value means that there should be a separate + /// MsgExec request for the proposal to execute. + Unspecified = 0, + /// Try to execute the proposal immediately. + /// If the proposal is not allowed per the DecisionPolicy, + /// the proposal will still be open and could + /// be executed at a later point. + Try = 1, +} +impl Exec { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Exec::Unspecified => "EXEC_UNSPECIFIED", + Exec::Try => "EXEC_TRY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EXEC_UNSPECIFIED" => Some(Self::Unspecified), + "EXEC_TRY" => Some(Self::Try), + _ => None, + } + } +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg is the cosmos.group.v1 Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + pub async fn create_group( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/CreateGroup", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "CreateGroup")); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupMembers updates the group members with given group id and admin address. + pub async fn update_group_members( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupMembers", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "UpdateGroupMembers")); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupAdmin updates the group admin with given group id and previous admin address. + pub async fn update_group_admin( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupAdmin", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "UpdateGroupAdmin")); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupMetadata updates the group metadata with given group id and admin address. + pub async fn update_group_metadata( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupMetadata", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "UpdateGroupMetadata")); + self.inner.unary(req, path, codec).await + } + /// CreateGroupPolicy creates a new group policy using given DecisionPolicy. + pub async fn create_group_policy( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/CreateGroupPolicy", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "CreateGroupPolicy")); + self.inner.unary(req, path, codec).await + } + /// CreateGroupWithPolicy creates a new group with policy. + pub async fn create_group_with_policy( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/CreateGroupWithPolicy", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "CreateGroupWithPolicy")); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupPolicyAdmin updates a group policy admin. + pub async fn update_group_policy_admin( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupPolicyAdmin", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.group.v1.Msg", "UpdateGroupPolicyAdmin"), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + pub async fn update_group_policy_decision_policy( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupPolicyDecisionPolicy", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.group.v1.Msg", + "UpdateGroupPolicyDecisionPolicy", + ), + ); + self.inner.unary(req, path, codec).await + } + /// UpdateGroupPolicyMetadata updates a group policy metadata. + pub async fn update_group_policy_metadata( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/UpdateGroupPolicyMetadata", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.group.v1.Msg", "UpdateGroupPolicyMetadata"), + ); + self.inner.unary(req, path, codec).await + } + /// SubmitProposal submits a new proposal. + pub async fn submit_proposal( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/SubmitProposal", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "SubmitProposal")); + self.inner.unary(req, path, codec).await + } + /// WithdrawProposal withdraws a proposal. + pub async fn withdraw_proposal( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/WithdrawProposal", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "WithdrawProposal")); + self.inner.unary(req, path, codec).await + } + /// Vote allows a voter to vote on a proposal. + pub async fn vote( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/Vote"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("cosmos.group.v1.Msg", "Vote")); + self.inner.unary(req, path, codec).await + } + /// Exec executes a proposal. + pub async fn exec( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/Exec"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("cosmos.group.v1.Msg", "Exec")); + self.inner.unary(req, path, codec).await + } + /// LeaveGroup allows a group member to leave the group. + pub async fn leave_group( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Msg/LeaveGroup", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Msg", "LeaveGroup")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. + async fn create_group( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupMembers updates the group members with given group id and admin address. + async fn update_group_members( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupAdmin updates the group admin with given group id and previous admin address. + async fn update_group_admin( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupMetadata updates the group metadata with given group id and admin address. + async fn update_group_metadata( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CreateGroupPolicy creates a new group policy using given DecisionPolicy. + async fn create_group_policy( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CreateGroupWithPolicy creates a new group with policy. + async fn create_group_with_policy( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupPolicyAdmin updates a group policy admin. + async fn update_group_policy_admin( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. + async fn update_group_policy_decision_policy( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// UpdateGroupPolicyMetadata updates a group policy metadata. + async fn update_group_policy_metadata( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// SubmitProposal submits a new proposal. + async fn submit_proposal( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// WithdrawProposal withdraws a proposal. + async fn withdraw_proposal( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Vote allows a voter to vote on a proposal. + async fn vote( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Exec executes a proposal. + async fn exec( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// LeaveGroup allows a group member to leave the group. + async fn leave_group( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg is the cosmos.group.v1 Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.group.v1.Msg/CreateGroup" => { + #[allow(non_camel_case_types)] + struct CreateGroupSvc(pub Arc); + impl tonic::server::UnaryService + for CreateGroupSvc { + type Response = super::MsgCreateGroupResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_group(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreateGroupSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupMembers" => { + #[allow(non_camel_case_types)] + struct UpdateGroupMembersSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for UpdateGroupMembersSvc { + type Response = super::MsgUpdateGroupMembersResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_members(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupMembersSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupAdmin" => { + #[allow(non_camel_case_types)] + struct UpdateGroupAdminSvc(pub Arc); + impl tonic::server::UnaryService + for UpdateGroupAdminSvc { + type Response = super::MsgUpdateGroupAdminResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_admin(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupAdminSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupMetadata" => { + #[allow(non_camel_case_types)] + struct UpdateGroupMetadataSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for UpdateGroupMetadataSvc { + type Response = super::MsgUpdateGroupMetadataResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_metadata(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupMetadataSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/CreateGroupPolicy" => { + #[allow(non_camel_case_types)] + struct CreateGroupPolicySvc(pub Arc); + impl tonic::server::UnaryService + for CreateGroupPolicySvc { + type Response = super::MsgCreateGroupPolicyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_group_policy(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreateGroupPolicySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/CreateGroupWithPolicy" => { + #[allow(non_camel_case_types)] + struct CreateGroupWithPolicySvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for CreateGroupWithPolicySvc { + type Response = super::MsgCreateGroupWithPolicyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_group_with_policy(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreateGroupWithPolicySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupPolicyAdmin" => { + #[allow(non_camel_case_types)] + struct UpdateGroupPolicyAdminSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for UpdateGroupPolicyAdminSvc { + type Response = super::MsgUpdateGroupPolicyAdminResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_policy_admin(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupPolicyAdminSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupPolicyDecisionPolicy" => { + #[allow(non_camel_case_types)] + struct UpdateGroupPolicyDecisionPolicySvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService< + super::MsgUpdateGroupPolicyDecisionPolicy, + > for UpdateGroupPolicyDecisionPolicySvc { + type Response = super::MsgUpdateGroupPolicyDecisionPolicyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::MsgUpdateGroupPolicyDecisionPolicy, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_policy_decision_policy(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupPolicyDecisionPolicySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/UpdateGroupPolicyMetadata" => { + #[allow(non_camel_case_types)] + struct UpdateGroupPolicyMetadataSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for UpdateGroupPolicyMetadataSvc { + type Response = super::MsgUpdateGroupPolicyMetadataResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).update_group_policy_metadata(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UpdateGroupPolicyMetadataSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/SubmitProposal" => { + #[allow(non_camel_case_types)] + struct SubmitProposalSvc(pub Arc); + impl tonic::server::UnaryService + for SubmitProposalSvc { + type Response = super::MsgSubmitProposalResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).submit_proposal(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SubmitProposalSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/WithdrawProposal" => { + #[allow(non_camel_case_types)] + struct WithdrawProposalSvc(pub Arc); + impl tonic::server::UnaryService + for WithdrawProposalSvc { + type Response = super::MsgWithdrawProposalResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).withdraw_proposal(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = WithdrawProposalSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/Vote" => { + #[allow(non_camel_case_types)] + struct VoteSvc(pub Arc); + impl tonic::server::UnaryService + for VoteSvc { + type Response = super::MsgVoteResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).vote(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = VoteSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/Exec" => { + #[allow(non_camel_case_types)] + struct ExecSvc(pub Arc); + impl tonic::server::UnaryService + for ExecSvc { + type Response = super::MsgExecResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).exec(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ExecSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Msg/LeaveGroup" => { + #[allow(non_camel_case_types)] + struct LeaveGroupSvc(pub Arc); + impl tonic::server::UnaryService + for LeaveGroupSvc { + type Response = super::MsgLeaveGroupResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).leave_group(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = LeaveGroupSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.group.v1.Msg"; + } +} +/// EventCreateGroup is an event emitted when a group is created. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventCreateGroup { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, +} +/// EventUpdateGroup is an event emitted when a group is updated. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventUpdateGroup { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, +} +/// EventCreateGroupPolicy is an event emitted when a group policy is created. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventCreateGroupPolicy { + /// address is the account address of the group policy. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// EventUpdateGroupPolicy is an event emitted when a group policy is updated. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventUpdateGroupPolicy { + /// address is the account address of the group policy. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// EventSubmitProposal is an event emitted when a proposal is created. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventSubmitProposal { + /// proposal_id is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// EventWithdrawProposal is an event emitted when a proposal is withdrawn. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventWithdrawProposal { + /// proposal_id is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// EventVote is an event emitted when a voter votes on a proposal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventVote { + /// proposal_id is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// EventExec is an event emitted when a proposal is executed. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventExec { + /// proposal_id is the unique ID of the proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// result is the proposal execution result. + #[prost(enumeration = "ProposalExecutorResult", tag = "2")] + pub result: i32, + /// logs contains error logs in case the execution result is FAILURE. + #[prost(string, tag = "3")] + pub logs: ::prost::alloc::string::String, +} +/// EventLeaveGroup is an event emitted when group member leaves the group. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventLeaveGroup { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, + /// address is the account address of the group member. + #[prost(string, tag = "2")] + pub address: ::prost::alloc::string::String, +} +/// QueryGroupInfoRequest is the Query/GroupInfo request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupInfoRequest { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, +} +/// QueryGroupInfoResponse is the Query/GroupInfo response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupInfoResponse { + /// info is the GroupInfo for the group. + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +/// QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPolicyInfoRequest { + /// address is the account address of the group policy. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, +} +/// QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPolicyInfoResponse { + /// info is the GroupPolicyInfo for the group policy. + #[prost(message, optional, tag = "1")] + pub info: ::core::option::Option, +} +/// QueryGroupMembersRequest is the Query/GroupMembers request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupMembersRequest { + /// group_id is the unique ID of the group. + #[prost(uint64, tag = "1")] + pub group_id: u64, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGroupMembersResponse is the Query/GroupMembersResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupMembersResponse { + /// members are the members of the group with given group_id. + #[prost(message, repeated, tag = "1")] + pub members: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupsByAdminRequest { + /// admin is the account address of a group's admin. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupsByAdminResponse { + /// groups are the groups info with the provided admin. + #[prost(message, repeated, tag = "1")] + pub groups: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPoliciesByGroupRequest { + /// group_id is the unique ID of the group policy's group. + #[prost(uint64, tag = "1")] + pub group_id: u64, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPoliciesByGroupResponse { + /// group_policies are the group policies info associated with the provided group. + #[prost(message, repeated, tag = "1")] + pub group_policies: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPoliciesByAdminRequest { + /// admin is the admin address of the group policy. + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupPoliciesByAdminResponse { + /// group_policies are the group policies info with provided admin. + #[prost(message, repeated, tag = "1")] + pub group_policies: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryProposalRequest is the Query/Proposal request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposalRequest { + /// proposal_id is the unique ID of a proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// QueryProposalResponse is the Query/Proposal response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposalResponse { + /// proposal is the proposal info. + #[prost(message, optional, tag = "1")] + pub proposal: ::core::option::Option, +} +/// QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposalsByGroupPolicyRequest { + /// address is the account address of the group policy related to proposals. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProposalsByGroupPolicyResponse { + /// proposals are the proposals with given group policy. + #[prost(message, repeated, tag = "1")] + pub proposals: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVoteByProposalVoterRequest { + /// proposal_id is the unique ID of a proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// voter is a proposal voter account address. + #[prost(string, tag = "2")] + pub voter: ::prost::alloc::string::String, +} +/// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVoteByProposalVoterResponse { + /// vote is the vote with given proposal_id and voter. + #[prost(message, optional, tag = "1")] + pub vote: ::core::option::Option, +} +/// QueryVotesByProposalRequest is the Query/VotesByProposal request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVotesByProposalRequest { + /// proposal_id is the unique ID of a proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryVotesByProposalResponse is the Query/VotesByProposal response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVotesByProposalResponse { + /// votes are the list of votes for given proposal_id. + #[prost(message, repeated, tag = "1")] + pub votes: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryVotesByVoterRequest is the Query/VotesByVoter request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVotesByVoterRequest { + /// voter is a proposal voter account address. + #[prost(string, tag = "1")] + pub voter: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryVotesByVoterResponse is the Query/VotesByVoter response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryVotesByVoterResponse { + /// votes are the list of votes by given voter. + #[prost(message, repeated, tag = "1")] + pub votes: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryGroupsByMemberRequest is the Query/GroupsByMember request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupsByMemberRequest { + /// address is the group member address. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryGroupsByMemberResponse is the Query/GroupsByMember response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGroupsByMemberResponse { + /// groups are the groups info with the provided group member. + #[prost(message, repeated, tag = "1")] + pub groups: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryTallyResultRequest is the Query/TallyResult request type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTallyResultRequest { + /// proposal_id is the unique id of a proposal. + #[prost(uint64, tag = "1")] + pub proposal_id: u64, +} +/// QueryTallyResultResponse is the Query/TallyResult response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTallyResultResponse { + /// tally defines the requested tally. + #[prost(message, optional, tag = "1")] + pub tally: ::core::option::Option, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query is the cosmos.group.v1 Query service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// GroupInfo queries group info based on group id. + pub async fn group_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "GroupInfo")); + self.inner.unary(req, path, codec).await + } + /// GroupPolicyInfo queries group policy info based on account address of group policy. + pub async fn group_policy_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupPolicyInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "GroupPolicyInfo")); + self.inner.unary(req, path, codec).await + } + /// GroupMembers queries members of a group + pub async fn group_members( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupMembers", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "GroupMembers")); + self.inner.unary(req, path, codec).await + } + /// GroupsByAdmin queries groups by admin address. + pub async fn groups_by_admin( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupsByAdmin", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "GroupsByAdmin")); + self.inner.unary(req, path, codec).await + } + /// GroupPoliciesByGroup queries group policies by group id. + pub async fn group_policies_by_group( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupPoliciesByGroup", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.group.v1.Query", "GroupPoliciesByGroup"), + ); + self.inner.unary(req, path, codec).await + } + /// GroupsByAdmin queries group policies by admin address. + pub async fn group_policies_by_admin( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupPoliciesByAdmin", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.group.v1.Query", "GroupPoliciesByAdmin"), + ); + self.inner.unary(req, path, codec).await + } + /// Proposal queries a proposal based on proposal id. + pub async fn proposal( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/Proposal", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "Proposal")); + self.inner.unary(req, path, codec).await + } + /// ProposalsByGroupPolicy queries proposals based on account address of group policy. + pub async fn proposals_by_group_policy( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/ProposalsByGroupPolicy", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.group.v1.Query", "ProposalsByGroupPolicy"), + ); + self.inner.unary(req, path, codec).await + } + /// VoteByProposalVoter queries a vote by proposal id and voter. + pub async fn vote_by_proposal_voter( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/VoteByProposalVoter", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "VoteByProposalVoter")); + self.inner.unary(req, path, codec).await + } + /// VotesByProposal queries a vote by proposal. + pub async fn votes_by_proposal( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/VotesByProposal", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "VotesByProposal")); + self.inner.unary(req, path, codec).await + } + /// VotesByVoter queries a vote by voter. + pub async fn votes_by_voter( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/VotesByVoter", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "VotesByVoter")); + self.inner.unary(req, path, codec).await + } + /// GroupsByMember queries groups by member address. + pub async fn groups_by_member( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/GroupsByMember", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "GroupsByMember")); + self.inner.unary(req, path, codec).await + } + /// TallyResult returns the tally result of a proposal. If the proposal is + /// still in voting period, then this query computes the current tally state, + /// which might not be final. On the other hand, if the proposal is final, + /// then it simply returns the `final_tally_result` state stored in the + /// proposal itself. + pub async fn tally_result( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.group.v1.Query/TallyResult", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.group.v1.Query", "TallyResult")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// GroupInfo queries group info based on group id. + async fn group_info( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupPolicyInfo queries group policy info based on account address of group policy. + async fn group_policy_info( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupMembers queries members of a group + async fn group_members( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupsByAdmin queries groups by admin address. + async fn groups_by_admin( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupPoliciesByGroup queries group policies by group id. + async fn group_policies_by_group( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupsByAdmin queries group policies by admin address. + async fn group_policies_by_admin( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Proposal queries a proposal based on proposal id. + async fn proposal( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// ProposalsByGroupPolicy queries proposals based on account address of group policy. + async fn proposals_by_group_policy( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// VoteByProposalVoter queries a vote by proposal id and voter. + async fn vote_by_proposal_voter( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// VotesByProposal queries a vote by proposal. + async fn votes_by_proposal( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// VotesByVoter queries a vote by voter. + async fn votes_by_voter( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// GroupsByMember queries groups by member address. + async fn groups_by_member( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// TallyResult returns the tally result of a proposal. If the proposal is + /// still in voting period, then this query computes the current tally state, + /// which might not be final. On the other hand, if the proposal is final, + /// then it simply returns the `final_tally_result` state stored in the + /// proposal itself. + async fn tally_result( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query is the cosmos.group.v1 Query service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.group.v1.Query/GroupInfo" => { + #[allow(non_camel_case_types)] + struct GroupInfoSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GroupInfoSvc { + type Response = super::QueryGroupInfoResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).group_info(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupPolicyInfo" => { + #[allow(non_camel_case_types)] + struct GroupPolicyInfoSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GroupPolicyInfoSvc { + type Response = super::QueryGroupPolicyInfoResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).group_policy_info(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupPolicyInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupMembers" => { + #[allow(non_camel_case_types)] + struct GroupMembersSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GroupMembersSvc { + type Response = super::QueryGroupMembersResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).group_members(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupMembersSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupsByAdmin" => { + #[allow(non_camel_case_types)] + struct GroupsByAdminSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GroupsByAdminSvc { + type Response = super::QueryGroupsByAdminResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).groups_by_admin(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupsByAdminSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupPoliciesByGroup" => { + #[allow(non_camel_case_types)] + struct GroupPoliciesByGroupSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryGroupPoliciesByGroupRequest, + > for GroupPoliciesByGroupSvc { + type Response = super::QueryGroupPoliciesByGroupResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryGroupPoliciesByGroupRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).group_policies_by_group(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupPoliciesByGroupSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupPoliciesByAdmin" => { + #[allow(non_camel_case_types)] + struct GroupPoliciesByAdminSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryGroupPoliciesByAdminRequest, + > for GroupPoliciesByAdminSvc { + type Response = super::QueryGroupPoliciesByAdminResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryGroupPoliciesByAdminRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).group_policies_by_admin(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupPoliciesByAdminSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/Proposal" => { + #[allow(non_camel_case_types)] + struct ProposalSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ProposalSvc { + type Response = super::QueryProposalResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).proposal(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ProposalSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/ProposalsByGroupPolicy" => { + #[allow(non_camel_case_types)] + struct ProposalsByGroupPolicySvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService< + super::QueryProposalsByGroupPolicyRequest, + > for ProposalsByGroupPolicySvc { + type Response = super::QueryProposalsByGroupPolicyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryProposalsByGroupPolicyRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).proposals_by_group_policy(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ProposalsByGroupPolicySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/VoteByProposalVoter" => { + #[allow(non_camel_case_types)] + struct VoteByProposalVoterSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for VoteByProposalVoterSvc { + type Response = super::QueryVoteByProposalVoterResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryVoteByProposalVoterRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).vote_by_proposal_voter(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = VoteByProposalVoterSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/VotesByProposal" => { + #[allow(non_camel_case_types)] + struct VotesByProposalSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for VotesByProposalSvc { + type Response = super::QueryVotesByProposalResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).votes_by_proposal(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = VotesByProposalSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/VotesByVoter" => { + #[allow(non_camel_case_types)] + struct VotesByVoterSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for VotesByVoterSvc { + type Response = super::QueryVotesByVoterResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).votes_by_voter(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = VotesByVoterSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/GroupsByMember" => { + #[allow(non_camel_case_types)] + struct GroupsByMemberSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for GroupsByMemberSvc { + type Response = super::QueryGroupsByMemberResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).groups_by_member(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GroupsByMemberSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.group.v1.Query/TallyResult" => { + #[allow(non_camel_case_types)] + struct TallyResultSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for TallyResultSvc { + type Response = super::QueryTallyResultResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).tally_result(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = TallyResultSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.group.v1.Query"; + } +} +/// GenesisState defines the group module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// group_seq is the group table orm.Sequence, + /// it is used to get the next group ID. + #[prost(uint64, tag = "1")] + pub group_seq: u64, + /// groups is the list of groups info. + #[prost(message, repeated, tag = "2")] + pub groups: ::prost::alloc::vec::Vec, + /// group_members is the list of groups members. + #[prost(message, repeated, tag = "3")] + pub group_members: ::prost::alloc::vec::Vec, + /// group_policy_seq is the group policy table orm.Sequence, + /// it is used to generate the next group policy account address. + #[prost(uint64, tag = "4")] + pub group_policy_seq: u64, + /// group_policies is the list of group policies info. + #[prost(message, repeated, tag = "5")] + pub group_policies: ::prost::alloc::vec::Vec, + /// proposal_seq is the proposal table orm.Sequence, + /// it is used to get the next proposal ID. + #[prost(uint64, tag = "6")] + pub proposal_seq: u64, + /// proposals is the list of proposals. + #[prost(message, repeated, tag = "7")] + pub proposals: ::prost::alloc::vec::Vec, + /// votes is the list of votes. + #[prost(message, repeated, tag = "8")] + pub votes: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.mint.v1beta1.rs b/src/prost/cosmos.mint.v1beta1.rs new file mode 100644 index 00000000..a1d30863 --- /dev/null +++ b/src/prost/cosmos.mint.v1beta1.rs @@ -0,0 +1,539 @@ +/// Minter represents the minting state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Minter { + /// current annual inflation rate + #[prost(string, tag = "1")] + pub inflation: ::prost::alloc::string::String, + /// current annual expected provisions + #[prost(string, tag = "2")] + pub annual_provisions: ::prost::alloc::string::String, +} +/// Params holds parameters for the mint module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// type of coin to mint + #[prost(string, tag = "1")] + pub mint_denom: ::prost::alloc::string::String, + /// maximum annual change in inflation rate + #[prost(string, tag = "2")] + pub inflation_rate_change: ::prost::alloc::string::String, + /// maximum inflation rate + #[prost(string, tag = "3")] + pub inflation_max: ::prost::alloc::string::String, + /// minimum inflation rate + #[prost(string, tag = "4")] + pub inflation_min: ::prost::alloc::string::String, + /// goal of percent bonded atoms + #[prost(string, tag = "5")] + pub goal_bonded: ::prost::alloc::string::String, + /// expected blocks per year + #[prost(uint64, tag = "6")] + pub blocks_per_year: u64, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryInflationRequest is the request type for the Query/Inflation RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryInflationRequest {} +/// QueryInflationResponse is the response type for the Query/Inflation RPC +/// method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryInflationResponse { + /// inflation is the current minting inflation value. + #[prost(bytes = "vec", tag = "1")] + pub inflation: ::prost::alloc::vec::Vec, +} +/// QueryAnnualProvisionsRequest is the request type for the +/// Query/AnnualProvisions RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAnnualProvisionsRequest {} +/// QueryAnnualProvisionsResponse is the response type for the +/// Query/AnnualProvisions RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAnnualProvisionsResponse { + /// annual_provisions is the current minting annual provisions value. + #[prost(bytes = "vec", tag = "1")] + pub annual_provisions: ::prost::alloc::vec::Vec, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query provides defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Params returns the total set of minting parameters. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.mint.v1beta1.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.mint.v1beta1.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// Inflation returns the current minting inflation value. + pub async fn inflation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.mint.v1beta1.Query/Inflation", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.mint.v1beta1.Query", "Inflation")); + self.inner.unary(req, path, codec).await + } + /// AnnualProvisions current minting annual provisions value. + pub async fn annual_provisions( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.mint.v1beta1.Query/AnnualProvisions", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.mint.v1beta1.Query", "AnnualProvisions"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Params returns the total set of minting parameters. + async fn params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Inflation returns the current minting inflation value. + async fn inflation( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// AnnualProvisions current minting annual provisions value. + async fn annual_provisions( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query provides defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.mint.v1beta1.Query/Params" => { + #[allow(non_camel_case_types)] + struct ParamsSvc(pub Arc); + impl tonic::server::UnaryService + for ParamsSvc { + type Response = super::QueryParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).params(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.mint.v1beta1.Query/Inflation" => { + #[allow(non_camel_case_types)] + struct InflationSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for InflationSvc { + type Response = super::QueryInflationResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).inflation(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = InflationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.mint.v1beta1.Query/AnnualProvisions" => { + #[allow(non_camel_case_types)] + struct AnnualProvisionsSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for AnnualProvisionsSvc { + type Response = super::QueryAnnualProvisionsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).annual_provisions(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AnnualProvisionsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.mint.v1beta1.Query"; + } +} +/// GenesisState defines the mint module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// minter is a space for holding current inflation information. + #[prost(message, optional, tag = "1")] + pub minter: ::core::option::Option, + /// params defines all the paramaters of the module. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} diff --git a/src/prost/cosmos.nft.v1beta1.rs b/src/prost/cosmos.nft.v1beta1.rs new file mode 100644 index 00000000..95e5cd02 --- /dev/null +++ b/src/prost/cosmos.nft.v1beta1.rs @@ -0,0 +1,1293 @@ +/// MsgSend represents a message to send a nft from one account to another account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSend { + /// class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + /// id defines the unique identification of nft + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + /// sender is the address of the owner of nft + #[prost(string, tag = "3")] + pub sender: ::prost::alloc::string::String, + /// receiver is the receiver address of nft + #[prost(string, tag = "4")] + pub receiver: ::prost::alloc::string::String, +} +/// MsgSendResponse defines the Msg/Send response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSendResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the nft Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Send defines a method to send a nft from one account to another account. + pub async fn send( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Msg/Send", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Msg", "Send")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// Send defines a method to send a nft from one account to another account. + async fn send( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + /// Msg defines the nft Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.nft.v1beta1.Msg/Send" => { + #[allow(non_camel_case_types)] + struct SendSvc(pub Arc); + impl tonic::server::UnaryService + for SendSvc { + type Response = super::MsgSendResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).send(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SendSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.nft.v1beta1.Msg"; + } +} +/// Class defines the class of the nft type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Class { + /// id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// name defines the human-readable name of the NFT classification. Optional + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// symbol is an abbreviated name for nft classification. Optional + #[prost(string, tag = "3")] + pub symbol: ::prost::alloc::string::String, + /// description is a brief description of nft classification. Optional + #[prost(string, tag = "4")] + pub description: ::prost::alloc::string::String, + /// uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional + #[prost(string, tag = "5")] + pub uri: ::prost::alloc::string::String, + /// uri_hash is a hash of the document pointed by uri. Optional + #[prost(string, tag = "6")] + pub uri_hash: ::prost::alloc::string::String, + /// data is the app specific metadata of the NFT class. Optional + #[prost(message, optional, tag = "7")] + pub data: ::core::option::Option, +} +/// NFT defines the NFT. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Nft { + /// class_id associated with the NFT, similar to the contract address of ERC721 + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + /// id is a unique identifier of the NFT + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + /// uri for the NFT metadata stored off chain + #[prost(string, tag = "3")] + pub uri: ::prost::alloc::string::String, + /// uri_hash is a hash of the document pointed by uri + #[prost(string, tag = "4")] + pub uri_hash: ::prost::alloc::string::String, + /// data is an app specific data of the NFT. Optional + #[prost(message, optional, tag = "10")] + pub data: ::core::option::Option, +} +/// QueryBalanceRequest is the request type for the Query/Balance RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBalanceRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub owner: ::prost::alloc::string::String, +} +/// QueryBalanceResponse is the response type for the Query/Balance RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBalanceResponse { + #[prost(uint64, tag = "1")] + pub amount: u64, +} +/// QueryOwnerRequest is the request type for the Query/Owner RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryOwnerRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, +} +/// QueryOwnerResponse is the response type for the Query/Owner RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryOwnerResponse { + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, +} +/// QuerySupplyRequest is the request type for the Query/Supply RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySupplyRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, +} +/// QuerySupplyResponse is the response type for the Query/Supply RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySupplyResponse { + #[prost(uint64, tag = "1")] + pub amount: u64, +} +/// QueryNFTstRequest is the request type for the Query/NFTs RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNfTsRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub owner: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryNFTsResponse is the response type for the Query/NFTs RPC methods +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNfTsResponse { + #[prost(message, repeated, tag = "1")] + pub nfts: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// QueryNFTRequest is the request type for the Query/NFT RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNftRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, +} +/// QueryNFTResponse is the response type for the Query/NFT RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryNftResponse { + #[prost(message, optional, tag = "1")] + pub nft: ::core::option::Option, +} +/// QueryClassRequest is the request type for the Query/Class RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassRequest { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, +} +/// QueryClassResponse is the response type for the Query/Class RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassResponse { + #[prost(message, optional, tag = "1")] + pub class: ::core::option::Option, +} +/// QueryClassesRequest is the request type for the Query/Classes RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassesRequest { + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QueryClassesResponse is the response type for the Query/Classes RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryClassesResponse { + #[prost(message, repeated, tag = "1")] + pub classes: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + pub async fn balance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/Balance", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "Balance")); + self.inner.unary(req, path, codec).await + } + /// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + pub async fn owner( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/Owner", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "Owner")); + self.inner.unary(req, path, codec).await + } + /// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + pub async fn supply( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/Supply", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "Supply")); + self.inner.unary(req, path, codec).await + } + /// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + /// ERC721Enumerable + pub async fn nf_ts( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/NFTs", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "NFTs")); + self.inner.unary(req, path, codec).await + } + /// NFT queries an NFT based on its class and id. + pub async fn nft( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/NFT", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "NFT")); + self.inner.unary(req, path, codec).await + } + /// Class queries an NFT class based on its id + pub async fn class( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/Class", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "Class")); + self.inner.unary(req, path, codec).await + } + /// Classes queries all NFT classes + pub async fn classes( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.nft.v1beta1.Query/Classes", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.nft.v1beta1.Query", "Classes")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + async fn balance( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + async fn owner( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. + async fn supply( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + /// ERC721Enumerable + async fn nf_ts( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// NFT queries an NFT based on its class and id. + async fn nft( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Class queries an NFT class based on its id + async fn class( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Classes queries all NFT classes + async fn classes( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.nft.v1beta1.Query/Balance" => { + #[allow(non_camel_case_types)] + struct BalanceSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for BalanceSvc { + type Response = super::QueryBalanceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).balance(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = BalanceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/Owner" => { + #[allow(non_camel_case_types)] + struct OwnerSvc(pub Arc); + impl tonic::server::UnaryService + for OwnerSvc { + type Response = super::QueryOwnerResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).owner(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = OwnerSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/Supply" => { + #[allow(non_camel_case_types)] + struct SupplySvc(pub Arc); + impl tonic::server::UnaryService + for SupplySvc { + type Response = super::QuerySupplyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).supply(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SupplySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/NFTs" => { + #[allow(non_camel_case_types)] + struct NFTsSvc(pub Arc); + impl tonic::server::UnaryService + for NFTsSvc { + type Response = super::QueryNfTsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).nf_ts(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NFTsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/NFT" => { + #[allow(non_camel_case_types)] + struct NFTSvc(pub Arc); + impl tonic::server::UnaryService + for NFTSvc { + type Response = super::QueryNftResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).nft(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = NFTSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/Class" => { + #[allow(non_camel_case_types)] + struct ClassSvc(pub Arc); + impl tonic::server::UnaryService + for ClassSvc { + type Response = super::QueryClassResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).class(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ClassSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.nft.v1beta1.Query/Classes" => { + #[allow(non_camel_case_types)] + struct ClassesSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ClassesSvc { + type Response = super::QueryClassesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).classes(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ClassesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.nft.v1beta1.Query"; + } +} +/// EventSend is emitted on Msg/Send +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventSend { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub receiver: ::prost::alloc::string::String, +} +/// EventMint is emitted on Mint +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventMint { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub owner: ::prost::alloc::string::String, +} +/// EventBurn is emitted on Burn +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventBurn { + #[prost(string, tag = "1")] + pub class_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub owner: ::prost::alloc::string::String, +} +/// GenesisState defines the nft module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// class defines the class of the nft type. + #[prost(message, repeated, tag = "1")] + pub classes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Entry Defines all nft owned by a person +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Entry { + /// owner is the owner address of the following nft + #[prost(string, tag = "1")] + pub owner: ::prost::alloc::string::String, + /// nfts is a group of nfts of the same owner + #[prost(message, repeated, tag = "2")] + pub nfts: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/cosmos.orm.module.v1alpha1.rs b/src/prost/cosmos.orm.module.v1alpha1.rs new file mode 100644 index 00000000..eedcb714 --- /dev/null +++ b/src/prost/cosmos.orm.module.v1alpha1.rs @@ -0,0 +1,6 @@ +/// Module defines the ORM module which adds providers to the app container for +/// module-scoped DB's. In the future it may provide gRPC services for interacting +/// with ORM data. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module {} diff --git a/src/prost/cosmos.orm.v1.rs b/src/prost/cosmos.orm.v1.rs new file mode 100644 index 00000000..b4ba9a05 --- /dev/null +++ b/src/prost/cosmos.orm.v1.rs @@ -0,0 +1,92 @@ +/// TableDescriptor describes an ORM table. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TableDescriptor { + /// primary_key defines the primary key for the table. + #[prost(message, optional, tag = "1")] + pub primary_key: ::core::option::Option, + /// index defines one or more secondary indexes. + #[prost(message, repeated, tag = "2")] + pub index: ::prost::alloc::vec::Vec, + /// id is a non-zero integer ID that must be unique within the + /// tables and singletons in this file. It may be deprecated in the future when this + /// can be auto-generated. + #[prost(uint32, tag = "3")] + pub id: u32, +} +/// PrimaryKeyDescriptor describes a table primary key. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrimaryKeyDescriptor { + /// fields is a comma-separated list of fields in the primary key. Spaces are + /// not allowed. Supported field types, their encodings, and any applicable constraints + /// are described below. + /// - uint32 are encoded as 2,3,4 or 5 bytes using a compact encoding that + /// is suitable for sorted iteration (not varint encoding). This type is + /// well-suited for small integers. + /// - uint64 are encoded as 2,4,6 or 9 bytes using a compact encoding that + /// is suitable for sorted iteration (not varint encoding). This type is + /// well-suited for small integers such as auto-incrementing sequences. + /// - fixed32, fixed64 are encoded as big-endian fixed width bytes and support + /// sorted iteration. These types are well-suited for encoding fixed with + /// decimals as integers. + /// - string's are encoded as raw bytes in terminal key segments and null-terminated + /// in non-terminal segments. Null characters are thus forbidden in strings. + /// string fields support sorted iteration. + /// - bytes are encoded as raw bytes in terminal segments and length-prefixed + /// with a 32-bit unsigned varint in non-terminal segments. + /// - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with + /// an encoding that enables sorted iteration. + /// - google.protobuf.Timestamp and google.protobuf.Duration are encoded + /// as 12 bytes using an encoding that enables sorted iteration. + /// - enum fields are encoded using varint encoding and do not support sorted + /// iteration. + /// - bool fields are encoded as a single byte 0 or 1. + /// + /// All other fields types are unsupported in keys including repeated and + /// oneof fields. + /// + /// Primary keys are prefixed by the varint encoded table id and the byte 0x0 + /// plus any additional prefix specified by the schema. + #[prost(string, tag = "1")] + pub fields: ::prost::alloc::string::String, + /// auto_increment specifies that the primary key is generated by an + /// auto-incrementing integer. If this is set to true fields must only + /// contain one field of that is of type uint64. + #[prost(bool, tag = "2")] + pub auto_increment: bool, +} +/// PrimaryKeyDescriptor describes a table secondary index. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecondaryIndexDescriptor { + /// fields is a comma-separated list of fields in the index. The supported + /// field types are the same as those for PrimaryKeyDescriptor.fields. + /// Index keys are prefixed by the varint encoded table id and the varint + /// encoded index id plus any additional prefix specified by the schema. + /// + /// In addition the field segments, non-unique index keys are suffixed with + /// any additional primary key fields not present in the index fields so that the + /// primary key can be reconstructed. Unique indexes instead of being suffixed + /// store the remaining primary key fields in the value.. + #[prost(string, tag = "1")] + pub fields: ::prost::alloc::string::String, + /// id is a non-zero integer ID that must be unique within the indexes for this + /// table and less than 32768. It may be deprecated in the future when this can + /// be auto-generated. + #[prost(uint32, tag = "2")] + pub id: u32, + /// unique specifies that this an unique index. + #[prost(bool, tag = "3")] + pub unique: bool, +} +/// TableDescriptor describes an ORM singleton table which has at most one instance. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SingletonDescriptor { + /// id is a non-zero integer ID that must be unique within the + /// tables and singletons in this file. It may be deprecated in the future when this + /// can be auto-generated. + #[prost(uint32, tag = "1")] + pub id: u32, +} diff --git a/src/prost/cosmos.orm.v1alpha1.rs b/src/prost/cosmos.orm.v1alpha1.rs new file mode 100644 index 00000000..136772c2 --- /dev/null +++ b/src/prost/cosmos.orm.v1alpha1.rs @@ -0,0 +1,93 @@ +/// ModuleSchemaDescriptor describe's a module's ORM schema. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleSchemaDescriptor { + #[prost(message, repeated, tag = "1")] + pub schema_file: ::prost::alloc::vec::Vec, + /// prefix is an optional prefix that precedes all keys in this module's + /// store. + #[prost(bytes = "vec", tag = "2")] + pub prefix: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `ModuleSchemaDescriptor`. +pub mod module_schema_descriptor { + /// FileEntry describes an ORM file used in a module. + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct FileEntry { + /// id is a prefix that will be varint encoded and prepended to all the + /// table keys specified in the file's tables. + #[prost(uint32, tag = "1")] + pub id: u32, + /// proto_file_name is the name of a file .proto in that contains + /// table definitions. The .proto file must be in a package that the + /// module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. + #[prost(string, tag = "2")] + pub proto_file_name: ::prost::alloc::string::String, + /// storage_type optionally indicates the type of storage this file's + /// tables should used. If it is left unspecified, the default KV-storage + /// of the app will be used. + #[prost(enumeration = "super::StorageType", tag = "3")] + pub storage_type: i32, + } +} +/// StorageType +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StorageType { + /// STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent + /// KV-storage where primary key entries are stored in merkle-tree + /// backed commitment storage and indexes and seqs are stored in + /// fast index storage. Note that the Cosmos SDK before store/v2alpha1 + /// does not support this. + DefaultUnspecified = 0, + /// STORAGE_TYPE_MEMORY indicates in-memory storage that will be + /// reloaded every time an app restarts. Tables with this type of storage + /// will by default be ignored when importing and exporting a module's + /// state from JSON. + Memory = 1, + /// STORAGE_TYPE_TRANSIENT indicates transient storage that is reset + /// at the end of every block. Tables with this type of storage + /// will by default be ignored when importing and exporting a module's + /// state from JSON. + Transient = 2, + /// STORAGE_TYPE_INDEX indicates persistent storage which is not backed + /// by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK + /// before store/v2alpha1 does not support this. + Index = 3, + /// STORAGE_TYPE_INDEX indicates persistent storage which is backed by + /// a merkle-tree. With this type of storage, both primary and index keys + /// will affect the app hash and this is generally less efficient + /// than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index + /// keys into index storage. Note that modules built with the + /// Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT + /// instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX + /// because this is the only type of persistent storage available. + Commitment = 4, +} +impl StorageType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + StorageType::DefaultUnspecified => "STORAGE_TYPE_DEFAULT_UNSPECIFIED", + StorageType::Memory => "STORAGE_TYPE_MEMORY", + StorageType::Transient => "STORAGE_TYPE_TRANSIENT", + StorageType::Index => "STORAGE_TYPE_INDEX", + StorageType::Commitment => "STORAGE_TYPE_COMMITMENT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STORAGE_TYPE_DEFAULT_UNSPECIFIED" => Some(Self::DefaultUnspecified), + "STORAGE_TYPE_MEMORY" => Some(Self::Memory), + "STORAGE_TYPE_TRANSIENT" => Some(Self::Transient), + "STORAGE_TYPE_INDEX" => Some(Self::Index), + "STORAGE_TYPE_COMMITMENT" => Some(Self::Commitment), + _ => None, + } + } +} diff --git a/src/prost/cosmos.params.v1beta1.rs b/src/prost/cosmos.params.v1beta1.rs new file mode 100644 index 00000000..5ce559c2 --- /dev/null +++ b/src/prost/cosmos.params.v1beta1.rs @@ -0,0 +1,450 @@ +/// ParameterChangeProposal defines a proposal to change one or more parameters. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ParameterChangeProposal { + #[prost(string, tag = "1")] + pub title: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub changes: ::prost::alloc::vec::Vec, +} +/// ParamChange defines an individual parameter change, for use in +/// ParameterChangeProposal. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ParamChange { + #[prost(string, tag = "1")] + pub subspace: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub value: ::prost::alloc::string::String, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest { + /// subspace defines the module to query the parameter for. + #[prost(string, tag = "1")] + pub subspace: ::prost::alloc::string::String, + /// key defines the key of the parameter in the subspace. + #[prost(string, tag = "2")] + pub key: ::prost::alloc::string::String, +} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// param defines the queried parameter. + #[prost(message, optional, tag = "1")] + pub param: ::core::option::Option, +} +/// QuerySubspacesRequest defines a request type for querying for all registered +/// subspaces and all keys for a subspace. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySubspacesRequest {} +/// QuerySubspacesResponse defines the response types for querying for all +/// registered subspaces and all keys for a subspace. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySubspacesResponse { + #[prost(message, repeated, tag = "1")] + pub subspaces: ::prost::alloc::vec::Vec, +} +/// Subspace defines a parameter subspace name and all the keys that exist for +/// the subspace. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Subspace { + #[prost(string, tag = "1")] + pub subspace: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service. + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Params queries a specific parameter of a module, given its subspace and + /// key. + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.params.v1beta1.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.params.v1beta1.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// Subspaces queries for all registered subspaces and all keys for a subspace. + /// + /// Since: cosmos-sdk 0.46 + pub async fn subspaces( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.params.v1beta1.Query/Subspaces", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.params.v1beta1.Query", "Subspaces")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Params queries a specific parameter of a module, given its subspace and + /// key. + async fn params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Subspaces queries for all registered subspaces and all keys for a subspace. + /// + /// Since: cosmos-sdk 0.46 + async fn subspaces( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query defines the gRPC querier service. + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.params.v1beta1.Query/Params" => { + #[allow(non_camel_case_types)] + struct ParamsSvc(pub Arc); + impl tonic::server::UnaryService + for ParamsSvc { + type Response = super::QueryParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).params(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.params.v1beta1.Query/Subspaces" => { + #[allow(non_camel_case_types)] + struct SubspacesSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for SubspacesSvc { + type Response = super::QuerySubspacesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).subspaces(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SubspacesSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.params.v1beta1.Query"; + } +} diff --git a/src/prost/cosmos.slashing.v1beta1.rs b/src/prost/cosmos.slashing.v1beta1.rs new file mode 100644 index 00000000..eb94decd --- /dev/null +++ b/src/prost/cosmos.slashing.v1beta1.rs @@ -0,0 +1,915 @@ +/// MsgUnjail defines the Msg/Unjail request type +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUnjail { + #[prost(string, tag = "1")] + pub validator_addr: ::prost::alloc::string::String, +} +/// MsgUnjailResponse defines the Msg/Unjail response type +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUnjailResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the slashing Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Unjail defines a method for unjailing a jailed validator, thus returning + /// them into the bonded validator set, so they can begin receiving provisions + /// and rewards again. + pub async fn unjail( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.slashing.v1beta1.Msg/Unjail", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.slashing.v1beta1.Msg", "Unjail")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// Unjail defines a method for unjailing a jailed validator, thus returning + /// them into the bonded validator set, so they can begin receiving provisions + /// and rewards again. + async fn unjail( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the slashing Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.slashing.v1beta1.Msg/Unjail" => { + #[allow(non_camel_case_types)] + struct UnjailSvc(pub Arc); + impl tonic::server::UnaryService + for UnjailSvc { + type Response = super::MsgUnjailResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).unjail(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = UnjailSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.slashing.v1beta1.Msg"; + } +} +/// ValidatorSigningInfo defines a validator's signing info for monitoring their +/// liveness activity. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSigningInfo { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Height at which validator was first a candidate OR was unjailed + #[prost(int64, tag = "2")] + pub start_height: i64, + /// Index which is incremented each time the validator was a bonded + /// in a block and may have signed a precommit or not. This in conjunction with the + /// `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + #[prost(int64, tag = "3")] + pub index_offset: i64, + /// Timestamp until which the validator is jailed due to liveness downtime. + #[prost(message, optional, tag = "4")] + pub jailed_until: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// Whether or not a validator has been tombstoned (killed out of validator set). It is set + /// once the validator commits an equivocation or for any other configured misbehiavor. + #[prost(bool, tag = "5")] + pub tombstoned: bool, + /// A counter kept to avoid unnecessary array reads. + /// Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + #[prost(int64, tag = "6")] + pub missed_blocks_counter: i64, +} +/// Params represents the parameters used for by the slashing module. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(int64, tag = "1")] + pub signed_blocks_window: i64, + #[prost(bytes = "vec", tag = "2")] + pub min_signed_per_window: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub downtime_jail_duration: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + #[prost(bytes = "vec", tag = "4")] + pub slash_fraction_double_sign: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "5")] + pub slash_fraction_downtime: ::prost::alloc::vec::Vec, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySigningInfoRequest { + /// cons_address is the address to query signing info of + #[prost(string, tag = "1")] + pub cons_address: ::prost::alloc::string::String, +} +/// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySigningInfoResponse { + /// val_signing_info is the signing info of requested val cons address + #[prost(message, optional, tag = "1")] + pub val_signing_info: ::core::option::Option, +} +/// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySigningInfosRequest { + #[prost(message, optional, tag = "1")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageRequest, + >, +} +/// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC +/// method +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySigningInfosResponse { + /// info is the signing info of all validators + #[prost(message, repeated, tag = "1")] + pub info: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query provides defines the gRPC querier service + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Params queries the parameters of slashing module + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.slashing.v1beta1.Query/Params", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.slashing.v1beta1.Query", "Params")); + self.inner.unary(req, path, codec).await + } + /// SigningInfo queries the signing info of given cons address + pub async fn signing_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.slashing.v1beta1.Query/SigningInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cosmos.slashing.v1beta1.Query", "SigningInfo")); + self.inner.unary(req, path, codec).await + } + /// SigningInfos queries signing info of all validators + pub async fn signing_infos( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.slashing.v1beta1.Query/SigningInfos", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.slashing.v1beta1.Query", "SigningInfos"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +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 { + /// Params queries the parameters of slashing module + async fn params( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// SigningInfo queries the signing info of given cons address + async fn signing_info( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// SigningInfos queries signing info of all validators + async fn signing_infos( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query provides defines the gRPC querier service + #[derive(Debug)] + pub struct QueryServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + 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.slashing.v1beta1.Query/Params" => { + #[allow(non_camel_case_types)] + struct ParamsSvc(pub Arc); + impl tonic::server::UnaryService + for ParamsSvc { + type Response = super::QueryParamsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { (*inner).params(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ParamsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.slashing.v1beta1.Query/SigningInfo" => { + #[allow(non_camel_case_types)] + struct SigningInfoSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for SigningInfoSvc { + type Response = super::QuerySigningInfoResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).signing_info(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SigningInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.slashing.v1beta1.Query/SigningInfos" => { + #[allow(non_camel_case_types)] + struct SigningInfosSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for SigningInfosSvc { + type Response = super::QuerySigningInfosResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).signing_infos(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SigningInfosSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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.slashing.v1beta1.Query"; + } +} +/// GenesisState defines the slashing module's genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// params defines all the paramaters of related to deposit. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// signing_infos represents a map between validator addresses and their + /// signing infos. + #[prost(message, repeated, tag = "2")] + pub signing_infos: ::prost::alloc::vec::Vec, + /// missed_blocks represents a map between validator addresses and their + /// missed blocks. + #[prost(message, repeated, tag = "3")] + pub missed_blocks: ::prost::alloc::vec::Vec, +} +/// SigningInfo stores validator signing info of corresponding address. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SigningInfo { + /// address is the validator address. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// validator_signing_info represents the signing info of this validator. + #[prost(message, optional, tag = "2")] + pub validator_signing_info: ::core::option::Option, +} +/// ValidatorMissedBlocks contains array of missed blocks of corresponding +/// address. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorMissedBlocks { + /// address is the validator address. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// missed_blocks is an array of missed blocks by the validator. + #[prost(message, repeated, tag = "2")] + pub missed_blocks: ::prost::alloc::vec::Vec, +} +/// MissedBlock contains height and missed status as boolean. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MissedBlock { + /// index is the height at which the block was missed. + #[prost(int64, tag = "1")] + pub index: i64, + /// missed is the missed status. + #[prost(bool, tag = "2")] + pub missed: bool, +} diff --git a/src/prost/cosmos.vesting.v1beta1.rs b/src/prost/cosmos.vesting.v1beta1.rs new file mode 100644 index 00000000..fa136200 --- /dev/null +++ b/src/prost/cosmos.vesting.v1beta1.rs @@ -0,0 +1,619 @@ +/// BaseVestingAccount implements the VestingAccount interface. It contains all +/// the necessary fields needed for any vesting account implementation. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BaseVestingAccount { + #[prost(message, optional, tag = "1")] + pub base_account: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub original_vesting: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub delegated_free: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub delegated_vesting: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "5")] + pub end_time: i64, +} +/// ContinuousVestingAccount implements the VestingAccount interface. It +/// continuously vests by unlocking coins linearly with respect to time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ContinuousVestingAccount { + #[prost(message, optional, tag = "1")] + pub base_vesting_account: ::core::option::Option, + #[prost(int64, tag = "2")] + pub start_time: i64, +} +/// DelayedVestingAccount implements the VestingAccount interface. It vests all +/// coins after a specific time, but non prior. In other words, it keeps them +/// locked until a specified time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelayedVestingAccount { + #[prost(message, optional, tag = "1")] + pub base_vesting_account: ::core::option::Option, +} +/// Period defines a length of time and amount of coins that will vest. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Period { + #[prost(int64, tag = "1")] + pub length: i64, + #[prost(message, repeated, tag = "2")] + pub amount: ::prost::alloc::vec::Vec, +} +/// PeriodicVestingAccount implements the VestingAccount interface. It +/// periodically vests by unlocking coins during each specified period. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeriodicVestingAccount { + #[prost(message, optional, tag = "1")] + pub base_vesting_account: ::core::option::Option, + #[prost(int64, tag = "2")] + pub start_time: i64, + #[prost(message, repeated, tag = "3")] + pub vesting_periods: ::prost::alloc::vec::Vec, +} +/// PermanentLockedAccount implements the VestingAccount interface. It does +/// not ever release coins, locking them indefinitely. Coins in this account can +/// still be used for delegating and for governance votes even while locked. +/// +/// Since: cosmos-sdk 0.43 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PermanentLockedAccount { + #[prost(message, optional, tag = "1")] + pub base_vesting_account: ::core::option::Option, +} +/// MsgCreateVestingAccount defines a message that enables creating a vesting +/// account. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateVestingAccount { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub to_address: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub amount: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "4")] + pub end_time: i64, + #[prost(bool, tag = "5")] + pub delayed: bool, +} +/// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateVestingAccountResponse {} +/// MsgCreatePermanentLockedAccount defines a message that enables creating a permanent +/// locked account. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePermanentLockedAccount { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub to_address: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub amount: ::prost::alloc::vec::Vec, +} +/// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePermanentLockedAccountResponse {} +/// MsgCreateVestingAccount defines a message that enables creating a vesting +/// account. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePeriodicVestingAccount { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub to_address: ::prost::alloc::string::String, + #[prost(int64, tag = "3")] + pub start_time: i64, + #[prost(message, repeated, tag = "4")] + pub vesting_periods: ::prost::alloc::vec::Vec, +} +/// MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount +/// response type. +/// +/// Since: cosmos-sdk 0.46 +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreatePeriodicVestingAccountResponse {} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod msg_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Msg defines the bank Msg service. + #[derive(Debug, Clone)] + pub struct MsgClient { + inner: tonic::client::Grpc, + } + impl MsgClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl MsgClient + 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, + ) -> MsgClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + MsgClient::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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// CreateVestingAccount defines a method that enables creating a vesting + /// account. + pub async fn create_vesting_account( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.vesting.v1beta1.Msg/CreateVestingAccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cosmos.vesting.v1beta1.Msg", "CreateVestingAccount"), + ); + self.inner.unary(req, path, codec).await + } + /// CreatePermanentLockedAccount defines a method that enables creating a permanent + /// locked account. + /// + /// Since: cosmos-sdk 0.46 + pub async fn create_permanent_locked_account( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.vesting.v1beta1.Msg/CreatePermanentLockedAccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.vesting.v1beta1.Msg", + "CreatePermanentLockedAccount", + ), + ); + self.inner.unary(req, path, codec).await + } + /// CreatePeriodicVestingAccount defines a method that enables creating a + /// periodic vesting account. + /// + /// Since: cosmos-sdk 0.46 + pub async fn create_periodic_vesting_account( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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.vesting.v1beta1.Msg/CreatePeriodicVestingAccount", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "cosmos.vesting.v1beta1.Msg", + "CreatePeriodicVestingAccount", + ), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod msg_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 MsgServer. + #[async_trait] + pub trait Msg: Send + Sync + 'static { + /// CreateVestingAccount defines a method that enables creating a vesting + /// account. + async fn create_vesting_account( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CreatePermanentLockedAccount defines a method that enables creating a permanent + /// locked account. + /// + /// Since: cosmos-sdk 0.46 + async fn create_permanent_locked_account( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CreatePeriodicVestingAccount defines a method that enables creating a + /// periodic vesting account. + /// + /// Since: cosmos-sdk 0.46 + async fn create_periodic_vesting_account( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Msg defines the bank Msg service. + #[derive(Debug)] + pub struct MsgServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl MsgServer { + 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(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + 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 + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for MsgServer + where + T: Msg, + 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.vesting.v1beta1.Msg/CreateVestingAccount" => { + #[allow(non_camel_case_types)] + struct CreateVestingAccountSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for CreateVestingAccountSvc { + type Response = super::MsgCreateVestingAccountResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_vesting_account(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreateVestingAccountSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.vesting.v1beta1.Msg/CreatePermanentLockedAccount" => { + #[allow(non_camel_case_types)] + struct CreatePermanentLockedAccountSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for CreatePermanentLockedAccountSvc { + type Response = super::MsgCreatePermanentLockedAccountResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::MsgCreatePermanentLockedAccount, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_permanent_locked_account(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreatePermanentLockedAccountSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/cosmos.vesting.v1beta1.Msg/CreatePeriodicVestingAccount" => { + #[allow(non_camel_case_types)] + struct CreatePeriodicVestingAccountSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for CreatePeriodicVestingAccountSvc { + type Response = super::MsgCreatePeriodicVestingAccountResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::MsgCreatePeriodicVestingAccount, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + (*inner).create_periodic_vesting_account(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = CreatePeriodicVestingAccountSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + 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 MsgServer { + 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, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + 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 MsgServer { + const NAME: &'static str = "cosmos.vesting.v1beta1.Msg"; + } +} diff --git a/tools/proto-compiler/src/cmd/compile.rs b/tools/proto-compiler/src/cmd/compile.rs index b26be45d..6d506e2f 100644 --- a/tools/proto-compiler/src/cmd/compile.rs +++ b/tools/proto-compiler/src/cmd/compile.rs @@ -65,13 +65,32 @@ impl CompileCmd { format!("{}/../../definitions/mock", root), format!("{}/../../definitions/stride/interchainquery/v1", root), format!("{}/ibc", ibc_dir.display()), + // cosmos sdk + format!("{}/cosmos/app", sdk_dir.display()), format!("{}/cosmos/auth", sdk_dir.display()), - format!("{}/cosmos/gov", sdk_dir.display()), - format!("{}/cosmos/tx", sdk_dir.display()), - format!("{}/cosmos/base", sdk_dir.display()), + format!("{}/cosmos/authz", sdk_dir.display()), format!("{}/cosmos/bank", sdk_dir.display()), + format!("{}/cosmos/base", sdk_dir.display()), + format!("{}/cosmos/capability", sdk_dir.display()), + format!("{}/cosmos/crisis", sdk_dir.display()), + format!("{}/cosmos/crypto", sdk_dir.display()), + format!("{}/cosmos/distribution", sdk_dir.display()), + format!("{}/cosmos/evidence", sdk_dir.display()), + format!("{}/cosmos/feegrant", sdk_dir.display()), + format!("{}/cosmos/genutil", sdk_dir.display()), + format!("{}/cosmos/gov", sdk_dir.display()), + format!("{}/cosmos/group", sdk_dir.display()), + format!("{}/cosmos/mint", sdk_dir.display()), + format!("{}/cosmos/msg", sdk_dir.display()), + format!("{}/cosmos/nft", sdk_dir.display()), + format!("{}/cosmos/orm", sdk_dir.display()), + format!("{}/cosmos/params", sdk_dir.display()), + format!("{}/cosmos/slashing", sdk_dir.display()), format!("{}/cosmos/staking", sdk_dir.display()), + format!("{}/cosmos/tx", sdk_dir.display()), format!("{}/cosmos/upgrade", sdk_dir.display()), + format!("{}/cosmos/vesting", sdk_dir.display()), + // ics format!("{}/interchain_security/ccv/v1", ics_dir.display()), format!("{}/interchain_security/ccv/provider", ics_dir.display()), format!("{}/interchain_security/ccv/consumer", ics_dir.display()), From a89ed6f34e235162b352cbca121fe613613ab42e Mon Sep 17 00:00:00 2001 From: Davirain Date: Fri, 19 May 2023 09:32:14 +0800 Subject: [PATCH 2/2] Update lib.rs --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 777cafe1..cd008768 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -244,7 +244,7 @@ pub mod cosmos { } pub mod ics23 { - pub use ics23 as v1; + pub use ics23 as v1; } }