From 7e55c1d9073910bf5d6621f0024bb1c6b2bfe570 Mon Sep 17 00:00:00 2001 From: Ash <96692350+ash-burnt@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:18:20 -0700 Subject: [PATCH] cosmos-sdk-proto: add serde derive macros (#471) Uses Informal's fork of `pbjson` to generate `serde` impls Co-authored-by: Tony Arcieri (iqlusion) --- Cargo.lock | 32 +- cosmos-sdk-proto/Cargo.toml | 3 + .../cosmos-sdk/cosmos.app.module.v1alpha1.rs | 1 + .../cosmos.app.module.v1alpha1.serde.rs | 79 + .../prost/cosmos-sdk/cosmos.app.v1alpha1.rs | 1 + .../cosmos-sdk/cosmos.app.v1alpha1.serde.rs | 749 ++ .../prost/cosmos-sdk/cosmos.auth.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.auth.v1beta1.serde.rs | 2436 ++++ .../prost/cosmos-sdk/cosmos.authz.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.authz.v1beta1.serde.rs | 2203 ++++ .../prost/cosmos-sdk/cosmos.bank.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.bank.v1beta1.serde.rs | 3744 ++++++ .../cosmos-sdk/cosmos.base.abci.v1beta1.rs | 1 + .../cosmos.base.abci.v1beta1.serde.rs | 1536 +++ .../cosmos-sdk/cosmos.base.kv.v1beta1.rs | 1 + .../cosmos.base.kv.v1beta1.serde.rs | 219 + .../cosmos-sdk/cosmos.base.node.v1beta1.rs | 1 + .../cosmos.base.node.v1beta1.serde.rs | 182 + .../cosmos-sdk/cosmos.base.query.v1beta1.rs | 1 + .../cosmos.base.query.v1beta1.serde.rs | 312 + .../cosmos.base.reflection.v1beta1.rs | 1 + .../cosmos.base.reflection.v1beta1.serde.rs | 414 + .../cosmos.base.reflection.v2alpha1.rs | 1 + .../cosmos.base.reflection.v2alpha1.serde.rs | 2875 +++++ .../cosmos.base.snapshots.v1beta1.rs | 1 + .../cosmos.base.snapshots.v1beta1.serde.rs | 1212 ++ .../cosmos-sdk/cosmos.base.store.v1beta1.rs | 1 + .../cosmos.base.store.v1beta1.serde.rs | 846 ++ .../cosmos.base.tendermint.v1beta1.rs | 1 + .../cosmos.base.tendermint.v1beta1.serde.rs | 3123 +++++ .../prost/cosmos-sdk/cosmos.base.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.base.v1beta1.serde.rs | 413 + .../cosmos-sdk/cosmos.capability.v1beta1.rs | 1 + .../cosmos.capability.v1beta1.serde.rs | 556 + .../prost/cosmos-sdk/cosmos.crisis.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.crisis.v1beta1.serde.rs | 327 + .../prost/cosmos-sdk/cosmos.crypto.ed25519.rs | 1 + .../cosmos-sdk/cosmos.crypto.ed25519.serde.rs | 201 + .../prost/cosmos-sdk/cosmos.crypto.hd.v1.rs | 1 + .../cosmos-sdk/cosmos.crypto.hd.v1.serde.rs | 180 + .../cosmos-sdk/cosmos.crypto.keyring.v1.rs | 1 + .../cosmos.crypto.keyring.v1.serde.rs | 531 + .../cosmos-sdk/cosmos.crypto.multisig.rs | 1 + .../cosmos.crypto.multisig.serde.rs | 120 + .../cosmos.crypto.multisig.v1beta1.rs | 1 + .../cosmos.crypto.multisig.v1beta1.serde.rs | 241 + .../cosmos-sdk/cosmos.crypto.secp256k1.rs | 1 + .../cosmos.crypto.secp256k1.serde.rs | 201 + .../cosmos-sdk/cosmos.crypto.secp256r1.rs | 1 + .../cosmos.crypto.secp256r1.serde.rs | 203 + .../cosmos-sdk/cosmos.distribution.v1beta1.rs | 1 + .../cosmos.distribution.v1beta1.serde.rs | 5712 +++++++++ .../cosmos-sdk/cosmos.evidence.v1beta1.rs | 1 + .../cosmos.evidence.v1beta1.serde.rs | 924 ++ .../cosmos-sdk/cosmos.feegrant.v1beta1.rs | 1 + .../cosmos.feegrant.v1beta1.serde.rs | 1755 +++ .../cosmos-sdk/cosmos.genutil.v1beta1.rs | 1 + .../cosmos.genutil.v1beta1.serde.rs | 113 + .../src/prost/cosmos-sdk/cosmos.gov.v1.rs | 1 + .../prost/cosmos-sdk/cosmos.gov.v1.serde.rs | 4541 +++++++ .../prost/cosmos-sdk/cosmos.gov.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.gov.v1beta1.serde.rs | 4432 +++++++ .../src/prost/cosmos-sdk/cosmos.group.v1.rs | 1 + .../prost/cosmos-sdk/cosmos.group.v1.serde.rs | 10053 ++++++++++++++++ .../prost/cosmos-sdk/cosmos.mint.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.mint.v1beta1.serde.rs | 994 ++ .../prost/cosmos-sdk/cosmos.nft.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.nft.v1beta1.serde.rs | 2724 +++++ .../cosmos-sdk/cosmos.orm.module.v1alpha1.rs | 1 + .../cosmos.orm.module.v1alpha1.serde.rs | 79 + .../src/prost/cosmos-sdk/cosmos.orm.v1.rs | 1 + .../prost/cosmos-sdk/cosmos.orm.v1.serde.rs | 491 + .../prost/cosmos-sdk/cosmos.orm.v1alpha1.rs | 1 + .../cosmos-sdk/cosmos.orm.v1alpha1.serde.rs | 358 + .../prost/cosmos-sdk/cosmos.params.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.params.v1beta1.serde.rs | 778 ++ .../cosmos-sdk/cosmos.slashing.v1beta1.rs | 1 + .../cosmos.slashing.v1beta1.serde.rs | 1721 +++ .../cosmos-sdk/cosmos.staking.v1beta1.rs | 1 + .../cosmos.staking.v1beta1.serde.rs | 8430 +++++++++++++ .../cosmos-sdk/cosmos.tx.signing.v1beta1.rs | 1 + .../cosmos.tx.signing.v1beta1.serde.rs | 698 ++ .../src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs | 1 + .../cosmos-sdk/cosmos.tx.v1beta1.serde.rs | 3306 +++++ .../cosmos-sdk/cosmos.upgrade.v1beta1.rs | 1 + .../cosmos.upgrade.v1beta1.serde.rs | 1945 +++ .../cosmos-sdk/cosmos.vesting.v1beta1.rs | 1 + .../cosmos.vesting.v1beta1.serde.rs | 1547 +++ .../src/prost/cosmos-sdk/cosmos_proto.rs | 1 + .../prost/cosmos-sdk/cosmos_proto.serde.rs | 334 + .../prost/wasmd/cosmos.base.query.v1beta1.rs | 1 + .../wasmd/cosmos.base.query.v1beta1.serde.rs | 312 + .../src/prost/wasmd/cosmos.base.v1beta1.rs | 1 + .../prost/wasmd/cosmos.base.v1beta1.serde.rs | 413 + .../src/prost/wasmd/cosmos_proto.rs | 1 + .../src/prost/wasmd/cosmos_proto.serde.rs | 334 + .../src/prost/wasmd/cosmwasm.wasm.v1.rs | 1 + .../src/prost/wasmd/cosmwasm.wasm.v1.serde.rs | 8416 +++++++++++++ cosmos-sdk-proto/src/type_names.rs | 20 + proto-build/buf.sdk.gen.yaml | 4 + proto-build/buf.wasmd.gen.yaml | 6 + proto-build/src/main.rs | 29 + 102 files changed, 83445 insertions(+), 10 deletions(-) create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.serde.rs create mode 100644 cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.serde.rs diff --git a/Cargo.lock b/Cargo.lock index 1dc73ad9..eb8a86da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" name = "cosmos-sdk-proto" version = "0.24.0-pre" dependencies = [ + "informalsystems-pbjson", "prost", + "serde", "tendermint-proto", "tonic", ] @@ -936,6 +938,16 @@ dependencies = [ "hashbrown 0.14.1", ] +[[package]] +name = "informalsystems-pbjson" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa4a0980c8379295100d70854354e78df2ee1c6ca0f96ffe89afeb3140e3a3d" +dependencies = [ + "base64 0.21.4", + "serde", +] + [[package]] name = "ipnet" version = "2.8.0" @@ -1195,9 +1207,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1269,9 +1281,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1565,9 +1577,9 @@ checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" dependencies = [ "serde_derive", ] @@ -1583,9 +1595,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" dependencies = [ "proc-macro2", "quote", @@ -1743,9 +1755,9 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" [[package]] name = "syn" -version = "2.0.37" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/cosmos-sdk-proto/Cargo.toml b/cosmos-sdk-proto/Cargo.toml index 4592d16d..04ead1c3 100644 --- a/cosmos-sdk-proto/Cargo.toml +++ b/cosmos-sdk-proto/Cargo.toml @@ -21,6 +21,8 @@ tendermint-proto = "0.39.1" # Optional dependencies tonic = { version = "0.12", optional = true, default-features = false, features = ["codegen", "prost"] } +serde = { version = "1.0.203", optional = true, default-features = false, features = ["alloc"] } +pbjson = { package = "informalsystems-pbjson", optional = true, version = "0.7" } [features] default = ["grpc-transport"] @@ -28,6 +30,7 @@ std = ["prost/std", "tendermint-proto/std"] grpc = ["std", "tonic"] grpc-transport = ["grpc", "tonic/transport"] cosmwasm = [] +serde = ["dep:serde", "tendermint-proto/std", "pbjson"] [package.metadata.docs.rs] all-features = true diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.rs index a8ae8fd3..55572462 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.rs @@ -3,4 +3,5 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Module {} +include!("cosmos.app.module.v1alpha1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.serde.rs new file mode 100644 index 00000000..5bf71429 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.module.v1alpha1.serde.rs @@ -0,0 +1,79 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Module { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.app.module.v1alpha1.Module", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Module { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Module; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.module.v1alpha1.Module") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(Module {}) + } + } + deserializer.deserialize_struct( + "cosmos.app.module.v1alpha1.Module", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.rs index b23fe176..9a00831f 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.rs @@ -126,5 +126,6 @@ pub struct QueryConfigResponse { #[prost(message, optional, tag = "1")] pub config: ::core::option::Option, } +include!("cosmos.app.v1alpha1.serde.rs"); include!("cosmos.app.v1alpha1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.serde.rs new file mode 100644 index 00000000..7382e8c6 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.serde.rs @@ -0,0 +1,749 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Config { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.modules.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.app.v1alpha1.Config", len)?; + if !self.modules.is_empty() { + struct_ser.serialize_field("modules", &self.modules)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Config { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["modules"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Modules, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "modules" => Ok(GeneratedField::Modules), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Config; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.Config") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut modules__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Modules => { + if modules__.is_some() { + return Err(serde::de::Error::duplicate_field("modules")); + } + modules__ = Some(map_.next_value()?); + } + } + } + Ok(Config { + modules: modules__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.app.v1alpha1.Config", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MigrateFromInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.module.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.MigrateFromInfo", len)?; + if !self.module.is_empty() { + struct_ser.serialize_field("module", &self.module)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MigrateFromInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["module"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Module, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "module" => Ok(GeneratedField::Module), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MigrateFromInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.MigrateFromInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut module__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Module => { + if module__.is_some() { + return Err(serde::de::Error::duplicate_field("module")); + } + module__ = Some(map_.next_value()?); + } + } + } + Ok(MigrateFromInfo { + module: module__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.MigrateFromInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ModuleConfig { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.config.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.ModuleConfig", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if let Some(v) = self.config.as_ref() { + struct_ser.serialize_field("config", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModuleConfig { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "config"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Config, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "config" => Ok(GeneratedField::Config), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModuleConfig; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.ModuleConfig") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut config__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Config => { + if config__.is_some() { + return Err(serde::de::Error::duplicate_field("config")); + } + config__ = map_.next_value()?; + } + } + } + Ok(ModuleConfig { + name: name__.unwrap_or_default(), + config: config__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.ModuleConfig", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ModuleDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.go_import.is_empty() { + len += 1; + } + if !self.use_package.is_empty() { + len += 1; + } + if !self.can_migrate_from.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.ModuleDescriptor", len)?; + if !self.go_import.is_empty() { + struct_ser.serialize_field("goImport", &self.go_import)?; + } + if !self.use_package.is_empty() { + struct_ser.serialize_field("usePackage", &self.use_package)?; + } + if !self.can_migrate_from.is_empty() { + struct_ser.serialize_field("canMigrateFrom", &self.can_migrate_from)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModuleDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "go_import", + "goImport", + "use_package", + "usePackage", + "can_migrate_from", + "canMigrateFrom", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GoImport, + UsePackage, + CanMigrateFrom, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "goImport" | "go_import" => Ok(GeneratedField::GoImport), + "usePackage" | "use_package" => Ok(GeneratedField::UsePackage), + "canMigrateFrom" | "can_migrate_from" => { + Ok(GeneratedField::CanMigrateFrom) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModuleDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.ModuleDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut go_import__ = None; + let mut use_package__ = None; + let mut can_migrate_from__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GoImport => { + if go_import__.is_some() { + return Err(serde::de::Error::duplicate_field("goImport")); + } + go_import__ = Some(map_.next_value()?); + } + GeneratedField::UsePackage => { + if use_package__.is_some() { + return Err(serde::de::Error::duplicate_field("usePackage")); + } + use_package__ = Some(map_.next_value()?); + } + GeneratedField::CanMigrateFrom => { + if can_migrate_from__.is_some() { + return Err(serde::de::Error::duplicate_field("canMigrateFrom")); + } + can_migrate_from__ = Some(map_.next_value()?); + } + } + } + Ok(ModuleDescriptor { + go_import: go_import__.unwrap_or_default(), + use_package: use_package__.unwrap_or_default(), + can_migrate_from: can_migrate_from__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.ModuleDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PackageReference { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.revision != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.PackageReference", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if self.revision != 0 { + struct_ser.serialize_field("revision", &self.revision)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PackageReference { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "revision"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Revision, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "revision" => Ok(GeneratedField::Revision), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PackageReference; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.PackageReference") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut revision__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Revision => { + if revision__.is_some() { + return Err(serde::de::Error::duplicate_field("revision")); + } + revision__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PackageReference { + name: name__.unwrap_or_default(), + revision: revision__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.PackageReference", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryConfigRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.QueryConfigRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryConfigRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryConfigRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.QueryConfigRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryConfigRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.QueryConfigRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryConfigResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.config.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.app.v1alpha1.QueryConfigResponse", len)?; + if let Some(v) = self.config.as_ref() { + struct_ser.serialize_field("config", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryConfigResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["config"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Config, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "config" => Ok(GeneratedField::Config), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryConfigResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.app.v1alpha1.QueryConfigResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut config__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Config => { + if config__.is_some() { + return Err(serde::de::Error::duplicate_field("config")); + } + config__ = map_.next_value()?; + } + } + } + Ok(QueryConfigResponse { config: config__ }) + } + } + deserializer.deserialize_struct( + "cosmos.app.v1alpha1.QueryConfigResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.rs index 47429f32..c133406e 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.rs @@ -203,5 +203,6 @@ pub struct QueryAccountAddressByIdResponse { #[prost(string, tag = "1")] pub account_address: ::prost::alloc::string::String, } +include!("cosmos.auth.v1beta1.serde.rs"); include!("cosmos.auth.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs new file mode 100644 index 00000000..7345e5a5 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs @@ -0,0 +1,2436 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AddressBytesToStringRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address_bytes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.AddressBytesToStringRequest", len)?; + if !self.address_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "addressBytes", + pbjson::private::base64::encode(&self.address_bytes).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AddressBytesToStringRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address_bytes", "addressBytes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AddressBytes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "addressBytes" | "address_bytes" => Ok(GeneratedField::AddressBytes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AddressBytesToStringRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.AddressBytesToStringRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address_bytes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AddressBytes => { + if address_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("addressBytes")); + } + address_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(AddressBytesToStringRequest { + address_bytes: address_bytes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.AddressBytesToStringRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AddressBytesToStringResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address_string.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.AddressBytesToStringResponse", len)?; + if !self.address_string.is_empty() { + struct_ser.serialize_field("addressString", &self.address_string)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AddressBytesToStringResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address_string", "addressString"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AddressString, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "addressString" | "address_string" => Ok(GeneratedField::AddressString), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AddressBytesToStringResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.AddressBytesToStringResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address_string__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AddressString => { + if address_string__.is_some() { + return Err(serde::de::Error::duplicate_field("addressString")); + } + address_string__ = Some(map_.next_value()?); + } + } + } + Ok(AddressBytesToStringResponse { + address_string: address_string__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.AddressBytesToStringResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AddressStringToBytesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address_string.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.AddressStringToBytesRequest", len)?; + if !self.address_string.is_empty() { + struct_ser.serialize_field("addressString", &self.address_string)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AddressStringToBytesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address_string", "addressString"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AddressString, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "addressString" | "address_string" => Ok(GeneratedField::AddressString), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AddressStringToBytesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.AddressStringToBytesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address_string__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AddressString => { + if address_string__.is_some() { + return Err(serde::de::Error::duplicate_field("addressString")); + } + address_string__ = Some(map_.next_value()?); + } + } + } + Ok(AddressStringToBytesRequest { + address_string: address_string__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.AddressStringToBytesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AddressStringToBytesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address_bytes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.AddressStringToBytesResponse", len)?; + if !self.address_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "addressBytes", + pbjson::private::base64::encode(&self.address_bytes).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AddressStringToBytesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address_bytes", "addressBytes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AddressBytes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "addressBytes" | "address_bytes" => Ok(GeneratedField::AddressBytes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AddressStringToBytesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.AddressStringToBytesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address_bytes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AddressBytes => { + if address_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("addressBytes")); + } + address_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(AddressStringToBytesResponse { + address_bytes: address_bytes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.AddressStringToBytesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BaseAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pub_key.is_some() { + len += 1; + } + if self.account_number != 0 { + len += 1; + } + if self.sequence != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.auth.v1beta1.BaseAccount", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pub_key.as_ref() { + struct_ser.serialize_field("pubKey", v)?; + } + if self.account_number != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "accountNumber", + ToString::to_string(&self.account_number).as_str(), + )?; + } + if self.sequence != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sequence", ToString::to_string(&self.sequence).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BaseAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "address", + "pub_key", + "pubKey", + "account_number", + "accountNumber", + "sequence", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + PubKey, + AccountNumber, + Sequence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pubKey" | "pub_key" => Ok(GeneratedField::PubKey), + "accountNumber" | "account_number" => Ok(GeneratedField::AccountNumber), + "sequence" => Ok(GeneratedField::Sequence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BaseAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.BaseAccount") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pub_key__ = None; + let mut account_number__ = None; + let mut sequence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::PubKey => { + if pub_key__.is_some() { + return Err(serde::de::Error::duplicate_field("pubKey")); + } + pub_key__ = map_.next_value()?; + } + GeneratedField::AccountNumber => { + if account_number__.is_some() { + return Err(serde::de::Error::duplicate_field("accountNumber")); + } + account_number__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Sequence => { + if sequence__.is_some() { + return Err(serde::de::Error::duplicate_field("sequence")); + } + sequence__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(BaseAccount { + address: address__.unwrap_or_default(), + pub_key: pub_key__, + account_number: account_number__.unwrap_or_default(), + sequence: sequence__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.auth.v1beta1.BaseAccount", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Bech32PrefixRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.Bech32PrefixRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Bech32PrefixRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Bech32PrefixRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.Bech32PrefixRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(Bech32PrefixRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.Bech32PrefixRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Bech32PrefixResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.bech32_prefix.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.Bech32PrefixResponse", len)?; + if !self.bech32_prefix.is_empty() { + struct_ser.serialize_field("bech32Prefix", &self.bech32_prefix)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Bech32PrefixResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["bech32_prefix", "bech32Prefix"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Bech32Prefix, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bech32Prefix" | "bech32_prefix" => Ok(GeneratedField::Bech32Prefix), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Bech32PrefixResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.Bech32PrefixResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut bech32_prefix__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Bech32Prefix => { + if bech32_prefix__.is_some() { + return Err(serde::de::Error::duplicate_field("bech32Prefix")); + } + bech32_prefix__ = Some(map_.next_value()?); + } + } + } + Ok(Bech32PrefixResponse { + bech32_prefix: bech32_prefix__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.Bech32PrefixResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if !self.accounts.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if !self.accounts.is_empty() { + struct_ser.serialize_field("accounts", &self.accounts)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params", "accounts"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + Accounts, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "accounts" => Ok(GeneratedField::Accounts), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut accounts__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::Accounts => { + if accounts__.is_some() { + return Err(serde::de::Error::duplicate_field("accounts")); + } + accounts__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + accounts: accounts__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ModuleAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_account.is_some() { + len += 1; + } + if !self.name.is_empty() { + len += 1; + } + if !self.permissions.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.ModuleAccount", len)?; + if let Some(v) = self.base_account.as_ref() { + struct_ser.serialize_field("baseAccount", v)?; + } + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.permissions.is_empty() { + struct_ser.serialize_field("permissions", &self.permissions)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModuleAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["base_account", "baseAccount", "name", "permissions"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseAccount, + Name, + Permissions, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseAccount" | "base_account" => Ok(GeneratedField::BaseAccount), + "name" => Ok(GeneratedField::Name), + "permissions" => Ok(GeneratedField::Permissions), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModuleAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.ModuleAccount") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_account__ = None; + let mut name__ = None; + let mut permissions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseAccount => { + if base_account__.is_some() { + return Err(serde::de::Error::duplicate_field("baseAccount")); + } + base_account__ = map_.next_value()?; + } + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Permissions => { + if permissions__.is_some() { + return Err(serde::de::Error::duplicate_field("permissions")); + } + permissions__ = Some(map_.next_value()?); + } + } + } + Ok(ModuleAccount { + base_account: base_account__, + name: name__.unwrap_or_default(), + permissions: permissions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.ModuleAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.max_memo_characters != 0 { + len += 1; + } + if self.tx_sig_limit != 0 { + len += 1; + } + if self.tx_size_cost_per_byte != 0 { + len += 1; + } + if self.sig_verify_cost_ed25519 != 0 { + len += 1; + } + if self.sig_verify_cost_secp256k1 != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.auth.v1beta1.Params", len)?; + if self.max_memo_characters != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "maxMemoCharacters", + ToString::to_string(&self.max_memo_characters).as_str(), + )?; + } + if self.tx_sig_limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "txSigLimit", + ToString::to_string(&self.tx_sig_limit).as_str(), + )?; + } + if self.tx_size_cost_per_byte != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "txSizeCostPerByte", + ToString::to_string(&self.tx_size_cost_per_byte).as_str(), + )?; + } + if self.sig_verify_cost_ed25519 != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "sigVerifyCostEd25519", + ToString::to_string(&self.sig_verify_cost_ed25519).as_str(), + )?; + } + if self.sig_verify_cost_secp256k1 != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "sigVerifyCostSecp256k1", + ToString::to_string(&self.sig_verify_cost_secp256k1).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "max_memo_characters", + "maxMemoCharacters", + "tx_sig_limit", + "txSigLimit", + "tx_size_cost_per_byte", + "txSizeCostPerByte", + "sig_verify_cost_ed25519", + "sigVerifyCostEd25519", + "sig_verify_cost_secp256k1", + "sigVerifyCostSecp256k1", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MaxMemoCharacters, + TxSigLimit, + TxSizeCostPerByte, + SigVerifyCostEd25519, + SigVerifyCostSecp256k1, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "maxMemoCharacters" | "max_memo_characters" => { + Ok(GeneratedField::MaxMemoCharacters) + } + "txSigLimit" | "tx_sig_limit" => Ok(GeneratedField::TxSigLimit), + "txSizeCostPerByte" | "tx_size_cost_per_byte" => { + Ok(GeneratedField::TxSizeCostPerByte) + } + "sigVerifyCostEd25519" | "sig_verify_cost_ed25519" => { + Ok(GeneratedField::SigVerifyCostEd25519) + } + "sigVerifyCostSecp256k1" | "sig_verify_cost_secp256k1" => { + Ok(GeneratedField::SigVerifyCostSecp256k1) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut max_memo_characters__ = None; + let mut tx_sig_limit__ = None; + let mut tx_size_cost_per_byte__ = None; + let mut sig_verify_cost_ed25519__ = None; + let mut sig_verify_cost_secp256k1__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MaxMemoCharacters => { + if max_memo_characters__.is_some() { + return Err(serde::de::Error::duplicate_field("maxMemoCharacters")); + } + max_memo_characters__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::TxSigLimit => { + if tx_sig_limit__.is_some() { + return Err(serde::de::Error::duplicate_field("txSigLimit")); + } + tx_sig_limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::TxSizeCostPerByte => { + if tx_size_cost_per_byte__.is_some() { + return Err(serde::de::Error::duplicate_field("txSizeCostPerByte")); + } + tx_size_cost_per_byte__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::SigVerifyCostEd25519 => { + if sig_verify_cost_ed25519__.is_some() { + return Err(serde::de::Error::duplicate_field( + "sigVerifyCostEd25519", + )); + } + sig_verify_cost_ed25519__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::SigVerifyCostSecp256k1 => { + if sig_verify_cost_secp256k1__.is_some() { + return Err(serde::de::Error::duplicate_field( + "sigVerifyCostSecp256k1", + )); + } + sig_verify_cost_secp256k1__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Params { + max_memo_characters: max_memo_characters__.unwrap_or_default(), + tx_sig_limit: tx_sig_limit__.unwrap_or_default(), + tx_size_cost_per_byte: tx_size_cost_per_byte__.unwrap_or_default(), + sig_verify_cost_ed25519: sig_verify_cost_ed25519__.unwrap_or_default(), + sig_verify_cost_secp256k1: sig_verify_cost_secp256k1__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.auth.v1beta1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountAddressByIdRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", len)?; + if self.id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountAddressByIdRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountAddressByIdRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountAddressByIDRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryAccountAddressByIdRequest { + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountAddressByIdResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.account_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", len)?; + if !self.account_address.is_empty() { + struct_ser.serialize_field("accountAddress", &self.account_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountAddressByIdResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["account_address", "accountAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AccountAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "accountAddress" | "account_address" => { + Ok(GeneratedField::AccountAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountAddressByIdResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountAddressByIDResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut account_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AccountAddress => { + if account_address__.is_some() { + return Err(serde::de::Error::duplicate_field("accountAddress")); + } + account_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryAccountAddressByIdResponse { + account_address: account_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryAccountRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryAccountRequest { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.account.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryAccountResponse", len)?; + if let Some(v) = self.account.as_ref() { + struct_ser.serialize_field("account", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["account"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Account, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "account" => Ok(GeneratedField::Account), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut account__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Account => { + if account__.is_some() { + return Err(serde::de::Error::duplicate_field("account")); + } + account__ = map_.next_value()?; + } + } + } + Ok(QueryAccountResponse { account: account__ }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryAccountsRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAccountsRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAccountsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.accounts.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryAccountsResponse", len)?; + if !self.accounts.is_empty() { + struct_ser.serialize_field("accounts", &self.accounts)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAccountsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["accounts", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Accounts, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "accounts" => Ok(GeneratedField::Accounts), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAccountsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryAccountsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut accounts__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Accounts => { + if accounts__.is_some() { + return Err(serde::de::Error::duplicate_field("accounts")); + } + accounts__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAccountsResponse { + accounts: accounts__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryAccountsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleAccountByNameRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleAccountByNameRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleAccountByNameRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryModuleAccountByNameRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + } + } + Ok(QueryModuleAccountByNameRequest { + name: name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleAccountByNameResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.account.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", len)?; + if let Some(v) = self.account.as_ref() { + struct_ser.serialize_field("account", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleAccountByNameResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["account"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Account, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "account" => Ok(GeneratedField::Account), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleAccountByNameResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryModuleAccountByNameResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut account__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Account => { + if account__.is_some() { + return Err(serde::de::Error::duplicate_field("account")); + } + account__ = map_.next_value()?; + } + } + } + Ok(QueryModuleAccountByNameResponse { account: account__ }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleAccountsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryModuleAccountsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleAccountsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleAccountsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryModuleAccountsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryModuleAccountsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryModuleAccountsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleAccountsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.accounts.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryModuleAccountsResponse", len)?; + if !self.accounts.is_empty() { + struct_ser.serialize_field("accounts", &self.accounts)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleAccountsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["accounts"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Accounts, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "accounts" => Ok(GeneratedField::Accounts), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleAccountsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryModuleAccountsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut accounts__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Accounts => { + if accounts__.is_some() { + return Err(serde::de::Error::duplicate_field("accounts")); + } + accounts__ = Some(map_.next_value()?); + } + } + } + Ok(QueryModuleAccountsResponse { + accounts: accounts__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryModuleAccountsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.auth.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.auth.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.auth.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.rs index 2dc300b6..79556512 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.rs @@ -199,5 +199,6 @@ pub struct MsgRevoke { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgRevokeResponse {} +include!("cosmos.authz.v1beta1.serde.rs"); include!("cosmos.authz.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.serde.rs new file mode 100644 index 00000000..20ee2f3e --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.v1beta1.serde.rs @@ -0,0 +1,2203 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for EventGrant { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg_type_url.is_empty() { + len += 1; + } + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.authz.v1beta1.EventGrant", len)?; + if !self.msg_type_url.is_empty() { + struct_ser.serialize_field("msgTypeUrl", &self.msg_type_url)?; + } + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventGrant { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_type_url", "msgTypeUrl", "granter", "grantee"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgTypeUrl, + Granter, + Grantee, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgTypeUrl" | "msg_type_url" => Ok(GeneratedField::MsgTypeUrl), + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventGrant; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.EventGrant") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_type_url__ = None; + let mut granter__ = None; + let mut grantee__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgTypeUrl => { + if msg_type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrl")); + } + msg_type_url__ = Some(map_.next_value()?); + } + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + } + } + Ok(EventGrant { + msg_type_url: msg_type_url__.unwrap_or_default(), + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.authz.v1beta1.EventGrant", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventRevoke { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg_type_url.is_empty() { + len += 1; + } + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.EventRevoke", len)?; + if !self.msg_type_url.is_empty() { + struct_ser.serialize_field("msgTypeUrl", &self.msg_type_url)?; + } + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventRevoke { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_type_url", "msgTypeUrl", "granter", "grantee"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgTypeUrl, + Granter, + Grantee, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgTypeUrl" | "msg_type_url" => Ok(GeneratedField::MsgTypeUrl), + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventRevoke; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.EventRevoke") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_type_url__ = None; + let mut granter__ = None; + let mut grantee__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgTypeUrl => { + if msg_type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrl")); + } + msg_type_url__ = Some(map_.next_value()?); + } + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + } + } + Ok(EventRevoke { + msg_type_url: msg_type_url__.unwrap_or_default(), + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.EventRevoke", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenericAuthorization { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.GenericAuthorization", len)?; + if !self.msg.is_empty() { + struct_ser.serialize_field("msg", &self.msg)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenericAuthorization { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Msg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msg" => Ok(GeneratedField::Msg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenericAuthorization; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.GenericAuthorization") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some(map_.next_value()?); + } + } + } + Ok(GenericAuthorization { + msg: msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.GenericAuthorization", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.authorization.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.GenesisState", len)?; + if !self.authorization.is_empty() { + struct_ser.serialize_field("authorization", &self.authorization)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["authorization"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authorization, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authorization" => Ok(GeneratedField::Authorization), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authorization__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authorization => { + if authorization__.is_some() { + return Err(serde::de::Error::duplicate_field("authorization")); + } + authorization__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + authorization: authorization__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Grant { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.authorization.is_some() { + len += 1; + } + if self.expiration.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.authz.v1beta1.Grant", len)?; + if let Some(v) = self.authorization.as_ref() { + struct_ser.serialize_field("authorization", v)?; + } + if let Some(v) = self.expiration.as_ref() { + struct_ser.serialize_field("expiration", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Grant { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["authorization", "expiration"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authorization, + Expiration, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authorization" => Ok(GeneratedField::Authorization), + "expiration" => Ok(GeneratedField::Expiration), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Grant; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.Grant") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authorization__ = None; + let mut expiration__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authorization => { + if authorization__.is_some() { + return Err(serde::de::Error::duplicate_field("authorization")); + } + authorization__ = map_.next_value()?; + } + GeneratedField::Expiration => { + if expiration__.is_some() { + return Err(serde::de::Error::duplicate_field("expiration")); + } + expiration__ = map_.next_value()?; + } + } + } + Ok(Grant { + authorization: authorization__, + expiration: expiration__, + }) + } + } + deserializer.deserialize_struct("cosmos.authz.v1beta1.Grant", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GrantAuthorization { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if self.authorization.is_some() { + len += 1; + } + if self.expiration.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.GrantAuthorization", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.authorization.as_ref() { + struct_ser.serialize_field("authorization", v)?; + } + if let Some(v) = self.expiration.as_ref() { + struct_ser.serialize_field("expiration", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GrantAuthorization { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee", "authorization", "expiration"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + Authorization, + Expiration, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "authorization" => Ok(GeneratedField::Authorization), + "expiration" => Ok(GeneratedField::Expiration), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GrantAuthorization; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.GrantAuthorization") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut authorization__ = None; + let mut expiration__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Authorization => { + if authorization__.is_some() { + return Err(serde::de::Error::duplicate_field("authorization")); + } + authorization__ = map_.next_value()?; + } + GeneratedField::Expiration => { + if expiration__.is_some() { + return Err(serde::de::Error::duplicate_field("expiration")); + } + expiration__ = map_.next_value()?; + } + } + } + Ok(GrantAuthorization { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + authorization: authorization__, + expiration: expiration__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.GrantAuthorization", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GrantQueueItem { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg_type_urls.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.GrantQueueItem", len)?; + if !self.msg_type_urls.is_empty() { + struct_ser.serialize_field("msgTypeUrls", &self.msg_type_urls)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GrantQueueItem { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_type_urls", "msgTypeUrls"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgTypeUrls, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgTypeUrls" | "msg_type_urls" => Ok(GeneratedField::MsgTypeUrls), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GrantQueueItem; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.GrantQueueItem") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_type_urls__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgTypeUrls => { + if msg_type_urls__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrls")); + } + msg_type_urls__ = Some(map_.next_value()?); + } + } + } + Ok(GrantQueueItem { + msg_type_urls: msg_type_urls__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.GrantQueueItem", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExec { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grantee.is_empty() { + len += 1; + } + if !self.msgs.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.authz.v1beta1.MsgExec", len)?; + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if !self.msgs.is_empty() { + struct_ser.serialize_field("msgs", &self.msgs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExec { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grantee", "msgs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grantee, + Msgs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grantee" => Ok(GeneratedField::Grantee), + "msgs" => Ok(GeneratedField::Msgs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExec; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgExec") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grantee__ = None; + let mut msgs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Msgs => { + if msgs__.is_some() { + return Err(serde::de::Error::duplicate_field("msgs")); + } + msgs__ = Some(map_.next_value()?); + } + } + } + Ok(MsgExec { + grantee: grantee__.unwrap_or_default(), + msgs: msgs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.authz.v1beta1.MsgExec", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.results.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.MsgExecResponse", len)?; + if !self.results.is_empty() { + struct_ser.serialize_field( + "results", + &self + .results + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["results"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Results, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "results" => Ok(GeneratedField::Results), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgExecResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut results__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Results => { + if results__.is_some() { + return Err(serde::de::Error::duplicate_field("results")); + } + results__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(MsgExecResponse { + results: results__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.MsgExecResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgGrant { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if self.grant.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.authz.v1beta1.MsgGrant", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.grant.as_ref() { + struct_ser.serialize_field("grant", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgGrant { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee", "grant"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + Grant, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "grant" => Ok(GeneratedField::Grant), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgGrant; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgGrant") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut grant__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Grant => { + if grant__.is_some() { + return Err(serde::de::Error::duplicate_field("grant")); + } + grant__ = map_.next_value()?; + } + } + } + Ok(MsgGrant { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + grant: grant__, + }) + } + } + deserializer.deserialize_struct("cosmos.authz.v1beta1.MsgGrant", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgGrantResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.MsgGrantResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgGrantResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgGrantResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgGrantResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgGrantResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.MsgGrantResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgRevoke { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if !self.msg_type_url.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.authz.v1beta1.MsgRevoke", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if !self.msg_type_url.is_empty() { + struct_ser.serialize_field("msgTypeUrl", &self.msg_type_url)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgRevoke { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee", "msg_type_url", "msgTypeUrl"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + MsgTypeUrl, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "msgTypeUrl" | "msg_type_url" => Ok(GeneratedField::MsgTypeUrl), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgRevoke; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgRevoke") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut msg_type_url__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::MsgTypeUrl => { + if msg_type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrl")); + } + msg_type_url__ = Some(map_.next_value()?); + } + } + } + Ok(MsgRevoke { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + msg_type_url: msg_type_url__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.authz.v1beta1.MsgRevoke", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgRevokeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.MsgRevokeResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgRevokeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgRevokeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.MsgRevokeResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgRevokeResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.MsgRevokeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGranteeGrantsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grantee.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGranteeGrantsRequest", len)?; + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGranteeGrantsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grantee", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grantee, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grantee" => Ok(GeneratedField::Grantee), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGranteeGrantsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGranteeGrantsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grantee__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGranteeGrantsRequest { + grantee: grantee__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGranteeGrantsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grants.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGranteeGrantsResponse", len)?; + if !self.grants.is_empty() { + struct_ser.serialize_field("grants", &self.grants)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGranteeGrantsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grants", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grants, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grants" => Ok(GeneratedField::Grants), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGranteeGrantsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGranteeGrantsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grants__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grants => { + if grants__.is_some() { + return Err(serde::de::Error::duplicate_field("grants")); + } + grants__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGranteeGrantsResponse { + grants: grants__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGranterGrantsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGranterGrantsRequest", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGranterGrantsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGranterGrantsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGranterGrantsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGranterGrantsRequest { + granter: granter__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGranterGrantsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGranterGrantsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grants.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGranterGrantsResponse", len)?; + if !self.grants.is_empty() { + struct_ser.serialize_field("grants", &self.grants)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGranterGrantsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grants", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grants, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grants" => Ok(GeneratedField::Grants), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGranterGrantsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGranterGrantsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grants__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grants => { + if grants__.is_some() { + return Err(serde::de::Error::duplicate_field("grants")); + } + grants__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGranterGrantsResponse { + grants: grants__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGranterGrantsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGrantsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if !self.msg_type_url.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGrantsRequest", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if !self.msg_type_url.is_empty() { + struct_ser.serialize_field("msgTypeUrl", &self.msg_type_url)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGrantsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "granter", + "grantee", + "msg_type_url", + "msgTypeUrl", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + MsgTypeUrl, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "msgTypeUrl" | "msg_type_url" => Ok(GeneratedField::MsgTypeUrl), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGrantsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGrantsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut msg_type_url__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::MsgTypeUrl => { + if msg_type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrl")); + } + msg_type_url__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGrantsRequest { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + msg_type_url: msg_type_url__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGrantsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGrantsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grants.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.authz.v1beta1.QueryGrantsResponse", len)?; + if !self.grants.is_empty() { + struct_ser.serialize_field("grants", &self.grants)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGrantsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grants", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grants, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grants" => Ok(GeneratedField::Grants), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGrantsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.authz.v1beta1.QueryGrantsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grants__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grants => { + if grants__.is_some() { + return Err(serde::de::Error::duplicate_field("grants")); + } + grants__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGrantsResponse { + grants: grants__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.authz.v1beta1.QueryGrantsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.rs index f9872902..996d974c 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.rs @@ -371,5 +371,6 @@ pub struct MsgMultiSend { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgMultiSendResponse {} +include!("cosmos.bank.v1beta1.serde.rs"); include!("cosmos.bank.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.serde.rs new file mode 100644 index 00000000..6e721859 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.bank.v1beta1.serde.rs @@ -0,0 +1,3744 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Balance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.coins.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Balance", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.coins.is_empty() { + struct_ser.serialize_field("coins", &self.coins)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Balance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "coins"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Coins, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "coins" => Ok(GeneratedField::Coins), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Balance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Balance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut coins__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Coins => { + if coins__.is_some() { + return Err(serde::de::Error::duplicate_field("coins")); + } + coins__ = Some(map_.next_value()?); + } + } + } + Ok(Balance { + address: address__.unwrap_or_default(), + coins: coins__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Balance", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DenomOwner { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.balance.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.DenomOwner", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.balance.as_ref() { + struct_ser.serialize_field("balance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DenomOwner { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "balance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Balance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "balance" => Ok(GeneratedField::Balance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DenomOwner; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.DenomOwner") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Balance => { + if balance__.is_some() { + return Err(serde::de::Error::duplicate_field("balance")); + } + balance__ = map_.next_value()?; + } + } + } + Ok(DenomOwner { + address: address__.unwrap_or_default(), + balance: balance__, + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.DenomOwner", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DenomUnit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if self.exponent != 0 { + len += 1; + } + if !self.aliases.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.DenomUnit", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if self.exponent != 0 { + struct_ser.serialize_field("exponent", &self.exponent)?; + } + if !self.aliases.is_empty() { + struct_ser.serialize_field("aliases", &self.aliases)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DenomUnit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "exponent", "aliases"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Exponent, + Aliases, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "exponent" => Ok(GeneratedField::Exponent), + "aliases" => Ok(GeneratedField::Aliases), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DenomUnit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.DenomUnit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut exponent__ = None; + let mut aliases__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Exponent => { + if exponent__.is_some() { + return Err(serde::de::Error::duplicate_field("exponent")); + } + exponent__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Aliases => { + if aliases__.is_some() { + return Err(serde::de::Error::duplicate_field("aliases")); + } + aliases__ = Some(map_.next_value()?); + } + } + } + Ok(DenomUnit { + denom: denom__.unwrap_or_default(), + exponent: exponent__.unwrap_or_default(), + aliases: aliases__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.DenomUnit", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if !self.balances.is_empty() { + len += 1; + } + if !self.supply.is_empty() { + len += 1; + } + if !self.denom_metadata.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if !self.balances.is_empty() { + struct_ser.serialize_field("balances", &self.balances)?; + } + if !self.supply.is_empty() { + struct_ser.serialize_field("supply", &self.supply)?; + } + if !self.denom_metadata.is_empty() { + struct_ser.serialize_field("denomMetadata", &self.denom_metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + "balances", + "supply", + "denom_metadata", + "denomMetadata", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + Balances, + Supply, + DenomMetadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "balances" => Ok(GeneratedField::Balances), + "supply" => Ok(GeneratedField::Supply), + "denomMetadata" | "denom_metadata" => Ok(GeneratedField::DenomMetadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut balances__ = None; + let mut supply__ = None; + let mut denom_metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::Balances => { + if balances__.is_some() { + return Err(serde::de::Error::duplicate_field("balances")); + } + balances__ = Some(map_.next_value()?); + } + GeneratedField::Supply => { + if supply__.is_some() { + return Err(serde::de::Error::duplicate_field("supply")); + } + supply__ = Some(map_.next_value()?); + } + GeneratedField::DenomMetadata => { + if denom_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("denomMetadata")); + } + denom_metadata__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + balances: balances__.unwrap_or_default(), + supply: supply__.unwrap_or_default(), + denom_metadata: denom_metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Input { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.coins.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Input", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.coins.is_empty() { + struct_ser.serialize_field("coins", &self.coins)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Input { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "coins"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Coins, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "coins" => Ok(GeneratedField::Coins), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Input; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Input") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut coins__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Coins => { + if coins__.is_some() { + return Err(serde::de::Error::duplicate_field("coins")); + } + coins__ = Some(map_.next_value()?); + } + } + } + Ok(Input { + address: address__.unwrap_or_default(), + coins: coins__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Input", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Metadata { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.description.is_empty() { + len += 1; + } + if !self.denom_units.is_empty() { + len += 1; + } + if !self.base.is_empty() { + len += 1; + } + if !self.display.is_empty() { + len += 1; + } + if !self.name.is_empty() { + len += 1; + } + if !self.symbol.is_empty() { + len += 1; + } + if !self.uri.is_empty() { + len += 1; + } + if !self.uri_hash.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Metadata", len)?; + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.denom_units.is_empty() { + struct_ser.serialize_field("denomUnits", &self.denom_units)?; + } + if !self.base.is_empty() { + struct_ser.serialize_field("base", &self.base)?; + } + if !self.display.is_empty() { + struct_ser.serialize_field("display", &self.display)?; + } + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.symbol.is_empty() { + struct_ser.serialize_field("symbol", &self.symbol)?; + } + if !self.uri.is_empty() { + struct_ser.serialize_field("uri", &self.uri)?; + } + if !self.uri_hash.is_empty() { + struct_ser.serialize_field("uriHash", &self.uri_hash)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Metadata { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "description", + "denom_units", + "denomUnits", + "base", + "display", + "name", + "symbol", + "uri", + "uri_hash", + "uriHash", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Description, + DenomUnits, + Base, + Display, + Name, + Symbol, + Uri, + UriHash, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "description" => Ok(GeneratedField::Description), + "denomUnits" | "denom_units" => Ok(GeneratedField::DenomUnits), + "base" => Ok(GeneratedField::Base), + "display" => Ok(GeneratedField::Display), + "name" => Ok(GeneratedField::Name), + "symbol" => Ok(GeneratedField::Symbol), + "uri" => Ok(GeneratedField::Uri), + "uriHash" | "uri_hash" => Ok(GeneratedField::UriHash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Metadata; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Metadata") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut description__ = None; + let mut denom_units__ = None; + let mut base__ = None; + let mut display__ = None; + let mut name__ = None; + let mut symbol__ = None; + let mut uri__ = None; + let mut uri_hash__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::DenomUnits => { + if denom_units__.is_some() { + return Err(serde::de::Error::duplicate_field("denomUnits")); + } + denom_units__ = Some(map_.next_value()?); + } + GeneratedField::Base => { + if base__.is_some() { + return Err(serde::de::Error::duplicate_field("base")); + } + base__ = Some(map_.next_value()?); + } + GeneratedField::Display => { + if display__.is_some() { + return Err(serde::de::Error::duplicate_field("display")); + } + display__ = Some(map_.next_value()?); + } + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Symbol => { + if symbol__.is_some() { + return Err(serde::de::Error::duplicate_field("symbol")); + } + symbol__ = Some(map_.next_value()?); + } + GeneratedField::Uri => { + if uri__.is_some() { + return Err(serde::de::Error::duplicate_field("uri")); + } + uri__ = Some(map_.next_value()?); + } + GeneratedField::UriHash => { + if uri_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("uriHash")); + } + uri_hash__ = Some(map_.next_value()?); + } + } + } + Ok(Metadata { + description: description__.unwrap_or_default(), + denom_units: denom_units__.unwrap_or_default(), + base: base__.unwrap_or_default(), + display: display__.unwrap_or_default(), + name: name__.unwrap_or_default(), + symbol: symbol__.unwrap_or_default(), + uri: uri__.unwrap_or_default(), + uri_hash: uri_hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Metadata", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgMultiSend { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.inputs.is_empty() { + len += 1; + } + if !self.outputs.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.MsgMultiSend", len)?; + if !self.inputs.is_empty() { + struct_ser.serialize_field("inputs", &self.inputs)?; + } + if !self.outputs.is_empty() { + struct_ser.serialize_field("outputs", &self.outputs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgMultiSend { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["inputs", "outputs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Inputs, + Outputs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "inputs" => Ok(GeneratedField::Inputs), + "outputs" => Ok(GeneratedField::Outputs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgMultiSend; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.MsgMultiSend") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut inputs__ = None; + let mut outputs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Inputs => { + if inputs__.is_some() { + return Err(serde::de::Error::duplicate_field("inputs")); + } + inputs__ = Some(map_.next_value()?); + } + GeneratedField::Outputs => { + if outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("outputs")); + } + outputs__ = Some(map_.next_value()?); + } + } + } + Ok(MsgMultiSend { + inputs: inputs__.unwrap_or_default(), + outputs: outputs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.MsgMultiSend", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgMultiSendResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.MsgMultiSendResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgMultiSendResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgMultiSendResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.MsgMultiSendResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgMultiSendResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.MsgMultiSendResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSend { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.from_address.is_empty() { + len += 1; + } + if !self.to_address.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.MsgSend", len)?; + if !self.from_address.is_empty() { + struct_ser.serialize_field("fromAddress", &self.from_address)?; + } + if !self.to_address.is_empty() { + struct_ser.serialize_field("toAddress", &self.to_address)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSend { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "from_address", + "fromAddress", + "to_address", + "toAddress", + "amount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + FromAddress, + ToAddress, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fromAddress" | "from_address" => Ok(GeneratedField::FromAddress), + "toAddress" | "to_address" => Ok(GeneratedField::ToAddress), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSend; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.MsgSend") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut from_address__ = None; + let mut to_address__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::FromAddress => { + if from_address__.is_some() { + return Err(serde::de::Error::duplicate_field("fromAddress")); + } + from_address__ = Some(map_.next_value()?); + } + GeneratedField::ToAddress => { + if to_address__.is_some() { + return Err(serde::de::Error::duplicate_field("toAddress")); + } + to_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgSend { + from_address: from_address__.unwrap_or_default(), + to_address: to_address__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.MsgSend", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSendResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.MsgSendResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSendResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSendResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.MsgSendResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgSendResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.MsgSendResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Output { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.coins.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Output", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.coins.is_empty() { + struct_ser.serialize_field("coins", &self.coins)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Output { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "coins"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Coins, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "coins" => Ok(GeneratedField::Coins), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Output; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Output") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut coins__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Coins => { + if coins__.is_some() { + return Err(serde::de::Error::duplicate_field("coins")); + } + coins__ = Some(map_.next_value()?); + } + } + } + Ok(Output { + address: address__.unwrap_or_default(), + coins: coins__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Output", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.send_enabled.is_empty() { + len += 1; + } + if self.default_send_enabled { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Params", len)?; + if !self.send_enabled.is_empty() { + struct_ser.serialize_field("sendEnabled", &self.send_enabled)?; + } + if self.default_send_enabled { + struct_ser.serialize_field("defaultSendEnabled", &self.default_send_enabled)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "send_enabled", + "sendEnabled", + "default_send_enabled", + "defaultSendEnabled", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SendEnabled, + DefaultSendEnabled, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sendEnabled" | "send_enabled" => Ok(GeneratedField::SendEnabled), + "defaultSendEnabled" | "default_send_enabled" => { + Ok(GeneratedField::DefaultSendEnabled) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut send_enabled__ = None; + let mut default_send_enabled__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SendEnabled => { + if send_enabled__.is_some() { + return Err(serde::de::Error::duplicate_field("sendEnabled")); + } + send_enabled__ = Some(map_.next_value()?); + } + GeneratedField::DefaultSendEnabled => { + if default_send_enabled__.is_some() { + return Err(serde::de::Error::duplicate_field( + "defaultSendEnabled", + )); + } + default_send_enabled__ = Some(map_.next_value()?); + } + } + } + Ok(Params { + send_enabled: send_enabled__.unwrap_or_default(), + default_send_enabled: default_send_enabled__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllBalancesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryAllBalancesRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllBalancesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllBalancesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryAllBalancesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllBalancesRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryAllBalancesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllBalancesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.balances.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryAllBalancesResponse", len)?; + if !self.balances.is_empty() { + struct_ser.serialize_field("balances", &self.balances)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllBalancesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["balances", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Balances, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "balances" => Ok(GeneratedField::Balances), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllBalancesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryAllBalancesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut balances__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Balances => { + if balances__.is_some() { + return Err(serde::de::Error::duplicate_field("balances")); + } + balances__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllBalancesResponse { + balances: balances__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryAllBalancesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryBalanceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.denom.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryBalanceRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryBalanceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "denom"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Denom, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "denom" => Ok(GeneratedField::Denom), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryBalanceRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryBalanceRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut denom__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + } + } + Ok(QueryBalanceRequest { + address: address__.unwrap_or_default(), + denom: denom__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryBalanceRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryBalanceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.balance.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryBalanceResponse", len)?; + if let Some(v) = self.balance.as_ref() { + struct_ser.serialize_field("balance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryBalanceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["balance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Balance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "balance" => Ok(GeneratedField::Balance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryBalanceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryBalanceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Balance => { + if balance__.is_some() { + return Err(serde::de::Error::duplicate_field("balance")); + } + balance__ = map_.next_value()?; + } + } + } + Ok(QueryBalanceResponse { balance: balance__ }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryBalanceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomMetadataRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomMetadataRequest", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomMetadataRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomMetadataRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomMetadataRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDenomMetadataRequest { + denom: denom__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomMetadataRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomMetadataResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.metadata.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomMetadataResponse", len)?; + if let Some(v) = self.metadata.as_ref() { + struct_ser.serialize_field("metadata", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomMetadataResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomMetadataResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomMetadataResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = map_.next_value()?; + } + } + } + Ok(QueryDenomMetadataResponse { + metadata: metadata__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomMetadataResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomOwnersRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomOwnersRequest", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomOwnersRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomOwnersRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomOwnersRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDenomOwnersRequest { + denom: denom__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomOwnersRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomOwnersResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom_owners.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomOwnersResponse", len)?; + if !self.denom_owners.is_empty() { + struct_ser.serialize_field("denomOwners", &self.denom_owners)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomOwnersResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom_owners", "denomOwners", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DenomOwners, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denomOwners" | "denom_owners" => Ok(GeneratedField::DenomOwners), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomOwnersResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomOwnersResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom_owners__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DenomOwners => { + if denom_owners__.is_some() { + return Err(serde::de::Error::duplicate_field("denomOwners")); + } + denom_owners__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDenomOwnersResponse { + denom_owners: denom_owners__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomOwnersResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomsMetadataRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomsMetadataRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomsMetadataRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomsMetadataRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomsMetadataRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDenomsMetadataRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDenomsMetadataResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.metadatas.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryDenomsMetadataResponse", len)?; + if !self.metadatas.is_empty() { + struct_ser.serialize_field("metadatas", &self.metadatas)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDenomsMetadataResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["metadatas", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Metadatas, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "metadatas" => Ok(GeneratedField::Metadatas), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDenomsMetadataResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryDenomsMetadataResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut metadatas__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Metadatas => { + if metadatas__.is_some() { + return Err(serde::de::Error::duplicate_field("metadatas")); + } + metadatas__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDenomsMetadataResponse { + metadatas: metadatas__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySpendableBalancesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.bank.v1beta1.QuerySpendableBalancesRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySpendableBalancesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySpendableBalancesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QuerySpendableBalancesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QuerySpendableBalancesRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySpendableBalancesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.balances.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.bank.v1beta1.QuerySpendableBalancesResponse", len)?; + if !self.balances.is_empty() { + struct_ser.serialize_field("balances", &self.balances)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySpendableBalancesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["balances", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Balances, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "balances" => Ok(GeneratedField::Balances), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySpendableBalancesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QuerySpendableBalancesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut balances__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Balances => { + if balances__.is_some() { + return Err(serde::de::Error::duplicate_field("balances")); + } + balances__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QuerySpendableBalancesResponse { + balances: balances__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySupplyOfRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QuerySupplyOfRequest", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySupplyOfRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySupplyOfRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QuerySupplyOfRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + } + } + Ok(QuerySupplyOfRequest { + denom: denom__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QuerySupplyOfRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySupplyOfResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.amount.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QuerySupplyOfResponse", len)?; + if let Some(v) = self.amount.as_ref() { + struct_ser.serialize_field("amount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySupplyOfResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySupplyOfResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QuerySupplyOfResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = map_.next_value()?; + } + } + } + Ok(QuerySupplyOfResponse { amount: amount__ }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QuerySupplyOfResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTotalSupplyRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryTotalSupplyRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTotalSupplyRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTotalSupplyRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryTotalSupplyRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryTotalSupplyRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryTotalSupplyRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTotalSupplyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.supply.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.QueryTotalSupplyResponse", len)?; + if !self.supply.is_empty() { + struct_ser.serialize_field("supply", &self.supply)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTotalSupplyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["supply", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Supply, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "supply" => Ok(GeneratedField::Supply), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTotalSupplyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.QueryTotalSupplyResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut supply__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Supply => { + if supply__.is_some() { + return Err(serde::de::Error::duplicate_field("supply")); + } + supply__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryTotalSupplyResponse { + supply: supply__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.QueryTotalSupplyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SendAuthorization { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.spend_limit.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.bank.v1beta1.SendAuthorization", len)?; + if !self.spend_limit.is_empty() { + struct_ser.serialize_field("spendLimit", &self.spend_limit)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SendAuthorization { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["spend_limit", "spendLimit"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SpendLimit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "spendLimit" | "spend_limit" => Ok(GeneratedField::SpendLimit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SendAuthorization; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.SendAuthorization") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut spend_limit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SpendLimit => { + if spend_limit__.is_some() { + return Err(serde::de::Error::duplicate_field("spendLimit")); + } + spend_limit__ = Some(map_.next_value()?); + } + } + } + Ok(SendAuthorization { + spend_limit: spend_limit__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.bank.v1beta1.SendAuthorization", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SendEnabled { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if self.enabled { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.SendEnabled", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if self.enabled { + struct_ser.serialize_field("enabled", &self.enabled)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SendEnabled { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "enabled"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Enabled, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "enabled" => Ok(GeneratedField::Enabled), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SendEnabled; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.SendEnabled") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut enabled__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Enabled => { + if enabled__.is_some() { + return Err(serde::de::Error::duplicate_field("enabled")); + } + enabled__ = Some(map_.next_value()?); + } + } + } + Ok(SendEnabled { + denom: denom__.unwrap_or_default(), + enabled: enabled__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.SendEnabled", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Supply { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.total.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.bank.v1beta1.Supply", len)?; + if !self.total.is_empty() { + struct_ser.serialize_field("total", &self.total)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Supply { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["total"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Total, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "total" => Ok(GeneratedField::Total), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Supply; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.bank.v1beta1.Supply") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut total__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Total => { + if total__.is_some() { + return Err(serde::de::Error::duplicate_field("total")); + } + total__ = Some(map_.next_value()?); + } + } + } + Ok(Supply { + total: total__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.bank.v1beta1.Supply", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs index 61d10824..32cc85c9 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs @@ -178,4 +178,5 @@ pub struct SearchTxsResult { #[prost(message, repeated, tag = "6")] pub txs: ::prost::alloc::vec::Vec, } +include!("cosmos.base.abci.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.serde.rs new file mode 100644 index 00000000..83877efe --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.serde.rs @@ -0,0 +1,1536 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AbciMessageLog { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.msg_index != 0 { + len += 1; + } + if !self.log.is_empty() { + len += 1; + } + if !self.events.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.ABCIMessageLog", len)?; + if self.msg_index != 0 { + struct_ser.serialize_field("msgIndex", &self.msg_index)?; + } + if !self.log.is_empty() { + struct_ser.serialize_field("log", &self.log)?; + } + if !self.events.is_empty() { + struct_ser.serialize_field("events", &self.events)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AbciMessageLog { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_index", "msgIndex", "log", "events"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgIndex, + Log, + Events, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgIndex" | "msg_index" => Ok(GeneratedField::MsgIndex), + "log" => Ok(GeneratedField::Log), + "events" => Ok(GeneratedField::Events), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AbciMessageLog; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.ABCIMessageLog") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_index__ = None; + let mut log__ = None; + let mut events__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgIndex => { + if msg_index__.is_some() { + return Err(serde::de::Error::duplicate_field("msgIndex")); + } + msg_index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Log => { + if log__.is_some() { + return Err(serde::de::Error::duplicate_field("log")); + } + log__ = Some(map_.next_value()?); + } + GeneratedField::Events => { + if events__.is_some() { + return Err(serde::de::Error::duplicate_field("events")); + } + events__ = Some(map_.next_value()?); + } + } + } + Ok(AbciMessageLog { + msg_index: msg_index__.unwrap_or_default(), + log: log__.unwrap_or_default(), + events: events__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.ABCIMessageLog", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Attribute { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.Attribute", len)?; + if !self.key.is_empty() { + struct_ser.serialize_field("key", &self.key)?; + } + if !self.value.is_empty() { + struct_ser.serialize_field("value", &self.value)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Attribute { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Attribute; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.Attribute") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some(map_.next_value()?); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some(map_.next_value()?); + } + } + } + Ok(Attribute { + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.Attribute", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GasInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.gas_wanted != 0 { + len += 1; + } + if self.gas_used != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.GasInfo", len)?; + if self.gas_wanted != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("gasWanted", ToString::to_string(&self.gas_wanted).as_str())?; + } + if self.gas_used != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("gasUsed", ToString::to_string(&self.gas_used).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GasInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["gas_wanted", "gasWanted", "gas_used", "gasUsed"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GasWanted, + GasUsed, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "gasWanted" | "gas_wanted" => Ok(GeneratedField::GasWanted), + "gasUsed" | "gas_used" => Ok(GeneratedField::GasUsed), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GasInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.GasInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut gas_wanted__ = None; + let mut gas_used__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GasWanted => { + if gas_wanted__.is_some() { + return Err(serde::de::Error::duplicate_field("gasWanted")); + } + gas_wanted__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GasUsed => { + if gas_used__.is_some() { + return Err(serde::de::Error::duplicate_field("gasUsed")); + } + gas_used__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(GasInfo { + gas_wanted: gas_wanted__.unwrap_or_default(), + gas_used: gas_used__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.GasInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgData { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg_type.is_empty() { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.MsgData", len)?; + if !self.msg_type.is_empty() { + struct_ser.serialize_field("msgType", &self.msg_type)?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgData { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_type", "msgType", "data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgType, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgType" | "msg_type" => Ok(GeneratedField::MsgType), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgData; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.MsgData") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_type__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgType => { + if msg_type__.is_some() { + return Err(serde::de::Error::duplicate_field("msgType")); + } + msg_type__ = Some(map_.next_value()?); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgData { + msg_type: msg_type__.unwrap_or_default(), + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.MsgData", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Result { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + if !self.log.is_empty() { + len += 1; + } + if !self.events.is_empty() { + len += 1; + } + if !self.msg_responses.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.abci.v1beta1.Result", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + if !self.log.is_empty() { + struct_ser.serialize_field("log", &self.log)?; + } + if !self.events.is_empty() { + struct_ser.serialize_field("events", &self.events)?; + } + if !self.msg_responses.is_empty() { + struct_ser.serialize_field("msgResponses", &self.msg_responses)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Result { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data", "log", "events", "msg_responses", "msgResponses"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + Log, + Events, + MsgResponses, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + "log" => Ok(GeneratedField::Log), + "events" => Ok(GeneratedField::Events), + "msgResponses" | "msg_responses" => Ok(GeneratedField::MsgResponses), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Result; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.Result") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + let mut log__ = None; + let mut events__ = None; + let mut msg_responses__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Log => { + if log__.is_some() { + return Err(serde::de::Error::duplicate_field("log")); + } + log__ = Some(map_.next_value()?); + } + GeneratedField::Events => { + if events__.is_some() { + return Err(serde::de::Error::duplicate_field("events")); + } + events__ = Some(map_.next_value()?); + } + GeneratedField::MsgResponses => { + if msg_responses__.is_some() { + return Err(serde::de::Error::duplicate_field("msgResponses")); + } + msg_responses__ = Some(map_.next_value()?); + } + } + } + Ok(Result { + data: data__.unwrap_or_default(), + log: log__.unwrap_or_default(), + events: events__.unwrap_or_default(), + msg_responses: msg_responses__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.abci.v1beta1.Result", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SearchTxsResult { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.total_count != 0 { + len += 1; + } + if self.count != 0 { + len += 1; + } + if self.page_number != 0 { + len += 1; + } + if self.page_total != 0 { + len += 1; + } + if self.limit != 0 { + len += 1; + } + if !self.txs.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.SearchTxsResult", len)?; + if self.total_count != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "totalCount", + ToString::to_string(&self.total_count).as_str(), + )?; + } + if self.count != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("count", ToString::to_string(&self.count).as_str())?; + } + if self.page_number != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "pageNumber", + ToString::to_string(&self.page_number).as_str(), + )?; + } + if self.page_total != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("pageTotal", ToString::to_string(&self.page_total).as_str())?; + } + if self.limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("limit", ToString::to_string(&self.limit).as_str())?; + } + if !self.txs.is_empty() { + struct_ser.serialize_field("txs", &self.txs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SearchTxsResult { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "total_count", + "totalCount", + "count", + "page_number", + "pageNumber", + "page_total", + "pageTotal", + "limit", + "txs", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TotalCount, + Count, + PageNumber, + PageTotal, + Limit, + Txs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "totalCount" | "total_count" => Ok(GeneratedField::TotalCount), + "count" => Ok(GeneratedField::Count), + "pageNumber" | "page_number" => Ok(GeneratedField::PageNumber), + "pageTotal" | "page_total" => Ok(GeneratedField::PageTotal), + "limit" => Ok(GeneratedField::Limit), + "txs" => Ok(GeneratedField::Txs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SearchTxsResult; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.SearchTxsResult") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut total_count__ = None; + let mut count__ = None; + let mut page_number__ = None; + let mut page_total__ = None; + let mut limit__ = None; + let mut txs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TotalCount => { + if total_count__.is_some() { + return Err(serde::de::Error::duplicate_field("totalCount")); + } + total_count__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Count => { + if count__.is_some() { + return Err(serde::de::Error::duplicate_field("count")); + } + count__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::PageNumber => { + if page_number__.is_some() { + return Err(serde::de::Error::duplicate_field("pageNumber")); + } + page_number__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::PageTotal => { + if page_total__.is_some() { + return Err(serde::de::Error::duplicate_field("pageTotal")); + } + page_total__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Limit => { + if limit__.is_some() { + return Err(serde::de::Error::duplicate_field("limit")); + } + limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Txs => { + if txs__.is_some() { + return Err(serde::de::Error::duplicate_field("txs")); + } + txs__ = Some(map_.next_value()?); + } + } + } + Ok(SearchTxsResult { + total_count: total_count__.unwrap_or_default(), + count: count__.unwrap_or_default(), + page_number: page_number__.unwrap_or_default(), + page_total: page_total__.unwrap_or_default(), + limit: limit__.unwrap_or_default(), + txs: txs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.SearchTxsResult", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SimulationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.gas_info.is_some() { + len += 1; + } + if self.result.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.SimulationResponse", len)?; + if let Some(v) = self.gas_info.as_ref() { + struct_ser.serialize_field("gasInfo", v)?; + } + if let Some(v) = self.result.as_ref() { + struct_ser.serialize_field("result", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SimulationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["gas_info", "gasInfo", "result"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GasInfo, + Result, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "gasInfo" | "gas_info" => Ok(GeneratedField::GasInfo), + "result" => Ok(GeneratedField::Result), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SimulationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.SimulationResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut gas_info__ = None; + let mut result__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GasInfo => { + if gas_info__.is_some() { + return Err(serde::de::Error::duplicate_field("gasInfo")); + } + gas_info__ = map_.next_value()?; + } + GeneratedField::Result => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("result")); + } + result__ = map_.next_value()?; + } + } + } + Ok(SimulationResponse { + gas_info: gas_info__, + result: result__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.SimulationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StringEvent { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.r#type.is_empty() { + len += 1; + } + if !self.attributes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.StringEvent", len)?; + if !self.r#type.is_empty() { + struct_ser.serialize_field("type", &self.r#type)?; + } + if !self.attributes.is_empty() { + struct_ser.serialize_field("attributes", &self.attributes)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StringEvent { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["type", "attributes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Type, + Attributes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "type" => Ok(GeneratedField::Type), + "attributes" => Ok(GeneratedField::Attributes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StringEvent; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.StringEvent") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut r#type__ = None; + let mut attributes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Type => { + if r#type__.is_some() { + return Err(serde::de::Error::duplicate_field("type")); + } + r#type__ = Some(map_.next_value()?); + } + GeneratedField::Attributes => { + if attributes__.is_some() { + return Err(serde::de::Error::duplicate_field("attributes")); + } + attributes__ = Some(map_.next_value()?); + } + } + } + Ok(StringEvent { + r#type: r#type__.unwrap_or_default(), + attributes: attributes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.StringEvent", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TxMsgData { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + if !self.msg_responses.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.TxMsgData", len)?; + if !self.data.is_empty() { + struct_ser.serialize_field("data", &self.data)?; + } + if !self.msg_responses.is_empty() { + struct_ser.serialize_field("msgResponses", &self.msg_responses)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TxMsgData { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data", "msg_responses", "msgResponses"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + MsgResponses, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + "msgResponses" | "msg_responses" => Ok(GeneratedField::MsgResponses), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TxMsgData; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.TxMsgData") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + let mut msg_responses__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some(map_.next_value()?); + } + GeneratedField::MsgResponses => { + if msg_responses__.is_some() { + return Err(serde::de::Error::duplicate_field("msgResponses")); + } + msg_responses__ = Some(map_.next_value()?); + } + } + } + Ok(TxMsgData { + data: data__.unwrap_or_default(), + msg_responses: msg_responses__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.TxMsgData", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TxResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + if !self.txhash.is_empty() { + len += 1; + } + if !self.codespace.is_empty() { + len += 1; + } + if self.code != 0 { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + if !self.raw_log.is_empty() { + len += 1; + } + if !self.logs.is_empty() { + len += 1; + } + if !self.info.is_empty() { + len += 1; + } + if self.gas_wanted != 0 { + len += 1; + } + if self.gas_used != 0 { + len += 1; + } + if self.tx.is_some() { + len += 1; + } + if !self.timestamp.is_empty() { + len += 1; + } + if !self.events.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.abci.v1beta1.TxResponse", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if !self.txhash.is_empty() { + struct_ser.serialize_field("txhash", &self.txhash)?; + } + if !self.codespace.is_empty() { + struct_ser.serialize_field("codespace", &self.codespace)?; + } + if self.code != 0 { + struct_ser.serialize_field("code", &self.code)?; + } + if !self.data.is_empty() { + struct_ser.serialize_field("data", &self.data)?; + } + if !self.raw_log.is_empty() { + struct_ser.serialize_field("rawLog", &self.raw_log)?; + } + if !self.logs.is_empty() { + struct_ser.serialize_field("logs", &self.logs)?; + } + if !self.info.is_empty() { + struct_ser.serialize_field("info", &self.info)?; + } + if self.gas_wanted != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("gasWanted", ToString::to_string(&self.gas_wanted).as_str())?; + } + if self.gas_used != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("gasUsed", ToString::to_string(&self.gas_used).as_str())?; + } + if let Some(v) = self.tx.as_ref() { + struct_ser.serialize_field("tx", v)?; + } + if !self.timestamp.is_empty() { + struct_ser.serialize_field("timestamp", &self.timestamp)?; + } + if !self.events.is_empty() { + struct_ser.serialize_field("events", &self.events)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TxResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "height", + "txhash", + "codespace", + "code", + "data", + "raw_log", + "rawLog", + "logs", + "info", + "gas_wanted", + "gasWanted", + "gas_used", + "gasUsed", + "tx", + "timestamp", + "events", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + Txhash, + Codespace, + Code, + Data, + RawLog, + Logs, + Info, + GasWanted, + GasUsed, + Tx, + Timestamp, + Events, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + "txhash" => Ok(GeneratedField::Txhash), + "codespace" => Ok(GeneratedField::Codespace), + "code" => Ok(GeneratedField::Code), + "data" => Ok(GeneratedField::Data), + "rawLog" | "raw_log" => Ok(GeneratedField::RawLog), + "logs" => Ok(GeneratedField::Logs), + "info" => Ok(GeneratedField::Info), + "gasWanted" | "gas_wanted" => Ok(GeneratedField::GasWanted), + "gasUsed" | "gas_used" => Ok(GeneratedField::GasUsed), + "tx" => Ok(GeneratedField::Tx), + "timestamp" => Ok(GeneratedField::Timestamp), + "events" => Ok(GeneratedField::Events), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TxResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.abci.v1beta1.TxResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + let mut txhash__ = None; + let mut codespace__ = None; + let mut code__ = None; + let mut data__ = None; + let mut raw_log__ = None; + let mut logs__ = None; + let mut info__ = None; + let mut gas_wanted__ = None; + let mut gas_used__ = None; + let mut tx__ = None; + let mut timestamp__ = None; + let mut events__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Txhash => { + if txhash__.is_some() { + return Err(serde::de::Error::duplicate_field("txhash")); + } + txhash__ = Some(map_.next_value()?); + } + GeneratedField::Codespace => { + if codespace__.is_some() { + return Err(serde::de::Error::duplicate_field("codespace")); + } + codespace__ = Some(map_.next_value()?); + } + GeneratedField::Code => { + if code__.is_some() { + return Err(serde::de::Error::duplicate_field("code")); + } + code__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some(map_.next_value()?); + } + GeneratedField::RawLog => { + if raw_log__.is_some() { + return Err(serde::de::Error::duplicate_field("rawLog")); + } + raw_log__ = Some(map_.next_value()?); + } + GeneratedField::Logs => { + if logs__.is_some() { + return Err(serde::de::Error::duplicate_field("logs")); + } + logs__ = Some(map_.next_value()?); + } + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = Some(map_.next_value()?); + } + GeneratedField::GasWanted => { + if gas_wanted__.is_some() { + return Err(serde::de::Error::duplicate_field("gasWanted")); + } + gas_wanted__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GasUsed => { + if gas_used__.is_some() { + return Err(serde::de::Error::duplicate_field("gasUsed")); + } + gas_used__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Tx => { + if tx__.is_some() { + return Err(serde::de::Error::duplicate_field("tx")); + } + tx__ = map_.next_value()?; + } + GeneratedField::Timestamp => { + if timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("timestamp")); + } + timestamp__ = Some(map_.next_value()?); + } + GeneratedField::Events => { + if events__.is_some() { + return Err(serde::de::Error::duplicate_field("events")); + } + events__ = Some(map_.next_value()?); + } + } + } + Ok(TxResponse { + height: height__.unwrap_or_default(), + txhash: txhash__.unwrap_or_default(), + codespace: codespace__.unwrap_or_default(), + code: code__.unwrap_or_default(), + data: data__.unwrap_or_default(), + raw_log: raw_log__.unwrap_or_default(), + logs: logs__.unwrap_or_default(), + info: info__.unwrap_or_default(), + gas_wanted: gas_wanted__.unwrap_or_default(), + gas_used: gas_used__.unwrap_or_default(), + tx: tx__, + timestamp: timestamp__.unwrap_or_default(), + events: events__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.abci.v1beta1.TxResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.rs index f4667040..ddd20355 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.rs @@ -15,4 +15,5 @@ pub struct Pair { #[prost(bytes = "vec", tag = "2")] pub value: ::prost::alloc::vec::Vec, } +include!("cosmos.base.kv.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.serde.rs new file mode 100644 index 00000000..98c15527 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.kv.v1beta1.serde.rs @@ -0,0 +1,219 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Pair { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.kv.v1beta1.Pair", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Pair { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Pair; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.kv.v1beta1.Pair") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Pair { + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.kv.v1beta1.Pair", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Pairs { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.pairs.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.kv.v1beta1.Pairs", len)?; + if !self.pairs.is_empty() { + struct_ser.serialize_field("pairs", &self.pairs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Pairs { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pairs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pairs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pairs" => Ok(GeneratedField::Pairs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Pairs; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.kv.v1beta1.Pairs") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pairs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pairs => { + if pairs__.is_some() { + return Err(serde::de::Error::duplicate_field("pairs")); + } + pairs__ = Some(map_.next_value()?); + } + } + } + Ok(Pairs { + pairs: pairs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.kv.v1beta1.Pairs", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.rs index c0b5c72c..5b2fcbb4 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.rs @@ -10,5 +10,6 @@ pub struct ConfigResponse { #[prost(string, tag = "1")] pub minimum_gas_price: ::prost::alloc::string::String, } +include!("cosmos.base.node.v1beta1.serde.rs"); include!("cosmos.base.node.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.serde.rs new file mode 100644 index 00000000..55dbf379 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.node.v1beta1.serde.rs @@ -0,0 +1,182 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for ConfigRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.base.node.v1beta1.ConfigRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ConfigRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ConfigRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.node.v1beta1.ConfigRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(ConfigRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.node.v1beta1.ConfigRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ConfigResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.minimum_gas_price.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.node.v1beta1.ConfigResponse", len)?; + if !self.minimum_gas_price.is_empty() { + struct_ser.serialize_field("minimumGasPrice", &self.minimum_gas_price)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ConfigResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["minimum_gas_price", "minimumGasPrice"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MinimumGasPrice, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "minimumGasPrice" | "minimum_gas_price" => { + Ok(GeneratedField::MinimumGasPrice) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ConfigResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.node.v1beta1.ConfigResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut minimum_gas_price__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MinimumGasPrice => { + if minimum_gas_price__.is_some() { + return Err(serde::de::Error::duplicate_field("minimumGasPrice")); + } + minimum_gas_price__ = Some(map_.next_value()?); + } + } + } + Ok(ConfigResponse { + minimum_gas_price: minimum_gas_price__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.node.v1beta1.ConfigResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.rs index 86f391b5..9e79d078 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.rs @@ -55,4 +55,5 @@ pub struct PageResponse { #[prost(uint64, tag = "2")] pub total: u64, } +include!("cosmos.base.query.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.serde.rs new file mode 100644 index 00000000..27639f3d --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.query.v1beta1.serde.rs @@ -0,0 +1,312 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PageRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if self.offset != 0 { + len += 1; + } + if self.limit != 0 { + len += 1; + } + if self.count_total { + len += 1; + } + if self.reverse { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.query.v1beta1.PageRequest", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if self.offset != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("offset", ToString::to_string(&self.offset).as_str())?; + } + if self.limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("limit", ToString::to_string(&self.limit).as_str())?; + } + if self.count_total { + struct_ser.serialize_field("countTotal", &self.count_total)?; + } + if self.reverse { + struct_ser.serialize_field("reverse", &self.reverse)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PageRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "key", + "offset", + "limit", + "count_total", + "countTotal", + "reverse", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Offset, + Limit, + CountTotal, + Reverse, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "offset" => Ok(GeneratedField::Offset), + "limit" => Ok(GeneratedField::Limit), + "countTotal" | "count_total" => Ok(GeneratedField::CountTotal), + "reverse" => Ok(GeneratedField::Reverse), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PageRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.query.v1beta1.PageRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut offset__ = None; + let mut limit__ = None; + let mut count_total__ = None; + let mut reverse__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Offset => { + if offset__.is_some() { + return Err(serde::de::Error::duplicate_field("offset")); + } + offset__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Limit => { + if limit__.is_some() { + return Err(serde::de::Error::duplicate_field("limit")); + } + limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CountTotal => { + if count_total__.is_some() { + return Err(serde::de::Error::duplicate_field("countTotal")); + } + count_total__ = Some(map_.next_value()?); + } + GeneratedField::Reverse => { + if reverse__.is_some() { + return Err(serde::de::Error::duplicate_field("reverse")); + } + reverse__ = Some(map_.next_value()?); + } + } + } + Ok(PageRequest { + key: key__.unwrap_or_default(), + offset: offset__.unwrap_or_default(), + limit: limit__.unwrap_or_default(), + count_total: count_total__.unwrap_or_default(), + reverse: reverse__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.query.v1beta1.PageRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PageResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.next_key.is_empty() { + len += 1; + } + if self.total != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.query.v1beta1.PageResponse", len)?; + if !self.next_key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "nextKey", + pbjson::private::base64::encode(&self.next_key).as_str(), + )?; + } + if self.total != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("total", ToString::to_string(&self.total).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PageResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["next_key", "nextKey", "total"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + NextKey, + Total, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "nextKey" | "next_key" => Ok(GeneratedField::NextKey), + "total" => Ok(GeneratedField::Total), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PageResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.query.v1beta1.PageResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut next_key__ = None; + let mut total__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::NextKey => { + if next_key__.is_some() { + return Err(serde::de::Error::duplicate_field("nextKey")); + } + next_key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Total => { + if total__.is_some() { + return Err(serde::de::Error::duplicate_field("total")); + } + total__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PageResponse { + next_key: next_key__.unwrap_or_default(), + total: total__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.query.v1beta1.PageResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.rs index e238c3a9..0f244d14 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.rs @@ -28,5 +28,6 @@ pub struct ListImplementationsResponse { #[prost(string, repeated, tag = "1")] pub implementation_message_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } +include!("cosmos.base.reflection.v1beta1.serde.rs"); include!("cosmos.base.reflection.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.serde.rs new file mode 100644 index 00000000..29aaa9ea --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v1beta1.serde.rs @@ -0,0 +1,414 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for ListAllInterfacesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ListAllInterfacesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ListAllInterfacesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v1beta1.ListAllInterfacesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(ListAllInterfacesRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v1beta1.ListAllInterfacesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ListAllInterfacesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.interface_names.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", + len, + )?; + if !self.interface_names.is_empty() { + struct_ser.serialize_field("interfaceNames", &self.interface_names)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ListAllInterfacesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["interface_names", "interfaceNames"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + InterfaceNames, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "interfaceNames" | "interface_names" => { + Ok(GeneratedField::InterfaceNames) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ListAllInterfacesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v1beta1.ListAllInterfacesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut interface_names__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::InterfaceNames => { + if interface_names__.is_some() { + return Err(serde::de::Error::duplicate_field("interfaceNames")); + } + interface_names__ = Some(map_.next_value()?); + } + } + } + Ok(ListAllInterfacesResponse { + interface_names: interface_names__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v1beta1.ListAllInterfacesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ListImplementationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.interface_name.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v1beta1.ListImplementationsRequest", + len, + )?; + if !self.interface_name.is_empty() { + struct_ser.serialize_field("interfaceName", &self.interface_name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ListImplementationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["interface_name", "interfaceName"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + InterfaceName, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "interfaceName" | "interface_name" => Ok(GeneratedField::InterfaceName), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ListImplementationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v1beta1.ListImplementationsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut interface_name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::InterfaceName => { + if interface_name__.is_some() { + return Err(serde::de::Error::duplicate_field("interfaceName")); + } + interface_name__ = Some(map_.next_value()?); + } + } + } + Ok(ListImplementationsRequest { + interface_name: interface_name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v1beta1.ListImplementationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ListImplementationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.implementation_message_names.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v1beta1.ListImplementationsResponse", + len, + )?; + if !self.implementation_message_names.is_empty() { + struct_ser.serialize_field( + "implementationMessageNames", + &self.implementation_message_names, + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ListImplementationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["implementation_message_names", "implementationMessageNames"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ImplementationMessageNames, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "implementationMessageNames" | "implementation_message_names" => { + Ok(GeneratedField::ImplementationMessageNames) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ListImplementationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v1beta1.ListImplementationsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut implementation_message_names__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ImplementationMessageNames => { + if implementation_message_names__.is_some() { + return Err(serde::de::Error::duplicate_field( + "implementationMessageNames", + )); + } + implementation_message_names__ = Some(map_.next_value()?); + } + } + } + Ok(ListImplementationsResponse { + implementation_message_names: implementation_message_names__ + .unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v1beta1.ListImplementationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.rs index 583c0f0d..14c79bd6 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.rs @@ -247,5 +247,6 @@ pub struct QueryMethodDescriptor { #[prost(string, tag = "2")] pub full_query_path: ::prost::alloc::string::String, } +include!("cosmos.base.reflection.v2alpha1.serde.rs"); include!("cosmos.base.reflection.v2alpha1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.serde.rs new file mode 100644 index 00000000..94f5d41c --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.reflection.v2alpha1.serde.rs @@ -0,0 +1,2875 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AppDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.authn.is_some() { + len += 1; + } + if self.chain.is_some() { + len += 1; + } + if self.codec.is_some() { + len += 1; + } + if self.configuration.is_some() { + len += 1; + } + if self.query_services.is_some() { + len += 1; + } + if self.tx.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.AppDescriptor", len)?; + if let Some(v) = self.authn.as_ref() { + struct_ser.serialize_field("authn", v)?; + } + if let Some(v) = self.chain.as_ref() { + struct_ser.serialize_field("chain", v)?; + } + if let Some(v) = self.codec.as_ref() { + struct_ser.serialize_field("codec", v)?; + } + if let Some(v) = self.configuration.as_ref() { + struct_ser.serialize_field("configuration", v)?; + } + if let Some(v) = self.query_services.as_ref() { + struct_ser.serialize_field("queryServices", v)?; + } + if let Some(v) = self.tx.as_ref() { + struct_ser.serialize_field("tx", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AppDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "authn", + "chain", + "codec", + "configuration", + "query_services", + "queryServices", + "tx", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authn, + Chain, + Codec, + Configuration, + QueryServices, + Tx, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authn" => Ok(GeneratedField::Authn), + "chain" => Ok(GeneratedField::Chain), + "codec" => Ok(GeneratedField::Codec), + "configuration" => Ok(GeneratedField::Configuration), + "queryServices" | "query_services" => Ok(GeneratedField::QueryServices), + "tx" => Ok(GeneratedField::Tx), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AppDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.AppDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authn__ = None; + let mut chain__ = None; + let mut codec__ = None; + let mut configuration__ = None; + let mut query_services__ = None; + let mut tx__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authn => { + if authn__.is_some() { + return Err(serde::de::Error::duplicate_field("authn")); + } + authn__ = map_.next_value()?; + } + GeneratedField::Chain => { + if chain__.is_some() { + return Err(serde::de::Error::duplicate_field("chain")); + } + chain__ = map_.next_value()?; + } + GeneratedField::Codec => { + if codec__.is_some() { + return Err(serde::de::Error::duplicate_field("codec")); + } + codec__ = map_.next_value()?; + } + GeneratedField::Configuration => { + if configuration__.is_some() { + return Err(serde::de::Error::duplicate_field("configuration")); + } + configuration__ = map_.next_value()?; + } + GeneratedField::QueryServices => { + if query_services__.is_some() { + return Err(serde::de::Error::duplicate_field("queryServices")); + } + query_services__ = map_.next_value()?; + } + GeneratedField::Tx => { + if tx__.is_some() { + return Err(serde::de::Error::duplicate_field("tx")); + } + tx__ = map_.next_value()?; + } + } + } + Ok(AppDescriptor { + authn: authn__, + chain: chain__, + codec: codec__, + configuration: configuration__, + query_services: query_services__, + tx: tx__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.AppDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AuthnDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sign_modes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.AuthnDescriptor", len)?; + if !self.sign_modes.is_empty() { + struct_ser.serialize_field("signModes", &self.sign_modes)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AuthnDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["sign_modes", "signModes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SignModes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "signModes" | "sign_modes" => Ok(GeneratedField::SignModes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuthnDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.AuthnDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sign_modes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SignModes => { + if sign_modes__.is_some() { + return Err(serde::de::Error::duplicate_field("signModes")); + } + sign_modes__ = Some(map_.next_value()?); + } + } + } + Ok(AuthnDescriptor { + sign_modes: sign_modes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.AuthnDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ChainDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.id.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.ChainDescriptor", len)?; + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ChainDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ChainDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.ChainDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + } + } + Ok(ChainDescriptor { + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.ChainDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CodecDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.interfaces.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.CodecDescriptor", len)?; + if !self.interfaces.is_empty() { + struct_ser.serialize_field("interfaces", &self.interfaces)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CodecDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["interfaces"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Interfaces, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "interfaces" => Ok(GeneratedField::Interfaces), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CodecDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.CodecDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut interfaces__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Interfaces => { + if interfaces__.is_some() { + return Err(serde::de::Error::duplicate_field("interfaces")); + } + interfaces__ = Some(map_.next_value()?); + } + } + } + Ok(CodecDescriptor { + interfaces: interfaces__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.CodecDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ConfigurationDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.bech32_account_address_prefix.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + len, + )?; + if !self.bech32_account_address_prefix.is_empty() { + struct_ser.serialize_field( + "bech32AccountAddressPrefix", + &self.bech32_account_address_prefix, + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ConfigurationDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "bech32_account_address_prefix", + "bech32AccountAddressPrefix", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Bech32AccountAddressPrefix, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bech32AccountAddressPrefix" | "bech32_account_address_prefix" => { + Ok(GeneratedField::Bech32AccountAddressPrefix) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ConfigurationDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.ConfigurationDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut bech32_account_address_prefix__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Bech32AccountAddressPrefix => { + if bech32_account_address_prefix__.is_some() { + return Err(serde::de::Error::duplicate_field( + "bech32AccountAddressPrefix", + )); + } + bech32_account_address_prefix__ = Some(map_.next_value()?); + } + } + } + Ok(ConfigurationDescriptor { + bech32_account_address_prefix: bech32_account_address_prefix__ + .unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetAuthnDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetAuthnDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetAuthnDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetAuthnDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetAuthnDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.authn.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + len, + )?; + if let Some(v) = self.authn.as_ref() { + struct_ser.serialize_field("authn", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetAuthnDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["authn"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authn, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authn" => Ok(GeneratedField::Authn), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetAuthnDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authn__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authn => { + if authn__.is_some() { + return Err(serde::de::Error::duplicate_field("authn")); + } + authn__ = map_.next_value()?; + } + } + } + Ok(GetAuthnDescriptorResponse { authn: authn__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetChainDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetChainDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetChainDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetChainDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetChainDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.chain.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + len, + )?; + if let Some(v) = self.chain.as_ref() { + struct_ser.serialize_field("chain", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetChainDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["chain"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Chain, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "chain" => Ok(GeneratedField::Chain), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetChainDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut chain__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Chain => { + if chain__.is_some() { + return Err(serde::de::Error::duplicate_field("chain")); + } + chain__ = map_.next_value()?; + } + } + } + Ok(GetChainDescriptorResponse { chain: chain__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetCodecDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetCodecDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetCodecDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetCodecDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetCodecDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.codec.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + len, + )?; + if let Some(v) = self.codec.as_ref() { + struct_ser.serialize_field("codec", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetCodecDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["codec"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Codec, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codec" => Ok(GeneratedField::Codec), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetCodecDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut codec__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Codec => { + if codec__.is_some() { + return Err(serde::de::Error::duplicate_field("codec")); + } + codec__ = map_.next_value()?; + } + } + } + Ok(GetCodecDescriptorResponse { codec: codec__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetConfigurationDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetConfigurationDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetConfigurationDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetConfigurationDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetConfigurationDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.config.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + len, + )?; + if let Some(v) = self.config.as_ref() { + struct_ser.serialize_field("config", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetConfigurationDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["config"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Config, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "config" => Ok(GeneratedField::Config), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetConfigurationDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut config__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Config => { + if config__.is_some() { + return Err(serde::de::Error::duplicate_field("config")); + } + config__ = map_.next_value()?; + } + } + } + Ok(GetConfigurationDescriptorResponse { config: config__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetQueryServicesDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetQueryServicesDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetQueryServicesDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetQueryServicesDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetQueryServicesDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.queries.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + len, + )?; + if let Some(v) = self.queries.as_ref() { + struct_ser.serialize_field("queries", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetQueryServicesDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["queries"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Queries, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "queries" => Ok(GeneratedField::Queries), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetQueryServicesDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut queries__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Queries => { + if queries__.is_some() { + return Err(serde::de::Error::duplicate_field("queries")); + } + queries__ = map_.next_value()?; + } + } + } + Ok(GetQueryServicesDescriptorResponse { queries: queries__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxDescriptorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxDescriptorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxDescriptorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetTxDescriptorRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxDescriptorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tx.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + len, + )?; + if let Some(v) = self.tx.as_ref() { + struct_ser.serialize_field("tx", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxDescriptorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tx"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tx, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tx" => Ok(GeneratedField::Tx), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxDescriptorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tx__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tx => { + if tx__.is_some() { + return Err(serde::de::Error::duplicate_field("tx")); + } + tx__ = map_.next_value()?; + } + } + } + Ok(GetTxDescriptorResponse { tx: tx__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for InterfaceAcceptingMessageDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fullname.is_empty() { + len += 1; + } + if !self.field_descriptor_names.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + len, + )?; + if !self.fullname.is_empty() { + struct_ser.serialize_field("fullname", &self.fullname)?; + } + if !self.field_descriptor_names.is_empty() { + struct_ser.serialize_field("fieldDescriptorNames", &self.field_descriptor_names)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InterfaceAcceptingMessageDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fullname", "field_descriptor_names", "fieldDescriptorNames"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fullname, + FieldDescriptorNames, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fullname" => Ok(GeneratedField::Fullname), + "fieldDescriptorNames" | "field_descriptor_names" => { + Ok(GeneratedField::FieldDescriptorNames) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InterfaceAcceptingMessageDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fullname__ = None; + let mut field_descriptor_names__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fullname => { + if fullname__.is_some() { + return Err(serde::de::Error::duplicate_field("fullname")); + } + fullname__ = Some(map_.next_value()?); + } + GeneratedField::FieldDescriptorNames => { + if field_descriptor_names__.is_some() { + return Err(serde::de::Error::duplicate_field( + "fieldDescriptorNames", + )); + } + field_descriptor_names__ = Some(map_.next_value()?); + } + } + } + Ok(InterfaceAcceptingMessageDescriptor { + fullname: fullname__.unwrap_or_default(), + field_descriptor_names: field_descriptor_names__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for InterfaceDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fullname.is_empty() { + len += 1; + } + if !self.interface_accepting_messages.is_empty() { + len += 1; + } + if !self.interface_implementers.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.reflection.v2alpha1.InterfaceDescriptor", len)?; + if !self.fullname.is_empty() { + struct_ser.serialize_field("fullname", &self.fullname)?; + } + if !self.interface_accepting_messages.is_empty() { + struct_ser.serialize_field( + "interfaceAcceptingMessages", + &self.interface_accepting_messages, + )?; + } + if !self.interface_implementers.is_empty() { + struct_ser.serialize_field("interfaceImplementers", &self.interface_implementers)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InterfaceDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "fullname", + "interface_accepting_messages", + "interfaceAcceptingMessages", + "interface_implementers", + "interfaceImplementers", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fullname, + InterfaceAcceptingMessages, + InterfaceImplementers, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fullname" => Ok(GeneratedField::Fullname), + "interfaceAcceptingMessages" | "interface_accepting_messages" => { + Ok(GeneratedField::InterfaceAcceptingMessages) + } + "interfaceImplementers" | "interface_implementers" => { + Ok(GeneratedField::InterfaceImplementers) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InterfaceDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.InterfaceDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fullname__ = None; + let mut interface_accepting_messages__ = None; + let mut interface_implementers__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fullname => { + if fullname__.is_some() { + return Err(serde::de::Error::duplicate_field("fullname")); + } + fullname__ = Some(map_.next_value()?); + } + GeneratedField::InterfaceAcceptingMessages => { + if interface_accepting_messages__.is_some() { + return Err(serde::de::Error::duplicate_field( + "interfaceAcceptingMessages", + )); + } + interface_accepting_messages__ = Some(map_.next_value()?); + } + GeneratedField::InterfaceImplementers => { + if interface_implementers__.is_some() { + return Err(serde::de::Error::duplicate_field( + "interfaceImplementers", + )); + } + interface_implementers__ = Some(map_.next_value()?); + } + } + } + Ok(InterfaceDescriptor { + fullname: fullname__.unwrap_or_default(), + interface_accepting_messages: interface_accepting_messages__ + .unwrap_or_default(), + interface_implementers: interface_implementers__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.InterfaceDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for InterfaceImplementerDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fullname.is_empty() { + len += 1; + } + if !self.type_url.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + len, + )?; + if !self.fullname.is_empty() { + struct_ser.serialize_field("fullname", &self.fullname)?; + } + if !self.type_url.is_empty() { + struct_ser.serialize_field("typeUrl", &self.type_url)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InterfaceImplementerDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fullname", "type_url", "typeUrl"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fullname, + TypeUrl, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fullname" => Ok(GeneratedField::Fullname), + "typeUrl" | "type_url" => Ok(GeneratedField::TypeUrl), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InterfaceImplementerDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fullname__ = None; + let mut type_url__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fullname => { + if fullname__.is_some() { + return Err(serde::de::Error::duplicate_field("fullname")); + } + fullname__ = Some(map_.next_value()?); + } + GeneratedField::TypeUrl => { + if type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("typeUrl")); + } + type_url__ = Some(map_.next_value()?); + } + } + } + Ok(InterfaceImplementerDescriptor { + fullname: fullname__.unwrap_or_default(), + type_url: type_url__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.msg_type_url.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.MsgDescriptor", len)?; + if !self.msg_type_url.is_empty() { + struct_ser.serialize_field("msgTypeUrl", &self.msg_type_url)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["msg_type_url", "msgTypeUrl"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MsgTypeUrl, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "msgTypeUrl" | "msg_type_url" => Ok(GeneratedField::MsgTypeUrl), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.MsgDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut msg_type_url__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MsgTypeUrl => { + if msg_type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("msgTypeUrl")); + } + msg_type_url__ = Some(map_.next_value()?); + } + } + } + Ok(MsgDescriptor { + msg_type_url: msg_type_url__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.MsgDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryMethodDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.full_query_path.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.full_query_path.is_empty() { + struct_ser.serialize_field("fullQueryPath", &self.full_query_path)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryMethodDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "full_query_path", "fullQueryPath"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + FullQueryPath, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "fullQueryPath" | "full_query_path" => { + Ok(GeneratedField::FullQueryPath) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryMethodDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.QueryMethodDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut full_query_path__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::FullQueryPath => { + if full_query_path__.is_some() { + return Err(serde::de::Error::duplicate_field("fullQueryPath")); + } + full_query_path__ = Some(map_.next_value()?); + } + } + } + Ok(QueryMethodDescriptor { + name: name__.unwrap_or_default(), + full_query_path: full_query_path__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryServiceDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fullname.is_empty() { + len += 1; + } + if self.is_module { + len += 1; + } + if !self.methods.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + len, + )?; + if !self.fullname.is_empty() { + struct_ser.serialize_field("fullname", &self.fullname)?; + } + if self.is_module { + struct_ser.serialize_field("isModule", &self.is_module)?; + } + if !self.methods.is_empty() { + struct_ser.serialize_field("methods", &self.methods)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryServiceDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fullname", "is_module", "isModule", "methods"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fullname, + IsModule, + Methods, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fullname" => Ok(GeneratedField::Fullname), + "isModule" | "is_module" => Ok(GeneratedField::IsModule), + "methods" => Ok(GeneratedField::Methods), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryServiceDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.QueryServiceDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fullname__ = None; + let mut is_module__ = None; + let mut methods__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fullname => { + if fullname__.is_some() { + return Err(serde::de::Error::duplicate_field("fullname")); + } + fullname__ = Some(map_.next_value()?); + } + GeneratedField::IsModule => { + if is_module__.is_some() { + return Err(serde::de::Error::duplicate_field("isModule")); + } + is_module__ = Some(map_.next_value()?); + } + GeneratedField::Methods => { + if methods__.is_some() { + return Err(serde::de::Error::duplicate_field("methods")); + } + methods__ = Some(map_.next_value()?); + } + } + } + Ok(QueryServiceDescriptor { + fullname: fullname__.unwrap_or_default(), + is_module: is_module__.unwrap_or_default(), + methods: methods__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryServicesDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.query_services.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + len, + )?; + if !self.query_services.is_empty() { + struct_ser.serialize_field("queryServices", &self.query_services)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryServicesDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["query_services", "queryServices"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + QueryServices, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "queryServices" | "query_services" => Ok(GeneratedField::QueryServices), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryServicesDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.reflection.v2alpha1.QueryServicesDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut query_services__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::QueryServices => { + if query_services__.is_some() { + return Err(serde::de::Error::duplicate_field("queryServices")); + } + query_services__ = Some(map_.next_value()?); + } + } + } + Ok(QueryServicesDescriptor { + query_services: query_services__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SigningModeDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.number != 0 { + len += 1; + } + if !self.authn_info_provider_method_fullname.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.reflection.v2alpha1.SigningModeDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if self.number != 0 { + struct_ser.serialize_field("number", &self.number)?; + } + if !self.authn_info_provider_method_fullname.is_empty() { + struct_ser.serialize_field( + "authnInfoProviderMethodFullname", + &self.authn_info_provider_method_fullname, + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SigningModeDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "name", + "number", + "authn_info_provider_method_fullname", + "authnInfoProviderMethodFullname", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Number, + AuthnInfoProviderMethodFullname, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "number" => Ok(GeneratedField::Number), + "authnInfoProviderMethodFullname" + | "authn_info_provider_method_fullname" => { + Ok(GeneratedField::AuthnInfoProviderMethodFullname) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SigningModeDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.SigningModeDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut number__ = None; + let mut authn_info_provider_method_fullname__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Number => { + if number__.is_some() { + return Err(serde::de::Error::duplicate_field("number")); + } + number__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::AuthnInfoProviderMethodFullname => { + if authn_info_provider_method_fullname__.is_some() { + return Err(serde::de::Error::duplicate_field( + "authnInfoProviderMethodFullname", + )); + } + authn_info_provider_method_fullname__ = Some(map_.next_value()?); + } + } + } + Ok(SigningModeDescriptor { + name: name__.unwrap_or_default(), + number: number__.unwrap_or_default(), + authn_info_provider_method_fullname: authn_info_provider_method_fullname__ + .unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.SigningModeDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TxDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fullname.is_empty() { + len += 1; + } + if !self.msgs.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.reflection.v2alpha1.TxDescriptor", len)?; + if !self.fullname.is_empty() { + struct_ser.serialize_field("fullname", &self.fullname)?; + } + if !self.msgs.is_empty() { + struct_ser.serialize_field("msgs", &self.msgs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TxDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fullname", "msgs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fullname, + Msgs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fullname" => Ok(GeneratedField::Fullname), + "msgs" => Ok(GeneratedField::Msgs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TxDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.reflection.v2alpha1.TxDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fullname__ = None; + let mut msgs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fullname => { + if fullname__.is_some() { + return Err(serde::de::Error::duplicate_field("fullname")); + } + fullname__ = Some(map_.next_value()?); + } + GeneratedField::Msgs => { + if msgs__.is_some() { + return Err(serde::de::Error::duplicate_field("msgs")); + } + msgs__ = Some(map_.next_value()?); + } + } + } + Ok(TxDescriptor { + fullname: fullname__.unwrap_or_default(), + msgs: msgs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.reflection.v2alpha1.TxDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.rs index 50faee3c..a606bad5 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.rs @@ -118,4 +118,5 @@ pub struct SnapshotSchema { #[prost(bytes = "vec", repeated, tag = "1")] pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } +include!("cosmos.base.snapshots.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.serde.rs new file mode 100644 index 00000000..faddc89d --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.snapshots.v1beta1.serde.rs @@ -0,0 +1,1212 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Metadata { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.chunk_hashes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.Metadata", len)?; + if !self.chunk_hashes.is_empty() { + struct_ser.serialize_field( + "chunkHashes", + &self + .chunk_hashes + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Metadata { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["chunk_hashes", "chunkHashes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ChunkHashes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "chunkHashes" | "chunk_hashes" => Ok(GeneratedField::ChunkHashes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Metadata; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.Metadata") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut chunk_hashes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ChunkHashes => { + if chunk_hashes__.is_some() { + return Err(serde::de::Error::duplicate_field("chunkHashes")); + } + chunk_hashes__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(Metadata { + chunk_hashes: chunk_hashes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.Metadata", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Snapshot { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + if self.format != 0 { + len += 1; + } + if self.chunks != 0 { + len += 1; + } + if !self.hash.is_empty() { + len += 1; + } + if self.metadata.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.Snapshot", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if self.format != 0 { + struct_ser.serialize_field("format", &self.format)?; + } + if self.chunks != 0 { + struct_ser.serialize_field("chunks", &self.chunks)?; + } + if !self.hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("hash", pbjson::private::base64::encode(&self.hash).as_str())?; + } + if let Some(v) = self.metadata.as_ref() { + struct_ser.serialize_field("metadata", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Snapshot { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height", "format", "chunks", "hash", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + Format, + Chunks, + Hash, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + "format" => Ok(GeneratedField::Format), + "chunks" => Ok(GeneratedField::Chunks), + "hash" => Ok(GeneratedField::Hash), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Snapshot; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.Snapshot") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + let mut format__ = None; + let mut chunks__ = None; + let mut hash__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Format => { + if format__.is_some() { + return Err(serde::de::Error::duplicate_field("format")); + } + format__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Chunks => { + if chunks__.is_some() { + return Err(serde::de::Error::duplicate_field("chunks")); + } + chunks__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = map_.next_value()?; + } + } + } + Ok(Snapshot { + height: height__.unwrap_or_default(), + format: format__.unwrap_or_default(), + chunks: chunks__.unwrap_or_default(), + hash: hash__.unwrap_or_default(), + metadata: metadata__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.Snapshot", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotExtensionMeta { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.format != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if self.format != 0 { + struct_ser.serialize_field("format", &self.format)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotExtensionMeta { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "format"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Format, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "format" => Ok(GeneratedField::Format), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotExtensionMeta; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut format__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Format => { + if format__.is_some() { + return Err(serde::de::Error::duplicate_field("format")); + } + format__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SnapshotExtensionMeta { + name: name__.unwrap_or_default(), + format: format__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotExtensionPayload { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.payload.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", + len, + )?; + if !self.payload.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "payload", + pbjson::private::base64::encode(&self.payload).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotExtensionPayload { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["payload"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Payload, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "payload" => Ok(GeneratedField::Payload), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotExtensionPayload; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut payload__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Payload => { + if payload__.is_some() { + return Err(serde::de::Error::duplicate_field("payload")); + } + payload__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SnapshotExtensionPayload { + payload: payload__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotIavlItem { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + if self.version != 0 { + len += 1; + } + if self.height != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + if self.height != 0 { + struct_ser.serialize_field("height", &self.height)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotIavlItem { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key", "value", "version", "height"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Value, + Version, + Height, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + "version" => Ok(GeneratedField::Version), + "height" => Ok(GeneratedField::Height), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotIavlItem; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotIAVLItem") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut value__ = None; + let mut version__ = None; + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SnapshotIavlItem { + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + version: version__.unwrap_or_default(), + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotItem { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.item.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotItem", len)?; + if let Some(v) = self.item.as_ref() { + match v { + snapshot_item::Item::Store(v) => { + struct_ser.serialize_field("store", v)?; + } + snapshot_item::Item::Iavl(v) => { + struct_ser.serialize_field("iavl", v)?; + } + snapshot_item::Item::Extension(v) => { + struct_ser.serialize_field("extension", v)?; + } + snapshot_item::Item::ExtensionPayload(v) => { + struct_ser.serialize_field("extensionPayload", v)?; + } + snapshot_item::Item::Kv(v) => { + struct_ser.serialize_field("kv", v)?; + } + snapshot_item::Item::Schema(v) => { + struct_ser.serialize_field("schema", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotItem { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "store", + "iavl", + "extension", + "extension_payload", + "extensionPayload", + "kv", + "schema", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Store, + Iavl, + Extension, + ExtensionPayload, + Kv, + Schema, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "store" => Ok(GeneratedField::Store), + "iavl" => Ok(GeneratedField::Iavl), + "extension" => Ok(GeneratedField::Extension), + "extensionPayload" | "extension_payload" => { + Ok(GeneratedField::ExtensionPayload) + } + "kv" => Ok(GeneratedField::Kv), + "schema" => Ok(GeneratedField::Schema), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotItem; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotItem") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut item__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Store => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("store")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::Store); + } + GeneratedField::Iavl => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("iavl")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::Iavl); + } + GeneratedField::Extension => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("extension")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::Extension); + } + GeneratedField::ExtensionPayload => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("extensionPayload")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::ExtensionPayload); + } + GeneratedField::Kv => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("kv")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::Kv); + } + GeneratedField::Schema => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("schema")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(snapshot_item::Item::Schema); + } + } + } + Ok(SnapshotItem { item: item__ }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotItem", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotKvItem { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotKVItem", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotKvItem { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotKvItem; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotKVItem") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SnapshotKvItem { + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotKVItem", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotSchema { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.keys.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotSchema", len)?; + if !self.keys.is_empty() { + struct_ser.serialize_field( + "keys", + &self + .keys + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotSchema { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["keys"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Keys, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "keys" => Ok(GeneratedField::Keys), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotSchema; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotSchema") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut keys__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Keys => { + if keys__.is_some() { + return Err(serde::de::Error::duplicate_field("keys")); + } + keys__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(SnapshotSchema { + keys: keys__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotSchema", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SnapshotStoreItem { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.snapshots.v1beta1.SnapshotStoreItem", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SnapshotStoreItem { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SnapshotStoreItem; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.snapshots.v1beta1.SnapshotStoreItem") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + } + } + Ok(SnapshotStoreItem { + name: name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.snapshots.v1beta1.SnapshotStoreItem", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.rs index d2983ea0..7c93c011 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.rs @@ -81,4 +81,5 @@ pub mod block_metadata { pub response: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseDeliverTx>, } } +include!("cosmos.base.store.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.serde.rs new file mode 100644 index 00000000..f78ee6b3 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.serde.rs @@ -0,0 +1,846 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for BlockMetadata { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.request_begin_block.is_some() { + len += 1; + } + if self.response_begin_block.is_some() { + len += 1; + } + if !self.deliver_txs.is_empty() { + len += 1; + } + if self.request_end_block.is_some() { + len += 1; + } + if self.response_end_block.is_some() { + len += 1; + } + if self.response_commit.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.store.v1beta1.BlockMetadata", len)?; + if let Some(v) = self.request_begin_block.as_ref() { + struct_ser.serialize_field("requestBeginBlock", v)?; + } + if let Some(v) = self.response_begin_block.as_ref() { + struct_ser.serialize_field("responseBeginBlock", v)?; + } + if !self.deliver_txs.is_empty() { + struct_ser.serialize_field("deliverTxs", &self.deliver_txs)?; + } + if let Some(v) = self.request_end_block.as_ref() { + struct_ser.serialize_field("requestEndBlock", v)?; + } + if let Some(v) = self.response_end_block.as_ref() { + struct_ser.serialize_field("responseEndBlock", v)?; + } + if let Some(v) = self.response_commit.as_ref() { + struct_ser.serialize_field("responseCommit", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BlockMetadata { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "request_begin_block", + "requestBeginBlock", + "response_begin_block", + "responseBeginBlock", + "deliver_txs", + "deliverTxs", + "request_end_block", + "requestEndBlock", + "response_end_block", + "responseEndBlock", + "response_commit", + "responseCommit", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + RequestBeginBlock, + ResponseBeginBlock, + DeliverTxs, + RequestEndBlock, + ResponseEndBlock, + ResponseCommit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "requestBeginBlock" | "request_begin_block" => { + Ok(GeneratedField::RequestBeginBlock) + } + "responseBeginBlock" | "response_begin_block" => { + Ok(GeneratedField::ResponseBeginBlock) + } + "deliverTxs" | "deliver_txs" => Ok(GeneratedField::DeliverTxs), + "requestEndBlock" | "request_end_block" => { + Ok(GeneratedField::RequestEndBlock) + } + "responseEndBlock" | "response_end_block" => { + Ok(GeneratedField::ResponseEndBlock) + } + "responseCommit" | "response_commit" => { + Ok(GeneratedField::ResponseCommit) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BlockMetadata; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.BlockMetadata") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut request_begin_block__ = None; + let mut response_begin_block__ = None; + let mut deliver_txs__ = None; + let mut request_end_block__ = None; + let mut response_end_block__ = None; + let mut response_commit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::RequestBeginBlock => { + if request_begin_block__.is_some() { + return Err(serde::de::Error::duplicate_field("requestBeginBlock")); + } + request_begin_block__ = map_.next_value()?; + } + GeneratedField::ResponseBeginBlock => { + if response_begin_block__.is_some() { + return Err(serde::de::Error::duplicate_field( + "responseBeginBlock", + )); + } + response_begin_block__ = map_.next_value()?; + } + GeneratedField::DeliverTxs => { + if deliver_txs__.is_some() { + return Err(serde::de::Error::duplicate_field("deliverTxs")); + } + deliver_txs__ = Some(map_.next_value()?); + } + GeneratedField::RequestEndBlock => { + if request_end_block__.is_some() { + return Err(serde::de::Error::duplicate_field("requestEndBlock")); + } + request_end_block__ = map_.next_value()?; + } + GeneratedField::ResponseEndBlock => { + if response_end_block__.is_some() { + return Err(serde::de::Error::duplicate_field("responseEndBlock")); + } + response_end_block__ = map_.next_value()?; + } + GeneratedField::ResponseCommit => { + if response_commit__.is_some() { + return Err(serde::de::Error::duplicate_field("responseCommit")); + } + response_commit__ = map_.next_value()?; + } + } + } + Ok(BlockMetadata { + request_begin_block: request_begin_block__, + response_begin_block: response_begin_block__, + deliver_txs: deliver_txs__.unwrap_or_default(), + request_end_block: request_end_block__, + response_end_block: response_end_block__, + response_commit: response_commit__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.BlockMetadata", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for block_metadata::DeliverTx { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.request.is_some() { + len += 1; + } + if self.response.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.store.v1beta1.BlockMetadata.DeliverTx", len)?; + if let Some(v) = self.request.as_ref() { + struct_ser.serialize_field("request", v)?; + } + if let Some(v) = self.response.as_ref() { + struct_ser.serialize_field("response", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for block_metadata::DeliverTx { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["request", "response"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Request, + Response, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "request" => Ok(GeneratedField::Request), + "response" => Ok(GeneratedField::Response), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = block_metadata::DeliverTx; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.BlockMetadata.DeliverTx") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut request__ = None; + let mut response__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Request => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("request")); + } + request__ = map_.next_value()?; + } + GeneratedField::Response => { + if response__.is_some() { + return Err(serde::de::Error::duplicate_field("response")); + } + response__ = map_.next_value()?; + } + } + } + Ok(block_metadata::DeliverTx { + request: request__, + response: response__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.BlockMetadata.DeliverTx", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CommitId { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.version != 0 { + len += 1; + } + if !self.hash.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.store.v1beta1.CommitID", len)?; + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + if !self.hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("hash", pbjson::private::base64::encode(&self.hash).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CommitId { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["version", "hash"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Version, + Hash, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "version" => Ok(GeneratedField::Version), + "hash" => Ok(GeneratedField::Hash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CommitId; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.CommitID") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut version__ = None; + let mut hash__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(CommitId { + version: version__.unwrap_or_default(), + hash: hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.CommitID", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CommitInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.version != 0 { + len += 1; + } + if !self.store_infos.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.store.v1beta1.CommitInfo", len)?; + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + if !self.store_infos.is_empty() { + struct_ser.serialize_field("storeInfos", &self.store_infos)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CommitInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["version", "store_infos", "storeInfos"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Version, + StoreInfos, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "version" => Ok(GeneratedField::Version), + "storeInfos" | "store_infos" => Ok(GeneratedField::StoreInfos), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CommitInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.CommitInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut version__ = None; + let mut store_infos__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::StoreInfos => { + if store_infos__.is_some() { + return Err(serde::de::Error::duplicate_field("storeInfos")); + } + store_infos__ = Some(map_.next_value()?); + } + } + } + Ok(CommitInfo { + version: version__.unwrap_or_default(), + store_infos: store_infos__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.CommitInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StoreInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.commit_id.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.store.v1beta1.StoreInfo", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if let Some(v) = self.commit_id.as_ref() { + struct_ser.serialize_field("commitId", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StoreInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "commit_id", "commitId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + CommitId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "commitId" | "commit_id" => Ok(GeneratedField::CommitId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StoreInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.StoreInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut commit_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::CommitId => { + if commit_id__.is_some() { + return Err(serde::de::Error::duplicate_field("commitId")); + } + commit_id__ = map_.next_value()?; + } + } + } + Ok(StoreInfo { + name: name__.unwrap_or_default(), + commit_id: commit_id__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.StoreInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StoreKvPair { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.store_key.is_empty() { + len += 1; + } + if self.delete { + len += 1; + } + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.store.v1beta1.StoreKVPair", len)?; + if !self.store_key.is_empty() { + struct_ser.serialize_field("storeKey", &self.store_key)?; + } + if self.delete { + struct_ser.serialize_field("delete", &self.delete)?; + } + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StoreKvPair { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["store_key", "storeKey", "delete", "key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StoreKey, + Delete, + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "storeKey" | "store_key" => Ok(GeneratedField::StoreKey), + "delete" => Ok(GeneratedField::Delete), + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StoreKvPair; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.store.v1beta1.StoreKVPair") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut store_key__ = None; + let mut delete__ = None; + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StoreKey => { + if store_key__.is_some() { + return Err(serde::de::Error::duplicate_field("storeKey")); + } + store_key__ = Some(map_.next_value()?); + } + GeneratedField::Delete => { + if delete__.is_some() { + return Err(serde::de::Error::duplicate_field("delete")); + } + delete__ = Some(map_.next_value()?); + } + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(StoreKvPair { + store_key: store_key__.unwrap_or_default(), + delete: delete__.unwrap_or_default(), + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.store.v1beta1.StoreKVPair", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs index 0f547622..1b89ca89 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs @@ -296,5 +296,6 @@ pub struct ProofOps { #[prost(message, repeated, tag = "1")] pub ops: ::prost::alloc::vec::Vec, } +include!("cosmos.base.tendermint.v1beta1.serde.rs"); include!("cosmos.base.tendermint.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.serde.rs new file mode 100644 index 00000000..4cb92e47 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.serde.rs @@ -0,0 +1,3123 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AbciQueryRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + if !self.path.is_empty() { + len += 1; + } + if self.height != 0 { + len += 1; + } + if self.prove { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.ABCIQueryRequest", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + if !self.path.is_empty() { + struct_ser.serialize_field("path", &self.path)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if self.prove { + struct_ser.serialize_field("prove", &self.prove)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AbciQueryRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data", "path", "height", "prove"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + Path, + Height, + Prove, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + "path" => Ok(GeneratedField::Path), + "height" => Ok(GeneratedField::Height), + "prove" => Ok(GeneratedField::Prove), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AbciQueryRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.ABCIQueryRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + let mut path__ = None; + let mut height__ = None; + let mut prove__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Path => { + if path__.is_some() { + return Err(serde::de::Error::duplicate_field("path")); + } + path__ = Some(map_.next_value()?); + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Prove => { + if prove__.is_some() { + return Err(serde::de::Error::duplicate_field("prove")); + } + prove__ = Some(map_.next_value()?); + } + } + } + Ok(AbciQueryRequest { + data: data__.unwrap_or_default(), + path: path__.unwrap_or_default(), + height: height__.unwrap_or_default(), + prove: prove__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.ABCIQueryRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AbciQueryResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code != 0 { + len += 1; + } + if !self.log.is_empty() { + len += 1; + } + if !self.info.is_empty() { + len += 1; + } + if self.index != 0 { + len += 1; + } + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + if self.proof_ops.is_some() { + len += 1; + } + if self.height != 0 { + len += 1; + } + if !self.codespace.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.ABCIQueryResponse", len)?; + if self.code != 0 { + struct_ser.serialize_field("code", &self.code)?; + } + if !self.log.is_empty() { + struct_ser.serialize_field("log", &self.log)?; + } + if !self.info.is_empty() { + struct_ser.serialize_field("info", &self.info)?; + } + if self.index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("index", ToString::to_string(&self.index).as_str())?; + } + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + if let Some(v) = self.proof_ops.as_ref() { + struct_ser.serialize_field("proofOps", v)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if !self.codespace.is_empty() { + struct_ser.serialize_field("codespace", &self.codespace)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AbciQueryResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code", + "log", + "info", + "index", + "key", + "value", + "proof_ops", + "proofOps", + "height", + "codespace", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Code, + Log, + Info, + Index, + Key, + Value, + ProofOps, + Height, + Codespace, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "code" => Ok(GeneratedField::Code), + "log" => Ok(GeneratedField::Log), + "info" => Ok(GeneratedField::Info), + "index" => Ok(GeneratedField::Index), + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + "proofOps" | "proof_ops" => Ok(GeneratedField::ProofOps), + "height" => Ok(GeneratedField::Height), + "codespace" => Ok(GeneratedField::Codespace), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AbciQueryResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.ABCIQueryResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code__ = None; + let mut log__ = None; + let mut info__ = None; + let mut index__ = None; + let mut key__ = None; + let mut value__ = None; + let mut proof_ops__ = None; + let mut height__ = None; + let mut codespace__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Code => { + if code__.is_some() { + return Err(serde::de::Error::duplicate_field("code")); + } + code__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Log => { + if log__.is_some() { + return Err(serde::de::Error::duplicate_field("log")); + } + log__ = Some(map_.next_value()?); + } + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = Some(map_.next_value()?); + } + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::ProofOps => { + if proof_ops__.is_some() { + return Err(serde::de::Error::duplicate_field("proofOps")); + } + proof_ops__ = map_.next_value()?; + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Codespace => { + if codespace__.is_some() { + return Err(serde::de::Error::duplicate_field("codespace")); + } + codespace__ = Some(map_.next_value()?); + } + } + } + Ok(AbciQueryResponse { + code: code__.unwrap_or_default(), + log: log__.unwrap_or_default(), + info: info__.unwrap_or_default(), + index: index__.unwrap_or_default(), + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + proof_ops: proof_ops__, + height: height__.unwrap_or_default(), + codespace: codespace__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.ABCIQueryResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Block { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.header.is_some() { + len += 1; + } + if self.data.is_some() { + len += 1; + } + if self.evidence.is_some() { + len += 1; + } + if self.last_commit.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.Block", len)?; + if let Some(v) = self.header.as_ref() { + struct_ser.serialize_field("header", v)?; + } + if let Some(v) = self.data.as_ref() { + struct_ser.serialize_field("data", v)?; + } + if let Some(v) = self.evidence.as_ref() { + struct_ser.serialize_field("evidence", v)?; + } + if let Some(v) = self.last_commit.as_ref() { + struct_ser.serialize_field("lastCommit", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Block { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["header", "data", "evidence", "last_commit", "lastCommit"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Header, + Data, + Evidence, + LastCommit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "header" => Ok(GeneratedField::Header), + "data" => Ok(GeneratedField::Data), + "evidence" => Ok(GeneratedField::Evidence), + "lastCommit" | "last_commit" => Ok(GeneratedField::LastCommit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Block; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.Block") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut header__ = None; + let mut data__ = None; + let mut evidence__ = None; + let mut last_commit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Header => { + if header__.is_some() { + return Err(serde::de::Error::duplicate_field("header")); + } + header__ = map_.next_value()?; + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = map_.next_value()?; + } + GeneratedField::Evidence => { + if evidence__.is_some() { + return Err(serde::de::Error::duplicate_field("evidence")); + } + evidence__ = map_.next_value()?; + } + GeneratedField::LastCommit => { + if last_commit__.is_some() { + return Err(serde::de::Error::duplicate_field("lastCommit")); + } + last_commit__ = map_.next_value()?; + } + } + } + Ok(Block { + header: header__, + data: data__, + evidence: evidence__, + last_commit: last_commit__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.Block", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetBlockByHeightRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", + len, + )?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetBlockByHeightRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetBlockByHeightRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(GetBlockByHeightRequest { + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetBlockByHeightResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.block_id.is_some() { + len += 1; + } + if self.block.is_some() { + len += 1; + } + if self.sdk_block.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", + len, + )?; + if let Some(v) = self.block_id.as_ref() { + struct_ser.serialize_field("blockId", v)?; + } + if let Some(v) = self.block.as_ref() { + struct_ser.serialize_field("block", v)?; + } + if let Some(v) = self.sdk_block.as_ref() { + struct_ser.serialize_field("sdkBlock", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetBlockByHeightResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["block_id", "blockId", "block", "sdk_block", "sdkBlock"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BlockId, + Block, + SdkBlock, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "blockId" | "block_id" => Ok(GeneratedField::BlockId), + "block" => Ok(GeneratedField::Block), + "sdkBlock" | "sdk_block" => Ok(GeneratedField::SdkBlock), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetBlockByHeightResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut block_id__ = None; + let mut block__ = None; + let mut sdk_block__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BlockId => { + if block_id__.is_some() { + return Err(serde::de::Error::duplicate_field("blockId")); + } + block_id__ = map_.next_value()?; + } + GeneratedField::Block => { + if block__.is_some() { + return Err(serde::de::Error::duplicate_field("block")); + } + block__ = map_.next_value()?; + } + GeneratedField::SdkBlock => { + if sdk_block__.is_some() { + return Err(serde::de::Error::duplicate_field("sdkBlock")); + } + sdk_block__ = map_.next_value()?; + } + } + } + Ok(GetBlockByHeightResponse { + block_id: block_id__, + block: block__, + sdk_block: sdk_block__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetLatestBlockRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetLatestBlockRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetLatestBlockRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetLatestBlockRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetLatestBlockRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestBlockRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetLatestBlockResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.block_id.is_some() { + len += 1; + } + if self.block.is_some() { + len += 1; + } + if self.sdk_block.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", len)?; + if let Some(v) = self.block_id.as_ref() { + struct_ser.serialize_field("blockId", v)?; + } + if let Some(v) = self.block.as_ref() { + struct_ser.serialize_field("block", v)?; + } + if let Some(v) = self.sdk_block.as_ref() { + struct_ser.serialize_field("sdkBlock", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetLatestBlockResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["block_id", "blockId", "block", "sdk_block", "sdkBlock"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BlockId, + Block, + SdkBlock, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "blockId" | "block_id" => Ok(GeneratedField::BlockId), + "block" => Ok(GeneratedField::Block), + "sdkBlock" | "sdk_block" => Ok(GeneratedField::SdkBlock), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetLatestBlockResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetLatestBlockResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut block_id__ = None; + let mut block__ = None; + let mut sdk_block__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BlockId => { + if block_id__.is_some() { + return Err(serde::de::Error::duplicate_field("blockId")); + } + block_id__ = map_.next_value()?; + } + GeneratedField::Block => { + if block__.is_some() { + return Err(serde::de::Error::duplicate_field("block")); + } + block__ = map_.next_value()?; + } + GeneratedField::SdkBlock => { + if sdk_block__.is_some() { + return Err(serde::de::Error::duplicate_field("sdkBlock")); + } + sdk_block__ = map_.next_value()?; + } + } + } + Ok(GetLatestBlockResponse { + block_id: block_id__, + block: block__, + sdk_block: sdk_block__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestBlockResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetLatestValidatorSetRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", + len, + )?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetLatestValidatorSetRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetLatestValidatorSetRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetLatestValidatorSetRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetLatestValidatorSetResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.block_height != 0 { + len += 1; + } + if !self.validators.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", + len, + )?; + if self.block_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "blockHeight", + ToString::to_string(&self.block_height).as_str(), + )?; + } + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetLatestValidatorSetResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["block_height", "blockHeight", "validators", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BlockHeight, + Validators, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "blockHeight" | "block_height" => Ok(GeneratedField::BlockHeight), + "validators" => Ok(GeneratedField::Validators), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetLatestValidatorSetResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut block_height__ = None; + let mut validators__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BlockHeight => { + if block_height__.is_some() { + return Err(serde::de::Error::duplicate_field("blockHeight")); + } + block_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetLatestValidatorSetResponse { + block_height: block_height__.unwrap_or_default(), + validators: validators__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetNodeInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetNodeInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetNodeInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetNodeInfoRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetNodeInfoRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetNodeInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.default_node_info.is_some() { + len += 1; + } + if self.application_version.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", len)?; + if let Some(v) = self.default_node_info.as_ref() { + struct_ser.serialize_field("defaultNodeInfo", v)?; + } + if let Some(v) = self.application_version.as_ref() { + struct_ser.serialize_field("applicationVersion", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetNodeInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "default_node_info", + "defaultNodeInfo", + "application_version", + "applicationVersion", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DefaultNodeInfo, + ApplicationVersion, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "defaultNodeInfo" | "default_node_info" => { + Ok(GeneratedField::DefaultNodeInfo) + } + "applicationVersion" | "application_version" => { + Ok(GeneratedField::ApplicationVersion) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetNodeInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetNodeInfoResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut default_node_info__ = None; + let mut application_version__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DefaultNodeInfo => { + if default_node_info__.is_some() { + return Err(serde::de::Error::duplicate_field("defaultNodeInfo")); + } + default_node_info__ = map_.next_value()?; + } + GeneratedField::ApplicationVersion => { + if application_version__.is_some() { + return Err(serde::de::Error::duplicate_field( + "applicationVersion", + )); + } + application_version__ = map_.next_value()?; + } + } + } + Ok(GetNodeInfoResponse { + default_node_info: default_node_info__, + application_version: application_version__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetNodeInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetSyncingRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.GetSyncingRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetSyncingRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetSyncingRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetSyncingRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(GetSyncingRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetSyncingRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetSyncingResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.syncing { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.base.tendermint.v1beta1.GetSyncingResponse", len)?; + if self.syncing { + struct_ser.serialize_field("syncing", &self.syncing)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetSyncingResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["syncing"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Syncing, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "syncing" => Ok(GeneratedField::Syncing), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetSyncingResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.GetSyncingResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut syncing__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Syncing => { + if syncing__.is_some() { + return Err(serde::de::Error::duplicate_field("syncing")); + } + syncing__ = Some(map_.next_value()?); + } + } + } + Ok(GetSyncingResponse { + syncing: syncing__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetSyncingResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetValidatorSetByHeightRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", + len, + )?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetValidatorSetByHeightRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetValidatorSetByHeightRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetValidatorSetByHeightRequest { + height: height__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetValidatorSetByHeightResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.block_height != 0 { + len += 1; + } + if !self.validators.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", + len, + )?; + if self.block_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "blockHeight", + ToString::to_string(&self.block_height).as_str(), + )?; + } + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetValidatorSetByHeightResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["block_height", "blockHeight", "validators", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BlockHeight, + Validators, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "blockHeight" | "block_height" => Ok(GeneratedField::BlockHeight), + "validators" => Ok(GeneratedField::Validators), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetValidatorSetByHeightResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut block_height__ = None; + let mut validators__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BlockHeight => { + if block_height__.is_some() { + return Err(serde::de::Error::duplicate_field("blockHeight")); + } + block_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetValidatorSetByHeightResponse { + block_height: block_height__.unwrap_or_default(), + validators: validators__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Header { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.version.is_some() { + len += 1; + } + if !self.chain_id.is_empty() { + len += 1; + } + if self.height != 0 { + len += 1; + } + if self.time.is_some() { + len += 1; + } + if self.last_block_id.is_some() { + len += 1; + } + if !self.last_commit_hash.is_empty() { + len += 1; + } + if !self.data_hash.is_empty() { + len += 1; + } + if !self.validators_hash.is_empty() { + len += 1; + } + if !self.next_validators_hash.is_empty() { + len += 1; + } + if !self.consensus_hash.is_empty() { + len += 1; + } + if !self.app_hash.is_empty() { + len += 1; + } + if !self.last_results_hash.is_empty() { + len += 1; + } + if !self.evidence_hash.is_empty() { + len += 1; + } + if !self.proposer_address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.Header", len)?; + if let Some(v) = self.version.as_ref() { + struct_ser.serialize_field("version", v)?; + } + if !self.chain_id.is_empty() { + struct_ser.serialize_field("chainId", &self.chain_id)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if let Some(v) = self.time.as_ref() { + struct_ser.serialize_field("time", v)?; + } + if let Some(v) = self.last_block_id.as_ref() { + struct_ser.serialize_field("lastBlockId", v)?; + } + if !self.last_commit_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "lastCommitHash", + pbjson::private::base64::encode(&self.last_commit_hash).as_str(), + )?; + } + if !self.data_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "dataHash", + pbjson::private::base64::encode(&self.data_hash).as_str(), + )?; + } + if !self.validators_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "validatorsHash", + pbjson::private::base64::encode(&self.validators_hash).as_str(), + )?; + } + if !self.next_validators_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "nextValidatorsHash", + pbjson::private::base64::encode(&self.next_validators_hash).as_str(), + )?; + } + if !self.consensus_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "consensusHash", + pbjson::private::base64::encode(&self.consensus_hash).as_str(), + )?; + } + if !self.app_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "appHash", + pbjson::private::base64::encode(&self.app_hash).as_str(), + )?; + } + if !self.last_results_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "lastResultsHash", + pbjson::private::base64::encode(&self.last_results_hash).as_str(), + )?; + } + if !self.evidence_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "evidenceHash", + pbjson::private::base64::encode(&self.evidence_hash).as_str(), + )?; + } + if !self.proposer_address.is_empty() { + struct_ser.serialize_field("proposerAddress", &self.proposer_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Header { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "version", + "chain_id", + "chainId", + "height", + "time", + "last_block_id", + "lastBlockId", + "last_commit_hash", + "lastCommitHash", + "data_hash", + "dataHash", + "validators_hash", + "validatorsHash", + "next_validators_hash", + "nextValidatorsHash", + "consensus_hash", + "consensusHash", + "app_hash", + "appHash", + "last_results_hash", + "lastResultsHash", + "evidence_hash", + "evidenceHash", + "proposer_address", + "proposerAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Version, + ChainId, + Height, + Time, + LastBlockId, + LastCommitHash, + DataHash, + ValidatorsHash, + NextValidatorsHash, + ConsensusHash, + AppHash, + LastResultsHash, + EvidenceHash, + ProposerAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "version" => Ok(GeneratedField::Version), + "chainId" | "chain_id" => Ok(GeneratedField::ChainId), + "height" => Ok(GeneratedField::Height), + "time" => Ok(GeneratedField::Time), + "lastBlockId" | "last_block_id" => Ok(GeneratedField::LastBlockId), + "lastCommitHash" | "last_commit_hash" => { + Ok(GeneratedField::LastCommitHash) + } + "dataHash" | "data_hash" => Ok(GeneratedField::DataHash), + "validatorsHash" | "validators_hash" => { + Ok(GeneratedField::ValidatorsHash) + } + "nextValidatorsHash" | "next_validators_hash" => { + Ok(GeneratedField::NextValidatorsHash) + } + "consensusHash" | "consensus_hash" => Ok(GeneratedField::ConsensusHash), + "appHash" | "app_hash" => Ok(GeneratedField::AppHash), + "lastResultsHash" | "last_results_hash" => { + Ok(GeneratedField::LastResultsHash) + } + "evidenceHash" | "evidence_hash" => Ok(GeneratedField::EvidenceHash), + "proposerAddress" | "proposer_address" => { + Ok(GeneratedField::ProposerAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Header; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.Header") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut version__ = None; + let mut chain_id__ = None; + let mut height__ = None; + let mut time__ = None; + let mut last_block_id__ = None; + let mut last_commit_hash__ = None; + let mut data_hash__ = None; + let mut validators_hash__ = None; + let mut next_validators_hash__ = None; + let mut consensus_hash__ = None; + let mut app_hash__ = None; + let mut last_results_hash__ = None; + let mut evidence_hash__ = None; + let mut proposer_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = map_.next_value()?; + } + GeneratedField::ChainId => { + if chain_id__.is_some() { + return Err(serde::de::Error::duplicate_field("chainId")); + } + chain_id__ = Some(map_.next_value()?); + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Time => { + if time__.is_some() { + return Err(serde::de::Error::duplicate_field("time")); + } + time__ = map_.next_value()?; + } + GeneratedField::LastBlockId => { + if last_block_id__.is_some() { + return Err(serde::de::Error::duplicate_field("lastBlockId")); + } + last_block_id__ = map_.next_value()?; + } + GeneratedField::LastCommitHash => { + if last_commit_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("lastCommitHash")); + } + last_commit_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::DataHash => { + if data_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("dataHash")); + } + data_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::ValidatorsHash => { + if validators_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorsHash")); + } + validators_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::NextValidatorsHash => { + if next_validators_hash__.is_some() { + return Err(serde::de::Error::duplicate_field( + "nextValidatorsHash", + )); + } + next_validators_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::ConsensusHash => { + if consensus_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("consensusHash")); + } + consensus_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::AppHash => { + if app_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("appHash")); + } + app_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::LastResultsHash => { + if last_results_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("lastResultsHash")); + } + last_results_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::EvidenceHash => { + if evidence_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("evidenceHash")); + } + evidence_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::ProposerAddress => { + if proposer_address__.is_some() { + return Err(serde::de::Error::duplicate_field("proposerAddress")); + } + proposer_address__ = Some(map_.next_value()?); + } + } + } + Ok(Header { + version: version__, + chain_id: chain_id__.unwrap_or_default(), + height: height__.unwrap_or_default(), + time: time__, + last_block_id: last_block_id__, + last_commit_hash: last_commit_hash__.unwrap_or_default(), + data_hash: data_hash__.unwrap_or_default(), + validators_hash: validators_hash__.unwrap_or_default(), + next_validators_hash: next_validators_hash__.unwrap_or_default(), + consensus_hash: consensus_hash__.unwrap_or_default(), + app_hash: app_hash__.unwrap_or_default(), + last_results_hash: last_results_hash__.unwrap_or_default(), + evidence_hash: evidence_hash__.unwrap_or_default(), + proposer_address: proposer_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.Header", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Module { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.path.is_empty() { + len += 1; + } + if !self.version.is_empty() { + len += 1; + } + if !self.sum.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.Module", len)?; + if !self.path.is_empty() { + struct_ser.serialize_field("path", &self.path)?; + } + if !self.version.is_empty() { + struct_ser.serialize_field("version", &self.version)?; + } + if !self.sum.is_empty() { + struct_ser.serialize_field("sum", &self.sum)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Module { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["path", "version", "sum"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Path, + Version, + Sum, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "path" => Ok(GeneratedField::Path), + "version" => Ok(GeneratedField::Version), + "sum" => Ok(GeneratedField::Sum), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Module; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.Module") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut path__ = None; + let mut version__ = None; + let mut sum__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Path => { + if path__.is_some() { + return Err(serde::de::Error::duplicate_field("path")); + } + path__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some(map_.next_value()?); + } + GeneratedField::Sum => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("sum")); + } + sum__ = Some(map_.next_value()?); + } + } + } + Ok(Module { + path: path__.unwrap_or_default(), + version: version__.unwrap_or_default(), + sum: sum__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.Module", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProofOp { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.r#type.is_empty() { + len += 1; + } + if !self.key.is_empty() { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.ProofOp", len)?; + if !self.r#type.is_empty() { + struct_ser.serialize_field("type", &self.r#type)?; + } + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProofOp { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["type", "key", "data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Type, + Key, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "type" => Ok(GeneratedField::Type), + "key" => Ok(GeneratedField::Key), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProofOp; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.ProofOp") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut r#type__ = None; + let mut key__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Type => { + if r#type__.is_some() { + return Err(serde::de::Error::duplicate_field("type")); + } + r#type__ = Some(map_.next_value()?); + } + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ProofOp { + r#type: r#type__.unwrap_or_default(), + key: key__.unwrap_or_default(), + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.ProofOp", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProofOps { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.ops.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.ProofOps", len)?; + if !self.ops.is_empty() { + struct_ser.serialize_field("ops", &self.ops)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProofOps { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["ops"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Ops, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "ops" => Ok(GeneratedField::Ops), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProofOps; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.ProofOps") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut ops__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Ops => { + if ops__.is_some() { + return Err(serde::de::Error::duplicate_field("ops")); + } + ops__ = Some(map_.next_value()?); + } + } + } + Ok(ProofOps { + ops: ops__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.ProofOps", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Validator { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pub_key.is_some() { + len += 1; + } + if self.voting_power != 0 { + len += 1; + } + if self.proposer_priority != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.Validator", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pub_key.as_ref() { + struct_ser.serialize_field("pubKey", v)?; + } + if self.voting_power != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "votingPower", + ToString::to_string(&self.voting_power).as_str(), + )?; + } + if self.proposer_priority != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposerPriority", + ToString::to_string(&self.proposer_priority).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Validator { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "address", + "pub_key", + "pubKey", + "voting_power", + "votingPower", + "proposer_priority", + "proposerPriority", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + PubKey, + VotingPower, + ProposerPriority, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pubKey" | "pub_key" => Ok(GeneratedField::PubKey), + "votingPower" | "voting_power" => Ok(GeneratedField::VotingPower), + "proposerPriority" | "proposer_priority" => { + Ok(GeneratedField::ProposerPriority) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Validator; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.Validator") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pub_key__ = None; + let mut voting_power__ = None; + let mut proposer_priority__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::PubKey => { + if pub_key__.is_some() { + return Err(serde::de::Error::duplicate_field("pubKey")); + } + pub_key__ = map_.next_value()?; + } + GeneratedField::VotingPower => { + if voting_power__.is_some() { + return Err(serde::de::Error::duplicate_field("votingPower")); + } + voting_power__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::ProposerPriority => { + if proposer_priority__.is_some() { + return Err(serde::de::Error::duplicate_field("proposerPriority")); + } + proposer_priority__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Validator { + address: address__.unwrap_or_default(), + pub_key: pub_key__, + voting_power: voting_power__.unwrap_or_default(), + proposer_priority: proposer_priority__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.Validator", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VersionInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.app_name.is_empty() { + len += 1; + } + if !self.version.is_empty() { + len += 1; + } + if !self.git_commit.is_empty() { + len += 1; + } + if !self.build_tags.is_empty() { + len += 1; + } + if !self.go_version.is_empty() { + len += 1; + } + if !self.build_deps.is_empty() { + len += 1; + } + if !self.cosmos_sdk_version.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.tendermint.v1beta1.VersionInfo", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.app_name.is_empty() { + struct_ser.serialize_field("appName", &self.app_name)?; + } + if !self.version.is_empty() { + struct_ser.serialize_field("version", &self.version)?; + } + if !self.git_commit.is_empty() { + struct_ser.serialize_field("gitCommit", &self.git_commit)?; + } + if !self.build_tags.is_empty() { + struct_ser.serialize_field("buildTags", &self.build_tags)?; + } + if !self.go_version.is_empty() { + struct_ser.serialize_field("goVersion", &self.go_version)?; + } + if !self.build_deps.is_empty() { + struct_ser.serialize_field("buildDeps", &self.build_deps)?; + } + if !self.cosmos_sdk_version.is_empty() { + struct_ser.serialize_field("cosmosSdkVersion", &self.cosmos_sdk_version)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VersionInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "name", + "app_name", + "appName", + "version", + "git_commit", + "gitCommit", + "build_tags", + "buildTags", + "go_version", + "goVersion", + "build_deps", + "buildDeps", + "cosmos_sdk_version", + "cosmosSdkVersion", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + AppName, + Version, + GitCommit, + BuildTags, + GoVersion, + BuildDeps, + CosmosSdkVersion, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "appName" | "app_name" => Ok(GeneratedField::AppName), + "version" => Ok(GeneratedField::Version), + "gitCommit" | "git_commit" => Ok(GeneratedField::GitCommit), + "buildTags" | "build_tags" => Ok(GeneratedField::BuildTags), + "goVersion" | "go_version" => Ok(GeneratedField::GoVersion), + "buildDeps" | "build_deps" => Ok(GeneratedField::BuildDeps), + "cosmosSdkVersion" | "cosmos_sdk_version" => { + Ok(GeneratedField::CosmosSdkVersion) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VersionInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.tendermint.v1beta1.VersionInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut app_name__ = None; + let mut version__ = None; + let mut git_commit__ = None; + let mut build_tags__ = None; + let mut go_version__ = None; + let mut build_deps__ = None; + let mut cosmos_sdk_version__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::AppName => { + if app_name__.is_some() { + return Err(serde::de::Error::duplicate_field("appName")); + } + app_name__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some(map_.next_value()?); + } + GeneratedField::GitCommit => { + if git_commit__.is_some() { + return Err(serde::de::Error::duplicate_field("gitCommit")); + } + git_commit__ = Some(map_.next_value()?); + } + GeneratedField::BuildTags => { + if build_tags__.is_some() { + return Err(serde::de::Error::duplicate_field("buildTags")); + } + build_tags__ = Some(map_.next_value()?); + } + GeneratedField::GoVersion => { + if go_version__.is_some() { + return Err(serde::de::Error::duplicate_field("goVersion")); + } + go_version__ = Some(map_.next_value()?); + } + GeneratedField::BuildDeps => { + if build_deps__.is_some() { + return Err(serde::de::Error::duplicate_field("buildDeps")); + } + build_deps__ = Some(map_.next_value()?); + } + GeneratedField::CosmosSdkVersion => { + if cosmos_sdk_version__.is_some() { + return Err(serde::de::Error::duplicate_field("cosmosSdkVersion")); + } + cosmos_sdk_version__ = Some(map_.next_value()?); + } + } + } + Ok(VersionInfo { + name: name__.unwrap_or_default(), + app_name: app_name__.unwrap_or_default(), + version: version__.unwrap_or_default(), + git_commit: git_commit__.unwrap_or_default(), + build_tags: build_tags__.unwrap_or_default(), + go_version: go_version__.unwrap_or_default(), + build_deps: build_deps__.unwrap_or_default(), + cosmos_sdk_version: cosmos_sdk_version__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.tendermint.v1beta1.VersionInfo", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.rs index 3701a1a8..8a02bbd7 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.rs @@ -37,4 +37,5 @@ pub struct DecProto { #[prost(string, tag = "1")] pub dec: ::prost::alloc::string::String, } +include!("cosmos.base.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.serde.rs new file mode 100644 index 00000000..92880130 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.v1beta1.serde.rs @@ -0,0 +1,413 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Coin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.Coin", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Coin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Coin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.Coin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(Coin { + denom: denom__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.Coin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DecCoin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.DecCoin", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DecCoin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DecCoin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.DecCoin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(DecCoin { + denom: denom__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.DecCoin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DecProto { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.dec.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.DecProto", len)?; + if !self.dec.is_empty() { + struct_ser.serialize_field("dec", &self.dec)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DecProto { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["dec"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Dec, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "dec" => Ok(GeneratedField::Dec), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DecProto; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.DecProto") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut dec__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Dec => { + if dec__.is_some() { + return Err(serde::de::Error::duplicate_field("dec")); + } + dec__ = Some(map_.next_value()?); + } + } + } + Ok(DecProto { + dec: dec__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.DecProto", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for IntProto { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.int.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.IntProto", len)?; + if !self.int.is_empty() { + struct_ser.serialize_field("int", &self.int)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for IntProto { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["int"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Int, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "int" => Ok(GeneratedField::Int), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = IntProto; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.IntProto") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut int__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Int => { + if int__.is_some() { + return Err(serde::de::Error::duplicate_field("int")); + } + int__ = Some(map_.next_value()?); + } + } + } + Ok(IntProto { + int: int__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.IntProto", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.rs index 3b08dbef..2e2a7da7 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.rs @@ -48,4 +48,5 @@ pub struct GenesisState { #[prost(message, repeated, tag = "2")] pub owners: ::prost::alloc::vec::Vec, } +include!("cosmos.capability.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.serde.rs new file mode 100644 index 00000000..0ee701e3 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.capability.v1beta1.serde.rs @@ -0,0 +1,556 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Capability { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.index != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.capability.v1beta1.Capability", len)?; + if self.index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("index", ToString::to_string(&self.index).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Capability { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["index"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Index, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "index" => Ok(GeneratedField::Index), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Capability; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.capability.v1beta1.Capability") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut index__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Capability { + index: index__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.capability.v1beta1.Capability", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CapabilityOwners { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.owners.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.capability.v1beta1.CapabilityOwners", len)?; + if !self.owners.is_empty() { + struct_ser.serialize_field("owners", &self.owners)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CapabilityOwners { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["owners"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Owners, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "owners" => Ok(GeneratedField::Owners), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CapabilityOwners; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.capability.v1beta1.CapabilityOwners") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut owners__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Owners => { + if owners__.is_some() { + return Err(serde::de::Error::duplicate_field("owners")); + } + owners__ = Some(map_.next_value()?); + } + } + } + Ok(CapabilityOwners { + owners: owners__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.capability.v1beta1.CapabilityOwners", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisOwners { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.index != 0 { + len += 1; + } + if self.index_owners.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.capability.v1beta1.GenesisOwners", len)?; + if self.index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("index", ToString::to_string(&self.index).as_str())?; + } + if let Some(v) = self.index_owners.as_ref() { + struct_ser.serialize_field("indexOwners", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisOwners { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["index", "index_owners", "indexOwners"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Index, + IndexOwners, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "index" => Ok(GeneratedField::Index), + "indexOwners" | "index_owners" => Ok(GeneratedField::IndexOwners), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisOwners; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.capability.v1beta1.GenesisOwners") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut index__ = None; + let mut index_owners__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::IndexOwners => { + if index_owners__.is_some() { + return Err(serde::de::Error::duplicate_field("indexOwners")); + } + index_owners__ = map_.next_value()?; + } + } + } + Ok(GenesisOwners { + index: index__.unwrap_or_default(), + index_owners: index_owners__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.capability.v1beta1.GenesisOwners", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.index != 0 { + len += 1; + } + if !self.owners.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.capability.v1beta1.GenesisState", len)?; + if self.index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("index", ToString::to_string(&self.index).as_str())?; + } + if !self.owners.is_empty() { + struct_ser.serialize_field("owners", &self.owners)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["index", "owners"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Index, + Owners, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "index" => Ok(GeneratedField::Index), + "owners" => Ok(GeneratedField::Owners), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.capability.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut index__ = None; + let mut owners__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Owners => { + if owners__.is_some() { + return Err(serde::de::Error::duplicate_field("owners")); + } + owners__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + index: index__.unwrap_or_default(), + owners: owners__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.capability.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Owner { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.module.is_empty() { + len += 1; + } + if !self.name.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.capability.v1beta1.Owner", len)?; + if !self.module.is_empty() { + struct_ser.serialize_field("module", &self.module)?; + } + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Owner { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["module", "name"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Module, + Name, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "module" => Ok(GeneratedField::Module), + "name" => Ok(GeneratedField::Name), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Owner; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.capability.v1beta1.Owner") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut module__ = None; + let mut name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Module => { + if module__.is_some() { + return Err(serde::de::Error::duplicate_field("module")); + } + module__ = Some(map_.next_value()?); + } + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + } + } + Ok(Owner { + module: module__.unwrap_or_default(), + name: name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.capability.v1beta1.Owner", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.rs index 02c77950..470ed705 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.rs @@ -23,5 +23,6 @@ pub struct MsgVerifyInvariant { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgVerifyInvariantResponse {} +include!("cosmos.crisis.v1beta1.serde.rs"); include!("cosmos.crisis.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.serde.rs new file mode 100644 index 00000000..3ff1baff --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.v1beta1.serde.rs @@ -0,0 +1,327 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.constant_fee.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crisis.v1beta1.GenesisState", len)?; + if let Some(v) = self.constant_fee.as_ref() { + struct_ser.serialize_field("constantFee", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["constant_fee", "constantFee"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ConstantFee, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "constantFee" | "constant_fee" => Ok(GeneratedField::ConstantFee), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crisis.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut constant_fee__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ConstantFee => { + if constant_fee__.is_some() { + return Err(serde::de::Error::duplicate_field("constantFee")); + } + constant_fee__ = map_.next_value()?; + } + } + } + Ok(GenesisState { + constant_fee: constant_fee__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.crisis.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVerifyInvariant { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.invariant_module_name.is_empty() { + len += 1; + } + if !self.invariant_route.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crisis.v1beta1.MsgVerifyInvariant", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.invariant_module_name.is_empty() { + struct_ser.serialize_field("invariantModuleName", &self.invariant_module_name)?; + } + if !self.invariant_route.is_empty() { + struct_ser.serialize_field("invariantRoute", &self.invariant_route)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVerifyInvariant { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sender", + "invariant_module_name", + "invariantModuleName", + "invariant_route", + "invariantRoute", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + InvariantModuleName, + InvariantRoute, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "invariantModuleName" | "invariant_module_name" => { + Ok(GeneratedField::InvariantModuleName) + } + "invariantRoute" | "invariant_route" => { + Ok(GeneratedField::InvariantRoute) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVerifyInvariant; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crisis.v1beta1.MsgVerifyInvariant") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut invariant_module_name__ = None; + let mut invariant_route__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::InvariantModuleName => { + if invariant_module_name__.is_some() { + return Err(serde::de::Error::duplicate_field( + "invariantModuleName", + )); + } + invariant_module_name__ = Some(map_.next_value()?); + } + GeneratedField::InvariantRoute => { + if invariant_route__.is_some() { + return Err(serde::de::Error::duplicate_field("invariantRoute")); + } + invariant_route__ = Some(map_.next_value()?); + } + } + } + Ok(MsgVerifyInvariant { + sender: sender__.unwrap_or_default(), + invariant_module_name: invariant_module_name__.unwrap_or_default(), + invariant_route: invariant_route__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.crisis.v1beta1.MsgVerifyInvariant", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVerifyInvariantResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVerifyInvariantResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVerifyInvariantResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crisis.v1beta1.MsgVerifyInvariantResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVerifyInvariantResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.crisis.v1beta1.MsgVerifyInvariantResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.rs index ffe81581..833192d2 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.rs @@ -18,4 +18,5 @@ pub struct PrivKey { #[prost(bytes = "vec", tag = "1")] pub key: ::prost::alloc::vec::Vec, } +include!("cosmos.crypto.ed25519.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.serde.rs new file mode 100644 index 00000000..9e7f0c8e --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.ed25519.serde.rs @@ -0,0 +1,201 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PrivKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.ed25519.PrivKey", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PrivKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PrivKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.ed25519.PrivKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PrivKey { + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.ed25519.PrivKey", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PubKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.ed25519.PubKey", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PubKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PubKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.ed25519.PubKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PubKey { + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.ed25519.PubKey", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.rs index 012f1ec2..818e4abc 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.rs @@ -20,4 +20,5 @@ pub struct Bip44Params { #[prost(uint32, tag = "5")] pub address_index: u32, } +include!("cosmos.crypto.hd.v1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.serde.rs new file mode 100644 index 00000000..2f8be019 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.hd.v1.serde.rs @@ -0,0 +1,180 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Bip44Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.purpose != 0 { + len += 1; + } + if self.coin_type != 0 { + len += 1; + } + if self.account != 0 { + len += 1; + } + if self.change { + len += 1; + } + if self.address_index != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.hd.v1.BIP44Params", len)?; + if self.purpose != 0 { + struct_ser.serialize_field("purpose", &self.purpose)?; + } + if self.coin_type != 0 { + struct_ser.serialize_field("coinType", &self.coin_type)?; + } + if self.account != 0 { + struct_ser.serialize_field("account", &self.account)?; + } + if self.change { + struct_ser.serialize_field("change", &self.change)?; + } + if self.address_index != 0 { + struct_ser.serialize_field("addressIndex", &self.address_index)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Bip44Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "purpose", + "coin_type", + "coinType", + "account", + "change", + "address_index", + "addressIndex", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Purpose, + CoinType, + Account, + Change, + AddressIndex, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "purpose" => Ok(GeneratedField::Purpose), + "coinType" | "coin_type" => Ok(GeneratedField::CoinType), + "account" => Ok(GeneratedField::Account), + "change" => Ok(GeneratedField::Change), + "addressIndex" | "address_index" => Ok(GeneratedField::AddressIndex), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Bip44Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.hd.v1.BIP44Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut purpose__ = None; + let mut coin_type__ = None; + let mut account__ = None; + let mut change__ = None; + let mut address_index__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Purpose => { + if purpose__.is_some() { + return Err(serde::de::Error::duplicate_field("purpose")); + } + purpose__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CoinType => { + if coin_type__.is_some() { + return Err(serde::de::Error::duplicate_field("coinType")); + } + coin_type__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Account => { + if account__.is_some() { + return Err(serde::de::Error::duplicate_field("account")); + } + account__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Change => { + if change__.is_some() { + return Err(serde::de::Error::duplicate_field("change")); + } + change__ = Some(map_.next_value()?); + } + GeneratedField::AddressIndex => { + if address_index__.is_some() { + return Err(serde::de::Error::duplicate_field("addressIndex")); + } + address_index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Bip44Params { + purpose: purpose__.unwrap_or_default(), + coin_type: coin_type__.unwrap_or_default(), + account: account__.unwrap_or_default(), + change: change__.unwrap_or_default(), + address_index: address_index__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.hd.v1.BIP44Params", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.rs index 6c9bcfe2..b267bbdb 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.rs @@ -56,4 +56,5 @@ pub mod record { Offline(Offline), } } +include!("cosmos.crypto.keyring.v1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.serde.rs new file mode 100644 index 00000000..6e8dcdb7 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.keyring.v1.serde.rs @@ -0,0 +1,531 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Record { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.pub_key.is_some() { + len += 1; + } + if self.item.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.keyring.v1.Record", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if let Some(v) = self.pub_key.as_ref() { + struct_ser.serialize_field("pubKey", v)?; + } + if let Some(v) = self.item.as_ref() { + match v { + record::Item::Local(v) => { + struct_ser.serialize_field("local", v)?; + } + record::Item::Ledger(v) => { + struct_ser.serialize_field("ledger", v)?; + } + record::Item::Multi(v) => { + struct_ser.serialize_field("multi", v)?; + } + record::Item::Offline(v) => { + struct_ser.serialize_field("offline", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Record { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "name", "pub_key", "pubKey", "local", "ledger", "multi", "offline", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + PubKey, + Local, + Ledger, + Multi, + Offline, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "pubKey" | "pub_key" => Ok(GeneratedField::PubKey), + "local" => Ok(GeneratedField::Local), + "ledger" => Ok(GeneratedField::Ledger), + "multi" => Ok(GeneratedField::Multi), + "offline" => Ok(GeneratedField::Offline), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Record; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.keyring.v1.Record") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut pub_key__ = None; + let mut item__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::PubKey => { + if pub_key__.is_some() { + return Err(serde::de::Error::duplicate_field("pubKey")); + } + pub_key__ = map_.next_value()?; + } + GeneratedField::Local => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("local")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(record::Item::Local); + } + GeneratedField::Ledger => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("ledger")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(record::Item::Ledger); + } + GeneratedField::Multi => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("multi")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(record::Item::Multi); + } + GeneratedField::Offline => { + if item__.is_some() { + return Err(serde::de::Error::duplicate_field("offline")); + } + item__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(record::Item::Offline); + } + } + } + Ok(Record { + name: name__.unwrap_or_default(), + pub_key: pub_key__, + item: item__, + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.keyring.v1.Record", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for record::Ledger { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.path.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crypto.keyring.v1.Record.Ledger", len)?; + if let Some(v) = self.path.as_ref() { + struct_ser.serialize_field("path", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for record::Ledger { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["path"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Path, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "path" => Ok(GeneratedField::Path), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = record::Ledger; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.keyring.v1.Record.Ledger") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut path__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Path => { + if path__.is_some() { + return Err(serde::de::Error::duplicate_field("path")); + } + path__ = map_.next_value()?; + } + } + } + Ok(record::Ledger { path: path__ }) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.keyring.v1.Record.Ledger", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for record::Local { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.priv_key.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crypto.keyring.v1.Record.Local", len)?; + if let Some(v) = self.priv_key.as_ref() { + struct_ser.serialize_field("privKey", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for record::Local { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["priv_key", "privKey"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PrivKey, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "privKey" | "priv_key" => Ok(GeneratedField::PrivKey), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = record::Local; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.keyring.v1.Record.Local") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut priv_key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::PrivKey => { + if priv_key__.is_some() { + return Err(serde::de::Error::duplicate_field("privKey")); + } + priv_key__ = map_.next_value()?; + } + } + } + Ok(record::Local { + priv_key: priv_key__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.keyring.v1.Record.Local", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for record::Multi { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.crypto.keyring.v1.Record.Multi", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for record::Multi { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = record::Multi; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.keyring.v1.Record.Multi") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(record::Multi {}) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.keyring.v1.Record.Multi", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for record::Offline { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.crypto.keyring.v1.Record.Offline", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for record::Offline { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = record::Offline; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.keyring.v1.Record.Offline") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(record::Offline {}) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.keyring.v1.Record.Offline", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.rs index 5bb6c242..4956c183 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.rs @@ -10,4 +10,5 @@ pub struct LegacyAminoPubKey { #[prost(message, repeated, tag = "2")] pub public_keys: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, } +include!("cosmos.crypto.multisig.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.serde.rs new file mode 100644 index 00000000..fc8f40bd --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.serde.rs @@ -0,0 +1,120 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for LegacyAminoPubKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.threshold != 0 { + len += 1; + } + if !self.public_keys.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crypto.multisig.LegacyAminoPubKey", len)?; + if self.threshold != 0 { + struct_ser.serialize_field("threshold", &self.threshold)?; + } + if !self.public_keys.is_empty() { + struct_ser.serialize_field("publicKeys", &self.public_keys)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for LegacyAminoPubKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["threshold", "public_keys", "publicKeys"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Threshold, + PublicKeys, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "threshold" => Ok(GeneratedField::Threshold), + "publicKeys" | "public_keys" => Ok(GeneratedField::PublicKeys), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = LegacyAminoPubKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.multisig.LegacyAminoPubKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut threshold__ = None; + let mut public_keys__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Threshold => { + if threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("threshold")); + } + threshold__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::PublicKeys => { + if public_keys__.is_some() { + return Err(serde::de::Error::duplicate_field("publicKeys")); + } + public_keys__ = Some(map_.next_value()?); + } + } + } + Ok(LegacyAminoPubKey { + threshold: threshold__.unwrap_or_default(), + public_keys: public_keys__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.multisig.LegacyAminoPubKey", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.rs index b02457f2..38dcaeb7 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.rs @@ -20,4 +20,5 @@ pub struct CompactBitArray { #[prost(bytes = "vec", tag = "2")] pub elems: ::prost::alloc::vec::Vec, } +include!("cosmos.crypto.multisig.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.serde.rs new file mode 100644 index 00000000..710a19db --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.v1beta1.serde.rs @@ -0,0 +1,241 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for CompactBitArray { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.extra_bits_stored != 0 { + len += 1; + } + if !self.elems.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crypto.multisig.v1beta1.CompactBitArray", len)?; + if self.extra_bits_stored != 0 { + struct_ser.serialize_field("extraBitsStored", &self.extra_bits_stored)?; + } + if !self.elems.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "elems", + pbjson::private::base64::encode(&self.elems).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CompactBitArray { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["extra_bits_stored", "extraBitsStored", "elems"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ExtraBitsStored, + Elems, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "extraBitsStored" | "extra_bits_stored" => { + Ok(GeneratedField::ExtraBitsStored) + } + "elems" => Ok(GeneratedField::Elems), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CompactBitArray; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.multisig.v1beta1.CompactBitArray") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut extra_bits_stored__ = None; + let mut elems__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ExtraBitsStored => { + if extra_bits_stored__.is_some() { + return Err(serde::de::Error::duplicate_field("extraBitsStored")); + } + extra_bits_stored__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Elems => { + if elems__.is_some() { + return Err(serde::de::Error::duplicate_field("elems")); + } + elems__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(CompactBitArray { + extra_bits_stored: extra_bits_stored__.unwrap_or_default(), + elems: elems__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.multisig.v1beta1.CompactBitArray", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MultiSignature { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.signatures.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.crypto.multisig.v1beta1.MultiSignature", len)?; + if !self.signatures.is_empty() { + struct_ser.serialize_field( + "signatures", + &self + .signatures + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MultiSignature { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["signatures"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Signatures, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "signatures" => Ok(GeneratedField::Signatures), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MultiSignature; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.multisig.v1beta1.MultiSignature") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut signatures__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Signatures => { + if signatures__.is_some() { + return Err(serde::de::Error::duplicate_field("signatures")); + } + signatures__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(MultiSignature { + signatures: signatures__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.crypto.multisig.v1beta1.MultiSignature", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.rs index fcc15624..bc3e9ac2 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.rs @@ -17,4 +17,5 @@ pub struct PrivKey { #[prost(bytes = "vec", tag = "1")] pub key: ::prost::alloc::vec::Vec, } +include!("cosmos.crypto.secp256k1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.serde.rs new file mode 100644 index 00000000..d86db770 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256k1.serde.rs @@ -0,0 +1,201 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PrivKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.secp256k1.PrivKey", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PrivKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PrivKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.secp256k1.PrivKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PrivKey { + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.secp256k1.PrivKey", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PubKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.secp256k1.PubKey", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PubKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PubKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.secp256k1.PubKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PubKey { + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.secp256k1.PubKey", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.rs index b5078d8c..23cc50dc 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.rs @@ -16,4 +16,5 @@ pub struct PrivKey { #[prost(bytes = "vec", tag = "1")] pub secret: ::prost::alloc::vec::Vec, } +include!("cosmos.crypto.secp256r1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.serde.rs new file mode 100644 index 00000000..f209b80d --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.secp256r1.serde.rs @@ -0,0 +1,203 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PrivKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.secret.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.secp256r1.PrivKey", len)?; + if !self.secret.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "secret", + pbjson::private::base64::encode(&self.secret).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PrivKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["secret"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Secret, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "secret" => Ok(GeneratedField::Secret), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PrivKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.secp256r1.PrivKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut secret__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Secret => { + if secret__.is_some() { + return Err(serde::de::Error::duplicate_field("secret")); + } + secret__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PrivKey { + secret: secret__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.secp256r1.PrivKey", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PubKey { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.crypto.secp256r1.PubKey", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PubKey { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PubKey; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.crypto.secp256r1.PubKey") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PubKey { + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.crypto.secp256r1.PubKey", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.rs index 7364d071..9cbfccb6 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.rs @@ -502,5 +502,6 @@ pub struct MsgFundCommunityPool { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgFundCommunityPoolResponse {} +include!("cosmos.distribution.v1beta1.serde.rs"); include!("cosmos.distribution.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.serde.rs new file mode 100644 index 00000000..72437a02 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.v1beta1.serde.rs @@ -0,0 +1,5712 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for CommunityPoolSpendProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.recipient.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + len, + )?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.recipient.is_empty() { + struct_ser.serialize_field("recipient", &self.recipient)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CommunityPoolSpendProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "recipient", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Recipient, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "recipient" => Ok(GeneratedField::Recipient), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CommunityPoolSpendProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.CommunityPoolSpendProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut recipient__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Recipient => { + if recipient__.is_some() { + return Err(serde::de::Error::duplicate_field("recipient")); + } + recipient__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(CommunityPoolSpendProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + recipient: recipient__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CommunityPoolSpendProposalWithDeposit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.recipient.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + if !self.deposit.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + len, + )?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.recipient.is_empty() { + struct_ser.serialize_field("recipient", &self.recipient)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + if !self.deposit.is_empty() { + struct_ser.serialize_field("deposit", &self.deposit)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CommunityPoolSpendProposalWithDeposit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "recipient", "amount", "deposit"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Recipient, + Amount, + Deposit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "recipient" => Ok(GeneratedField::Recipient), + "amount" => Ok(GeneratedField::Amount), + "deposit" => Ok(GeneratedField::Deposit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CommunityPoolSpendProposalWithDeposit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut recipient__ = None; + let mut amount__ = None; + let mut deposit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Recipient => { + if recipient__.is_some() { + return Err(serde::de::Error::duplicate_field("recipient")); + } + recipient__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + GeneratedField::Deposit => { + if deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("deposit")); + } + deposit__ = Some(map_.next_value()?); + } + } + } + Ok(CommunityPoolSpendProposalWithDeposit { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + recipient: recipient__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + deposit: deposit__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelegationDelegatorReward { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if !self.reward.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.DelegationDelegatorReward", len)?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if !self.reward.is_empty() { + struct_ser.serialize_field("reward", &self.reward)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelegationDelegatorReward { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress", "reward"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + Reward, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "reward" => Ok(GeneratedField::Reward), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelegationDelegatorReward; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.DelegationDelegatorReward") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut reward__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Reward => { + if reward__.is_some() { + return Err(serde::de::Error::duplicate_field("reward")); + } + reward__ = Some(map_.next_value()?); + } + } + } + Ok(DelegationDelegatorReward { + validator_address: validator_address__.unwrap_or_default(), + reward: reward__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.DelegationDelegatorReward", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelegatorStartingInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.previous_period != 0 { + len += 1; + } + if !self.stake.is_empty() { + len += 1; + } + if self.height != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.DelegatorStartingInfo", len)?; + if self.previous_period != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "previousPeriod", + ToString::to_string(&self.previous_period).as_str(), + )?; + } + if !self.stake.is_empty() { + struct_ser.serialize_field("stake", &self.stake)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelegatorStartingInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["previous_period", "previousPeriod", "stake", "height"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PreviousPeriod, + Stake, + Height, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "previousPeriod" | "previous_period" => { + Ok(GeneratedField::PreviousPeriod) + } + "stake" => Ok(GeneratedField::Stake), + "height" => Ok(GeneratedField::Height), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelegatorStartingInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.DelegatorStartingInfo") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut previous_period__ = None; + let mut stake__ = None; + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::PreviousPeriod => { + if previous_period__.is_some() { + return Err(serde::de::Error::duplicate_field("previousPeriod")); + } + previous_period__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Stake => { + if stake__.is_some() { + return Err(serde::de::Error::duplicate_field("stake")); + } + stake__ = Some(map_.next_value()?); + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(DelegatorStartingInfo { + previous_period: previous_period__.unwrap_or_default(), + stake: stake__.unwrap_or_default(), + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.DelegatorStartingInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelegatorStartingInfoRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if self.starting_info.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.starting_info.as_ref() { + struct_ser.serialize_field("startingInfo", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelegatorStartingInfoRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "starting_info", + "startingInfo", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + StartingInfo, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "startingInfo" | "starting_info" => Ok(GeneratedField::StartingInfo), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelegatorStartingInfoRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.DelegatorStartingInfoRecord") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut starting_info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::StartingInfo => { + if starting_info__.is_some() { + return Err(serde::de::Error::duplicate_field("startingInfo")); + } + starting_info__ = map_.next_value()?; + } + } + } + Ok(DelegatorStartingInfoRecord { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + starting_info: starting_info__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelegatorWithdrawInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.withdraw_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.DelegatorWithdrawInfo", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.withdraw_address.is_empty() { + struct_ser.serialize_field("withdrawAddress", &self.withdraw_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelegatorWithdrawInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "withdraw_address", + "withdrawAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + WithdrawAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "withdrawAddress" | "withdraw_address" => { + Ok(GeneratedField::WithdrawAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelegatorWithdrawInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.DelegatorWithdrawInfo") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut withdraw_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::WithdrawAddress => { + if withdraw_address__.is_some() { + return Err(serde::de::Error::duplicate_field("withdrawAddress")); + } + withdraw_address__ = Some(map_.next_value()?); + } + } + } + Ok(DelegatorWithdrawInfo { + delegator_address: delegator_address__.unwrap_or_default(), + withdraw_address: withdraw_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.DelegatorWithdrawInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for FeePool { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.community_pool.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.FeePool", len)?; + if !self.community_pool.is_empty() { + struct_ser.serialize_field("communityPool", &self.community_pool)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for FeePool { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["community_pool", "communityPool"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CommunityPool, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "communityPool" | "community_pool" => Ok(GeneratedField::CommunityPool), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = FeePool; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.FeePool") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut community_pool__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CommunityPool => { + if community_pool__.is_some() { + return Err(serde::de::Error::duplicate_field("communityPool")); + } + community_pool__ = Some(map_.next_value()?); + } + } + } + Ok(FeePool { + community_pool: community_pool__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.FeePool", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if self.fee_pool.is_some() { + len += 1; + } + if !self.delegator_withdraw_infos.is_empty() { + len += 1; + } + if !self.previous_proposer.is_empty() { + len += 1; + } + if !self.outstanding_rewards.is_empty() { + len += 1; + } + if !self.validator_accumulated_commissions.is_empty() { + len += 1; + } + if !self.validator_historical_rewards.is_empty() { + len += 1; + } + if !self.validator_current_rewards.is_empty() { + len += 1; + } + if !self.delegator_starting_infos.is_empty() { + len += 1; + } + if !self.validator_slash_events.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if let Some(v) = self.fee_pool.as_ref() { + struct_ser.serialize_field("feePool", v)?; + } + if !self.delegator_withdraw_infos.is_empty() { + struct_ser.serialize_field("delegatorWithdrawInfos", &self.delegator_withdraw_infos)?; + } + if !self.previous_proposer.is_empty() { + struct_ser.serialize_field("previousProposer", &self.previous_proposer)?; + } + if !self.outstanding_rewards.is_empty() { + struct_ser.serialize_field("outstandingRewards", &self.outstanding_rewards)?; + } + if !self.validator_accumulated_commissions.is_empty() { + struct_ser.serialize_field( + "validatorAccumulatedCommissions", + &self.validator_accumulated_commissions, + )?; + } + if !self.validator_historical_rewards.is_empty() { + struct_ser.serialize_field( + "validatorHistoricalRewards", + &self.validator_historical_rewards, + )?; + } + if !self.validator_current_rewards.is_empty() { + struct_ser + .serialize_field("validatorCurrentRewards", &self.validator_current_rewards)?; + } + if !self.delegator_starting_infos.is_empty() { + struct_ser.serialize_field("delegatorStartingInfos", &self.delegator_starting_infos)?; + } + if !self.validator_slash_events.is_empty() { + struct_ser.serialize_field("validatorSlashEvents", &self.validator_slash_events)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + "fee_pool", + "feePool", + "delegator_withdraw_infos", + "delegatorWithdrawInfos", + "previous_proposer", + "previousProposer", + "outstanding_rewards", + "outstandingRewards", + "validator_accumulated_commissions", + "validatorAccumulatedCommissions", + "validator_historical_rewards", + "validatorHistoricalRewards", + "validator_current_rewards", + "validatorCurrentRewards", + "delegator_starting_infos", + "delegatorStartingInfos", + "validator_slash_events", + "validatorSlashEvents", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + FeePool, + DelegatorWithdrawInfos, + PreviousProposer, + OutstandingRewards, + ValidatorAccumulatedCommissions, + ValidatorHistoricalRewards, + ValidatorCurrentRewards, + DelegatorStartingInfos, + ValidatorSlashEvents, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "feePool" | "fee_pool" => Ok(GeneratedField::FeePool), + "delegatorWithdrawInfos" | "delegator_withdraw_infos" => { + Ok(GeneratedField::DelegatorWithdrawInfos) + } + "previousProposer" | "previous_proposer" => { + Ok(GeneratedField::PreviousProposer) + } + "outstandingRewards" | "outstanding_rewards" => { + Ok(GeneratedField::OutstandingRewards) + } + "validatorAccumulatedCommissions" + | "validator_accumulated_commissions" => { + Ok(GeneratedField::ValidatorAccumulatedCommissions) + } + "validatorHistoricalRewards" | "validator_historical_rewards" => { + Ok(GeneratedField::ValidatorHistoricalRewards) + } + "validatorCurrentRewards" | "validator_current_rewards" => { + Ok(GeneratedField::ValidatorCurrentRewards) + } + "delegatorStartingInfos" | "delegator_starting_infos" => { + Ok(GeneratedField::DelegatorStartingInfos) + } + "validatorSlashEvents" | "validator_slash_events" => { + Ok(GeneratedField::ValidatorSlashEvents) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut fee_pool__ = None; + let mut delegator_withdraw_infos__ = None; + let mut previous_proposer__ = None; + let mut outstanding_rewards__ = None; + let mut validator_accumulated_commissions__ = None; + let mut validator_historical_rewards__ = None; + let mut validator_current_rewards__ = None; + let mut delegator_starting_infos__ = None; + let mut validator_slash_events__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::FeePool => { + if fee_pool__.is_some() { + return Err(serde::de::Error::duplicate_field("feePool")); + } + fee_pool__ = map_.next_value()?; + } + GeneratedField::DelegatorWithdrawInfos => { + if delegator_withdraw_infos__.is_some() { + return Err(serde::de::Error::duplicate_field( + "delegatorWithdrawInfos", + )); + } + delegator_withdraw_infos__ = Some(map_.next_value()?); + } + GeneratedField::PreviousProposer => { + if previous_proposer__.is_some() { + return Err(serde::de::Error::duplicate_field("previousProposer")); + } + previous_proposer__ = Some(map_.next_value()?); + } + GeneratedField::OutstandingRewards => { + if outstanding_rewards__.is_some() { + return Err(serde::de::Error::duplicate_field( + "outstandingRewards", + )); + } + outstanding_rewards__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAccumulatedCommissions => { + if validator_accumulated_commissions__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorAccumulatedCommissions", + )); + } + validator_accumulated_commissions__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorHistoricalRewards => { + if validator_historical_rewards__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorHistoricalRewards", + )); + } + validator_historical_rewards__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorCurrentRewards => { + if validator_current_rewards__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorCurrentRewards", + )); + } + validator_current_rewards__ = Some(map_.next_value()?); + } + GeneratedField::DelegatorStartingInfos => { + if delegator_starting_infos__.is_some() { + return Err(serde::de::Error::duplicate_field( + "delegatorStartingInfos", + )); + } + delegator_starting_infos__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorSlashEvents => { + if validator_slash_events__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSlashEvents", + )); + } + validator_slash_events__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + fee_pool: fee_pool__, + delegator_withdraw_infos: delegator_withdraw_infos__.unwrap_or_default(), + previous_proposer: previous_proposer__.unwrap_or_default(), + outstanding_rewards: outstanding_rewards__.unwrap_or_default(), + validator_accumulated_commissions: validator_accumulated_commissions__ + .unwrap_or_default(), + validator_historical_rewards: validator_historical_rewards__ + .unwrap_or_default(), + validator_current_rewards: validator_current_rewards__.unwrap_or_default(), + delegator_starting_infos: delegator_starting_infos__.unwrap_or_default(), + validator_slash_events: validator_slash_events__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgFundCommunityPool { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.amount.is_empty() { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.MsgFundCommunityPool", len)?; + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgFundCommunityPool { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount", "depositor"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + Depositor, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + "depositor" => Ok(GeneratedField::Depositor), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgFundCommunityPool; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.MsgFundCommunityPool") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + let mut depositor__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + } + } + Ok(MsgFundCommunityPool { + amount: amount__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgFundCommunityPool", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgFundCommunityPoolResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgFundCommunityPoolResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgFundCommunityPoolResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgFundCommunityPoolResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSetWithdrawAddress { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.withdraw_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.MsgSetWithdrawAddress", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.withdraw_address.is_empty() { + struct_ser.serialize_field("withdrawAddress", &self.withdraw_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSetWithdrawAddress { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "withdraw_address", + "withdrawAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + WithdrawAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "withdrawAddress" | "withdraw_address" => { + Ok(GeneratedField::WithdrawAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSetWithdrawAddress; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.MsgSetWithdrawAddress") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut withdraw_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::WithdrawAddress => { + if withdraw_address__.is_some() { + return Err(serde::de::Error::duplicate_field("withdrawAddress")); + } + withdraw_address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgSetWithdrawAddress { + delegator_address: delegator_address__.unwrap_or_default(), + withdraw_address: withdraw_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSetWithdrawAddressResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSetWithdrawAddressResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSetWithdrawAddressResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgSetWithdrawAddressResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawDelegatorReward { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawDelegatorReward { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawDelegatorReward; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgWithdrawDelegatorReward { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawDelegatorRewardResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + len, + )?; + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawDelegatorRewardResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawDelegatorRewardResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgWithdrawDelegatorRewardResponse { + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawValidatorCommission { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawValidatorCommission { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawValidatorCommission; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgWithdrawValidatorCommission { + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawValidatorCommissionResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + len, + )?; + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawValidatorCommissionResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawValidatorCommissionResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgWithdrawValidatorCommissionResponse { + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.community_tax.is_empty() { + len += 1; + } + if !self.base_proposer_reward.is_empty() { + len += 1; + } + if !self.bonus_proposer_reward.is_empty() { + len += 1; + } + if self.withdraw_addr_enabled { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.Params", len)?; + if !self.community_tax.is_empty() { + struct_ser.serialize_field("communityTax", &self.community_tax)?; + } + if !self.base_proposer_reward.is_empty() { + struct_ser.serialize_field("baseProposerReward", &self.base_proposer_reward)?; + } + if !self.bonus_proposer_reward.is_empty() { + struct_ser.serialize_field("bonusProposerReward", &self.bonus_proposer_reward)?; + } + if self.withdraw_addr_enabled { + struct_ser.serialize_field("withdrawAddrEnabled", &self.withdraw_addr_enabled)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "community_tax", + "communityTax", + "base_proposer_reward", + "baseProposerReward", + "bonus_proposer_reward", + "bonusProposerReward", + "withdraw_addr_enabled", + "withdrawAddrEnabled", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CommunityTax, + BaseProposerReward, + BonusProposerReward, + WithdrawAddrEnabled, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "communityTax" | "community_tax" => Ok(GeneratedField::CommunityTax), + "baseProposerReward" | "base_proposer_reward" => { + Ok(GeneratedField::BaseProposerReward) + } + "bonusProposerReward" | "bonus_proposer_reward" => { + Ok(GeneratedField::BonusProposerReward) + } + "withdrawAddrEnabled" | "withdraw_addr_enabled" => { + Ok(GeneratedField::WithdrawAddrEnabled) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut community_tax__ = None; + let mut base_proposer_reward__ = None; + let mut bonus_proposer_reward__ = None; + let mut withdraw_addr_enabled__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CommunityTax => { + if community_tax__.is_some() { + return Err(serde::de::Error::duplicate_field("communityTax")); + } + community_tax__ = Some(map_.next_value()?); + } + GeneratedField::BaseProposerReward => { + if base_proposer_reward__.is_some() { + return Err(serde::de::Error::duplicate_field( + "baseProposerReward", + )); + } + base_proposer_reward__ = Some(map_.next_value()?); + } + GeneratedField::BonusProposerReward => { + if bonus_proposer_reward__.is_some() { + return Err(serde::de::Error::duplicate_field( + "bonusProposerReward", + )); + } + bonus_proposer_reward__ = Some(map_.next_value()?); + } + GeneratedField::WithdrawAddrEnabled => { + if withdraw_addr_enabled__.is_some() { + return Err(serde::de::Error::duplicate_field( + "withdrawAddrEnabled", + )); + } + withdraw_addr_enabled__ = Some(map_.next_value()?); + } + } + } + Ok(Params { + community_tax: community_tax__.unwrap_or_default(), + base_proposer_reward: base_proposer_reward__.unwrap_or_default(), + bonus_proposer_reward: bonus_proposer_reward__.unwrap_or_default(), + withdraw_addr_enabled: withdraw_addr_enabled__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.Params", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCommunityPoolRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.QueryCommunityPoolRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCommunityPoolRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCommunityPoolRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.QueryCommunityPoolRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryCommunityPoolRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryCommunityPoolRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCommunityPoolResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.pool.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + len, + )?; + if !self.pool.is_empty() { + struct_ser.serialize_field("pool", &self.pool)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCommunityPoolResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pool"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pool, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pool" => Ok(GeneratedField::Pool), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCommunityPoolResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.QueryCommunityPoolResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pool__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pool => { + if pool__.is_some() { + return Err(serde::de::Error::duplicate_field("pool")); + } + pool__ = Some(map_.next_value()?); + } + } + } + Ok(QueryCommunityPoolResponse { + pool: pool__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationRewardsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationRewardsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationRewardsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryDelegationRewardsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegationRewardsRequest { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationRewardsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rewards.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + len, + )?; + if !self.rewards.is_empty() { + struct_ser.serialize_field("rewards", &self.rewards)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationRewardsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["rewards"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rewards" => Ok(GeneratedField::Rewards), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationRewardsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryDelegationRewardsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegationRewardsResponse { + rewards: rewards__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationTotalRewardsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationTotalRewardsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_address", "delegatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationTotalRewardsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegationTotalRewardsRequest { + delegator_address: delegator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationTotalRewardsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rewards.is_empty() { + len += 1; + } + if !self.total.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + len, + )?; + if !self.rewards.is_empty() { + struct_ser.serialize_field("rewards", &self.rewards)?; + } + if !self.total.is_empty() { + struct_ser.serialize_field("total", &self.total)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationTotalRewardsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["rewards", "total"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rewards, + Total, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rewards" => Ok(GeneratedField::Rewards), + "total" => Ok(GeneratedField::Total), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationTotalRewardsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rewards__ = None; + let mut total__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = Some(map_.next_value()?); + } + GeneratedField::Total => { + if total__.is_some() { + return Err(serde::de::Error::duplicate_field("total")); + } + total__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegationTotalRewardsResponse { + rewards: rewards__.unwrap_or_default(), + total: total__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_address", "delegatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegatorValidatorsRequest { + delegator_address: delegator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validators.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + len, + )?; + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validators"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Validators, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validators" => Ok(GeneratedField::Validators), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validators__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegatorValidatorsResponse { + validators: validators__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorWithdrawAddressRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + len, + )?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorWithdrawAddressRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_address", "delegatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorWithdrawAddressRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegatorWithdrawAddressRequest { + delegator_address: delegator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorWithdrawAddressResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.withdraw_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + len, + )?; + if !self.withdraw_address.is_empty() { + struct_ser.serialize_field("withdrawAddress", &self.withdraw_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorWithdrawAddressResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["withdraw_address", "withdrawAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + WithdrawAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "withdrawAddress" | "withdraw_address" => { + Ok(GeneratedField::WithdrawAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorWithdrawAddressResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut withdraw_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::WithdrawAddress => { + if withdraw_address__.is_some() { + return Err(serde::de::Error::duplicate_field("withdrawAddress")); + } + withdraw_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegatorWithdrawAddressResponse { + withdraw_address: withdraw_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorCommissionRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorCommissionRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorCommissionRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryValidatorCommissionRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryValidatorCommissionRequest { + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorCommissionResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.commission.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + len, + )?; + if let Some(v) = self.commission.as_ref() { + struct_ser.serialize_field("commission", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorCommissionResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["commission"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Commission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "commission" => Ok(GeneratedField::Commission), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorCommissionResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut commission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Commission => { + if commission__.is_some() { + return Err(serde::de::Error::duplicate_field("commission")); + } + commission__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorCommissionResponse { + commission: commission__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorOutstandingRewardsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorOutstandingRewardsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorOutstandingRewardsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryValidatorOutstandingRewardsRequest { + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorOutstandingRewardsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.rewards.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + len, + )?; + if let Some(v) = self.rewards.as_ref() { + struct_ser.serialize_field("rewards", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorOutstandingRewardsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["rewards"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rewards" => Ok(GeneratedField::Rewards), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorOutstandingRewardsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorOutstandingRewardsResponse { rewards: rewards__ }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorSlashesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if self.starting_height != 0 { + len += 1; + } + if self.ending_height != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if self.starting_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "startingHeight", + ToString::to_string(&self.starting_height).as_str(), + )?; + } + if self.ending_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "endingHeight", + ToString::to_string(&self.ending_height).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorSlashesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "validator_address", + "validatorAddress", + "starting_height", + "startingHeight", + "ending_height", + "endingHeight", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + StartingHeight, + EndingHeight, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "startingHeight" | "starting_height" => { + Ok(GeneratedField::StartingHeight) + } + "endingHeight" | "ending_height" => Ok(GeneratedField::EndingHeight), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorSlashesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryValidatorSlashesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut starting_height__ = None; + let mut ending_height__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::StartingHeight => { + if starting_height__.is_some() { + return Err(serde::de::Error::duplicate_field("startingHeight")); + } + starting_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::EndingHeight => { + if ending_height__.is_some() { + return Err(serde::de::Error::duplicate_field("endingHeight")); + } + ending_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorSlashesRequest { + validator_address: validator_address__.unwrap_or_default(), + starting_height: starting_height__.unwrap_or_default(), + ending_height: ending_height__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorSlashesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.slashes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + len, + )?; + if !self.slashes.is_empty() { + struct_ser.serialize_field("slashes", &self.slashes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorSlashesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["slashes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Slashes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "slashes" => Ok(GeneratedField::Slashes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorSlashesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.QueryValidatorSlashesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut slashes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Slashes => { + if slashes__.is_some() { + return Err(serde::de::Error::duplicate_field("slashes")); + } + slashes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorSlashesResponse { + slashes: slashes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorAccumulatedCommission { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.commission.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + len, + )?; + if !self.commission.is_empty() { + struct_ser.serialize_field("commission", &self.commission)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorAccumulatedCommission { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["commission"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Commission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "commission" => Ok(GeneratedField::Commission), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorAccumulatedCommission; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.ValidatorAccumulatedCommission") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut commission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Commission => { + if commission__.is_some() { + return Err(serde::de::Error::duplicate_field("commission")); + } + commission__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorAccumulatedCommission { + commission: commission__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorAccumulatedCommissionRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if self.accumulated.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.accumulated.as_ref() { + struct_ser.serialize_field("accumulated", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorAccumulatedCommissionRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress", "accumulated"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + Accumulated, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "accumulated" => Ok(GeneratedField::Accumulated), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorAccumulatedCommissionRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut accumulated__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Accumulated => { + if accumulated__.is_some() { + return Err(serde::de::Error::duplicate_field("accumulated")); + } + accumulated__ = map_.next_value()?; + } + } + } + Ok(ValidatorAccumulatedCommissionRecord { + validator_address: validator_address__.unwrap_or_default(), + accumulated: accumulated__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorCurrentRewards { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rewards.is_empty() { + len += 1; + } + if self.period != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.ValidatorCurrentRewards", len)?; + if !self.rewards.is_empty() { + struct_ser.serialize_field("rewards", &self.rewards)?; + } + if self.period != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("period", ToString::to_string(&self.period).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorCurrentRewards { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["rewards", "period"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rewards, + Period, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rewards" => Ok(GeneratedField::Rewards), + "period" => Ok(GeneratedField::Period), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorCurrentRewards; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.ValidatorCurrentRewards") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rewards__ = None; + let mut period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = Some(map_.next_value()?); + } + GeneratedField::Period => { + if period__.is_some() { + return Err(serde::de::Error::duplicate_field("period")); + } + period__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ValidatorCurrentRewards { + rewards: rewards__.unwrap_or_default(), + period: period__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorCurrentRewards", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorCurrentRewardsRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if self.rewards.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.rewards.as_ref() { + struct_ser.serialize_field("rewards", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorCurrentRewardsRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress", "rewards"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + Rewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "rewards" => Ok(GeneratedField::Rewards), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorCurrentRewardsRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = map_.next_value()?; + } + } + } + Ok(ValidatorCurrentRewardsRecord { + validator_address: validator_address__.unwrap_or_default(), + rewards: rewards__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorHistoricalRewards { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.cumulative_reward_ratio.is_empty() { + len += 1; + } + if self.reference_count != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + len, + )?; + if !self.cumulative_reward_ratio.is_empty() { + struct_ser.serialize_field("cumulativeRewardRatio", &self.cumulative_reward_ratio)?; + } + if self.reference_count != 0 { + struct_ser.serialize_field("referenceCount", &self.reference_count)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorHistoricalRewards { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "cumulative_reward_ratio", + "cumulativeRewardRatio", + "reference_count", + "referenceCount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CumulativeRewardRatio, + ReferenceCount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "cumulativeRewardRatio" | "cumulative_reward_ratio" => { + Ok(GeneratedField::CumulativeRewardRatio) + } + "referenceCount" | "reference_count" => { + Ok(GeneratedField::ReferenceCount) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorHistoricalRewards; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.ValidatorHistoricalRewards") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut cumulative_reward_ratio__ = None; + let mut reference_count__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CumulativeRewardRatio => { + if cumulative_reward_ratio__.is_some() { + return Err(serde::de::Error::duplicate_field( + "cumulativeRewardRatio", + )); + } + cumulative_reward_ratio__ = Some(map_.next_value()?); + } + GeneratedField::ReferenceCount => { + if reference_count__.is_some() { + return Err(serde::de::Error::duplicate_field("referenceCount")); + } + reference_count__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ValidatorHistoricalRewards { + cumulative_reward_ratio: cumulative_reward_ratio__.unwrap_or_default(), + reference_count: reference_count__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorHistoricalRewardsRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if self.period != 0 { + len += 1; + } + if self.rewards.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if self.period != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("period", ToString::to_string(&self.period).as_str())?; + } + if let Some(v) = self.rewards.as_ref() { + struct_ser.serialize_field("rewards", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorHistoricalRewardsRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_address", "validatorAddress", "period", "rewards"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + Period, + Rewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "period" => Ok(GeneratedField::Period), + "rewards" => Ok(GeneratedField::Rewards), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorHistoricalRewardsRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut period__ = None; + let mut rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Period => { + if period__.is_some() { + return Err(serde::de::Error::duplicate_field("period")); + } + period__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = map_.next_value()?; + } + } + } + Ok(ValidatorHistoricalRewardsRecord { + validator_address: validator_address__.unwrap_or_default(), + period: period__.unwrap_or_default(), + rewards: rewards__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorOutstandingRewards { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rewards.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + len, + )?; + if !self.rewards.is_empty() { + struct_ser.serialize_field("rewards", &self.rewards)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorOutstandingRewards { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["rewards"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rewards" => Ok(GeneratedField::Rewards), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorOutstandingRewards; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.distribution.v1beta1.ValidatorOutstandingRewards") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rewards => { + if rewards__.is_some() { + return Err(serde::de::Error::duplicate_field("rewards")); + } + rewards__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorOutstandingRewards { + rewards: rewards__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorOutstandingRewardsRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if !self.outstanding_rewards.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + len, + )?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if !self.outstanding_rewards.is_empty() { + struct_ser.serialize_field("outstandingRewards", &self.outstanding_rewards)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorOutstandingRewardsRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "validator_address", + "validatorAddress", + "outstanding_rewards", + "outstandingRewards", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + OutstandingRewards, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "outstandingRewards" | "outstanding_rewards" => { + Ok(GeneratedField::OutstandingRewards) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorOutstandingRewardsRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut outstanding_rewards__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::OutstandingRewards => { + if outstanding_rewards__.is_some() { + return Err(serde::de::Error::duplicate_field( + "outstandingRewards", + )); + } + outstanding_rewards__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorOutstandingRewardsRecord { + validator_address: validator_address__.unwrap_or_default(), + outstanding_rewards: outstanding_rewards__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorSlashEvent { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.validator_period != 0 { + len += 1; + } + if !self.fraction.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.ValidatorSlashEvent", len)?; + if self.validator_period != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "validatorPeriod", + ToString::to_string(&self.validator_period).as_str(), + )?; + } + if !self.fraction.is_empty() { + struct_ser.serialize_field("fraction", &self.fraction)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorSlashEvent { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_period", "validatorPeriod", "fraction"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorPeriod, + Fraction, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorPeriod" | "validator_period" => { + Ok(GeneratedField::ValidatorPeriod) + } + "fraction" => Ok(GeneratedField::Fraction), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorSlashEvent; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.ValidatorSlashEvent") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_period__ = None; + let mut fraction__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorPeriod => { + if validator_period__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorPeriod")); + } + validator_period__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Fraction => { + if fraction__.is_some() { + return Err(serde::de::Error::duplicate_field("fraction")); + } + fraction__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorSlashEvent { + validator_period: validator_period__.unwrap_or_default(), + fraction: fraction__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorSlashEvent", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorSlashEventRecord { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_address.is_empty() { + len += 1; + } + if self.height != 0 { + len += 1; + } + if self.period != 0 { + len += 1; + } + if self.validator_slash_event.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.distribution.v1beta1.ValidatorSlashEventRecord", len)?; + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if self.period != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("period", ToString::to_string(&self.period).as_str())?; + } + if let Some(v) = self.validator_slash_event.as_ref() { + struct_ser.serialize_field("validatorSlashEvent", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorSlashEventRecord { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "validator_address", + "validatorAddress", + "height", + "period", + "validator_slash_event", + "validatorSlashEvent", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddress, + Height, + Period, + ValidatorSlashEvent, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "height" => Ok(GeneratedField::Height), + "period" => Ok(GeneratedField::Period), + "validatorSlashEvent" | "validator_slash_event" => { + Ok(GeneratedField::ValidatorSlashEvent) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorSlashEventRecord; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.ValidatorSlashEventRecord") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_address__ = None; + let mut height__ = None; + let mut period__ = None; + let mut validator_slash_event__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Period => { + if period__.is_some() { + return Err(serde::de::Error::duplicate_field("period")); + } + period__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::ValidatorSlashEvent => { + if validator_slash_event__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSlashEvent", + )); + } + validator_slash_event__ = map_.next_value()?; + } + } + } + Ok(ValidatorSlashEventRecord { + validator_address: validator_address__.unwrap_or_default(), + height: height__.unwrap_or_default(), + period: period__.unwrap_or_default(), + validator_slash_event: validator_slash_event__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorSlashEventRecord", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorSlashEvents { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_slash_events.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.distribution.v1beta1.ValidatorSlashEvents", len)?; + if !self.validator_slash_events.is_empty() { + struct_ser.serialize_field("validatorSlashEvents", &self.validator_slash_events)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorSlashEvents { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_slash_events", "validatorSlashEvents"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorSlashEvents, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorSlashEvents" | "validator_slash_events" => { + Ok(GeneratedField::ValidatorSlashEvents) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorSlashEvents; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.distribution.v1beta1.ValidatorSlashEvents") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_slash_events__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorSlashEvents => { + if validator_slash_events__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSlashEvents", + )); + } + validator_slash_events__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorSlashEvents { + validator_slash_events: validator_slash_events__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.distribution.v1beta1.ValidatorSlashEvents", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.rs index 5ef5851a..a5e7f155 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.rs @@ -76,5 +76,6 @@ pub struct MsgSubmitEvidenceResponse { #[prost(bytes = "vec", tag = "4")] pub hash: ::prost::alloc::vec::Vec, } +include!("cosmos.evidence.v1beta1.serde.rs"); include!("cosmos.evidence.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.serde.rs new file mode 100644 index 00000000..356b819f --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.v1beta1.serde.rs @@ -0,0 +1,924 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Equivocation { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + if self.time.is_some() { + len += 1; + } + if self.power != 0 { + len += 1; + } + if !self.consensus_address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.Equivocation", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if let Some(v) = self.time.as_ref() { + struct_ser.serialize_field("time", v)?; + } + if self.power != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("power", ToString::to_string(&self.power).as_str())?; + } + if !self.consensus_address.is_empty() { + struct_ser.serialize_field("consensusAddress", &self.consensus_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Equivocation { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "height", + "time", + "power", + "consensus_address", + "consensusAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + Time, + Power, + ConsensusAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + "time" => Ok(GeneratedField::Time), + "power" => Ok(GeneratedField::Power), + "consensusAddress" | "consensus_address" => { + Ok(GeneratedField::ConsensusAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Equivocation; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.Equivocation") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + let mut time__ = None; + let mut power__ = None; + let mut consensus_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Time => { + if time__.is_some() { + return Err(serde::de::Error::duplicate_field("time")); + } + time__ = map_.next_value()?; + } + GeneratedField::Power => { + if power__.is_some() { + return Err(serde::de::Error::duplicate_field("power")); + } + power__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::ConsensusAddress => { + if consensus_address__.is_some() { + return Err(serde::de::Error::duplicate_field("consensusAddress")); + } + consensus_address__ = Some(map_.next_value()?); + } + } + } + Ok(Equivocation { + height: height__.unwrap_or_default(), + time: time__, + power: power__.unwrap_or_default(), + consensus_address: consensus_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.Equivocation", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.evidence.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.GenesisState", len)?; + if !self.evidence.is_empty() { + struct_ser.serialize_field("evidence", &self.evidence)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["evidence"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Evidence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "evidence" => Ok(GeneratedField::Evidence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut evidence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Evidence => { + if evidence__.is_some() { + return Err(serde::de::Error::duplicate_field("evidence")); + } + evidence__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + evidence: evidence__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitEvidence { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.submitter.is_empty() { + len += 1; + } + if self.evidence.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.MsgSubmitEvidence", len)?; + if !self.submitter.is_empty() { + struct_ser.serialize_field("submitter", &self.submitter)?; + } + if let Some(v) = self.evidence.as_ref() { + struct_ser.serialize_field("evidence", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitEvidence { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["submitter", "evidence"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Submitter, + Evidence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "submitter" => Ok(GeneratedField::Submitter), + "evidence" => Ok(GeneratedField::Evidence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitEvidence; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.MsgSubmitEvidence") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut submitter__ = None; + let mut evidence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Submitter => { + if submitter__.is_some() { + return Err(serde::de::Error::duplicate_field("submitter")); + } + submitter__ = Some(map_.next_value()?); + } + GeneratedField::Evidence => { + if evidence__.is_some() { + return Err(serde::de::Error::duplicate_field("evidence")); + } + evidence__ = map_.next_value()?; + } + } + } + Ok(MsgSubmitEvidence { + submitter: submitter__.unwrap_or_default(), + evidence: evidence__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.MsgSubmitEvidence", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitEvidenceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.hash.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", len)?; + if !self.hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("hash", pbjson::private::base64::encode(&self.hash).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitEvidenceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["hash"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Hash, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "hash" => Ok(GeneratedField::Hash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitEvidenceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut hash__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgSubmitEvidenceResponse { + hash: hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllEvidenceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.QueryAllEvidenceRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllEvidenceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllEvidenceRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.QueryAllEvidenceRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllEvidenceRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.QueryAllEvidenceRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllEvidenceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.evidence.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.QueryAllEvidenceResponse", len)?; + if !self.evidence.is_empty() { + struct_ser.serialize_field("evidence", &self.evidence)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllEvidenceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["evidence", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Evidence, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "evidence" => Ok(GeneratedField::Evidence), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllEvidenceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.QueryAllEvidenceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut evidence__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Evidence => { + if evidence__.is_some() { + return Err(serde::de::Error::duplicate_field("evidence")); + } + evidence__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllEvidenceResponse { + evidence: evidence__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.QueryAllEvidenceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryEvidenceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.evidence_hash.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.QueryEvidenceRequest", len)?; + if !self.evidence_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "evidenceHash", + pbjson::private::base64::encode(&self.evidence_hash).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryEvidenceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["evidence_hash", "evidenceHash"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + EvidenceHash, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "evidenceHash" | "evidence_hash" => Ok(GeneratedField::EvidenceHash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryEvidenceRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.QueryEvidenceRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut evidence_hash__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::EvidenceHash => { + if evidence_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("evidenceHash")); + } + evidence_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryEvidenceRequest { + evidence_hash: evidence_hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.QueryEvidenceRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryEvidenceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.evidence.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.evidence.v1beta1.QueryEvidenceResponse", len)?; + if let Some(v) = self.evidence.as_ref() { + struct_ser.serialize_field("evidence", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryEvidenceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["evidence"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Evidence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "evidence" => Ok(GeneratedField::Evidence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryEvidenceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.evidence.v1beta1.QueryEvidenceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut evidence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Evidence => { + if evidence__.is_some() { + return Err(serde::de::Error::duplicate_field("evidence")); + } + evidence__ = map_.next_value()?; + } + } + } + Ok(QueryEvidenceResponse { + evidence: evidence__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.evidence.v1beta1.QueryEvidenceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.rs index 03a750c9..900fb480 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.rs @@ -169,5 +169,6 @@ pub struct MsgRevokeAllowance { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgRevokeAllowanceResponse {} +include!("cosmos.feegrant.v1beta1.serde.rs"); include!("cosmos.feegrant.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.serde.rs new file mode 100644 index 00000000..1d1bcf08 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.v1beta1.serde.rs @@ -0,0 +1,1755 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AllowedMsgAllowance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.allowance.is_some() { + len += 1; + } + if !self.allowed_messages.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.AllowedMsgAllowance", len)?; + if let Some(v) = self.allowance.as_ref() { + struct_ser.serialize_field("allowance", v)?; + } + if !self.allowed_messages.is_empty() { + struct_ser.serialize_field("allowedMessages", &self.allowed_messages)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AllowedMsgAllowance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["allowance", "allowed_messages", "allowedMessages"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Allowance, + AllowedMessages, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "allowance" => Ok(GeneratedField::Allowance), + "allowedMessages" | "allowed_messages" => { + Ok(GeneratedField::AllowedMessages) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AllowedMsgAllowance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.AllowedMsgAllowance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut allowance__ = None; + let mut allowed_messages__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Allowance => { + if allowance__.is_some() { + return Err(serde::de::Error::duplicate_field("allowance")); + } + allowance__ = map_.next_value()?; + } + GeneratedField::AllowedMessages => { + if allowed_messages__.is_some() { + return Err(serde::de::Error::duplicate_field("allowedMessages")); + } + allowed_messages__ = Some(map_.next_value()?); + } + } + } + Ok(AllowedMsgAllowance { + allowance: allowance__, + allowed_messages: allowed_messages__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.AllowedMsgAllowance", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BasicAllowance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.spend_limit.is_empty() { + len += 1; + } + if self.expiration.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.BasicAllowance", len)?; + if !self.spend_limit.is_empty() { + struct_ser.serialize_field("spendLimit", &self.spend_limit)?; + } + if let Some(v) = self.expiration.as_ref() { + struct_ser.serialize_field("expiration", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BasicAllowance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["spend_limit", "spendLimit", "expiration"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SpendLimit, + Expiration, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "spendLimit" | "spend_limit" => Ok(GeneratedField::SpendLimit), + "expiration" => Ok(GeneratedField::Expiration), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BasicAllowance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.BasicAllowance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut spend_limit__ = None; + let mut expiration__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SpendLimit => { + if spend_limit__.is_some() { + return Err(serde::de::Error::duplicate_field("spendLimit")); + } + spend_limit__ = Some(map_.next_value()?); + } + GeneratedField::Expiration => { + if expiration__.is_some() { + return Err(serde::de::Error::duplicate_field("expiration")); + } + expiration__ = map_.next_value()?; + } + } + } + Ok(BasicAllowance { + spend_limit: spend_limit__.unwrap_or_default(), + expiration: expiration__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.BasicAllowance", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.allowances.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.GenesisState", len)?; + if !self.allowances.is_empty() { + struct_ser.serialize_field("allowances", &self.allowances)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["allowances"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Allowances, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "allowances" => Ok(GeneratedField::Allowances), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut allowances__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Allowances => { + if allowances__.is_some() { + return Err(serde::de::Error::duplicate_field("allowances")); + } + allowances__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + allowances: allowances__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Grant { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if self.allowance.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.feegrant.v1beta1.Grant", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.allowance.as_ref() { + struct_ser.serialize_field("allowance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Grant { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee", "allowance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + Allowance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "allowance" => Ok(GeneratedField::Allowance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Grant; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.Grant") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut allowance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Allowance => { + if allowance__.is_some() { + return Err(serde::de::Error::duplicate_field("allowance")); + } + allowance__ = map_.next_value()?; + } + } + } + Ok(Grant { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + allowance: allowance__, + }) + } + } + deserializer.deserialize_struct("cosmos.feegrant.v1beta1.Grant", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgGrantAllowance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + if self.allowance.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.MsgGrantAllowance", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.allowance.as_ref() { + struct_ser.serialize_field("allowance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgGrantAllowance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee", "allowance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + Allowance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + "allowance" => Ok(GeneratedField::Allowance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgGrantAllowance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.MsgGrantAllowance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + let mut allowance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Allowance => { + if allowance__.is_some() { + return Err(serde::de::Error::duplicate_field("allowance")); + } + allowance__ = map_.next_value()?; + } + } + } + Ok(MsgGrantAllowance { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + allowance: allowance__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.MsgGrantAllowance", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgGrantAllowanceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgGrantAllowanceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgGrantAllowanceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgGrantAllowanceResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgRevokeAllowance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.MsgRevokeAllowance", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgRevokeAllowance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgRevokeAllowance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.MsgRevokeAllowance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + } + } + Ok(MsgRevokeAllowance { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.MsgRevokeAllowance", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgRevokeAllowanceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgRevokeAllowanceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgRevokeAllowanceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgRevokeAllowanceResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PeriodicAllowance { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.basic.is_some() { + len += 1; + } + if self.period.is_some() { + len += 1; + } + if !self.period_spend_limit.is_empty() { + len += 1; + } + if !self.period_can_spend.is_empty() { + len += 1; + } + if self.period_reset.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.PeriodicAllowance", len)?; + if let Some(v) = self.basic.as_ref() { + struct_ser.serialize_field("basic", v)?; + } + if let Some(v) = self.period.as_ref() { + struct_ser.serialize_field("period", v)?; + } + if !self.period_spend_limit.is_empty() { + struct_ser.serialize_field("periodSpendLimit", &self.period_spend_limit)?; + } + if !self.period_can_spend.is_empty() { + struct_ser.serialize_field("periodCanSpend", &self.period_can_spend)?; + } + if let Some(v) = self.period_reset.as_ref() { + struct_ser.serialize_field("periodReset", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PeriodicAllowance { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "basic", + "period", + "period_spend_limit", + "periodSpendLimit", + "period_can_spend", + "periodCanSpend", + "period_reset", + "periodReset", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Basic, + Period, + PeriodSpendLimit, + PeriodCanSpend, + PeriodReset, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "basic" => Ok(GeneratedField::Basic), + "period" => Ok(GeneratedField::Period), + "periodSpendLimit" | "period_spend_limit" => { + Ok(GeneratedField::PeriodSpendLimit) + } + "periodCanSpend" | "period_can_spend" => { + Ok(GeneratedField::PeriodCanSpend) + } + "periodReset" | "period_reset" => Ok(GeneratedField::PeriodReset), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PeriodicAllowance; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.PeriodicAllowance") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut basic__ = None; + let mut period__ = None; + let mut period_spend_limit__ = None; + let mut period_can_spend__ = None; + let mut period_reset__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Basic => { + if basic__.is_some() { + return Err(serde::de::Error::duplicate_field("basic")); + } + basic__ = map_.next_value()?; + } + GeneratedField::Period => { + if period__.is_some() { + return Err(serde::de::Error::duplicate_field("period")); + } + period__ = map_.next_value()?; + } + GeneratedField::PeriodSpendLimit => { + if period_spend_limit__.is_some() { + return Err(serde::de::Error::duplicate_field("periodSpendLimit")); + } + period_spend_limit__ = Some(map_.next_value()?); + } + GeneratedField::PeriodCanSpend => { + if period_can_spend__.is_some() { + return Err(serde::de::Error::duplicate_field("periodCanSpend")); + } + period_can_spend__ = Some(map_.next_value()?); + } + GeneratedField::PeriodReset => { + if period_reset__.is_some() { + return Err(serde::de::Error::duplicate_field("periodReset")); + } + period_reset__ = map_.next_value()?; + } + } + } + Ok(PeriodicAllowance { + basic: basic__, + period: period__, + period_spend_limit: period_spend_limit__.unwrap_or_default(), + period_can_spend: period_can_spend__.unwrap_or_default(), + period_reset: period_reset__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.PeriodicAllowance", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowanceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if !self.grantee.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.QueryAllowanceRequest", len)?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowanceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "grantee"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Grantee, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "grantee" => Ok(GeneratedField::Grantee), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowanceRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.QueryAllowanceRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut grantee__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + } + } + Ok(QueryAllowanceRequest { + granter: granter__.unwrap_or_default(), + grantee: grantee__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowanceRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowanceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.allowance.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.QueryAllowanceResponse", len)?; + if let Some(v) = self.allowance.as_ref() { + struct_ser.serialize_field("allowance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowanceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["allowance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Allowance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "allowance" => Ok(GeneratedField::Allowance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowanceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.QueryAllowanceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut allowance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Allowance => { + if allowance__.is_some() { + return Err(serde::de::Error::duplicate_field("allowance")); + } + allowance__ = map_.next_value()?; + } + } + } + Ok(QueryAllowanceResponse { + allowance: allowance__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowanceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowancesByGranterRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.granter.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + len, + )?; + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowancesByGranterRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["granter", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Granter, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "granter" => Ok(GeneratedField::Granter), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowancesByGranterRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut granter__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllowancesByGranterRequest { + granter: granter__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowancesByGranterResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.allowances.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + len, + )?; + if !self.allowances.is_empty() { + struct_ser.serialize_field("allowances", &self.allowances)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowancesByGranterResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["allowances", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Allowances, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "allowances" => Ok(GeneratedField::Allowances), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowancesByGranterResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut allowances__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Allowances => { + if allowances__.is_some() { + return Err(serde::de::Error::duplicate_field("allowances")); + } + allowances__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllowancesByGranterResponse { + allowances: allowances__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowancesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.grantee.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.QueryAllowancesRequest", len)?; + if !self.grantee.is_empty() { + struct_ser.serialize_field("grantee", &self.grantee)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowancesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["grantee", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Grantee, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "grantee" => Ok(GeneratedField::Grantee), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowancesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.QueryAllowancesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut grantee__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Grantee => { + if grantee__.is_some() { + return Err(serde::de::Error::duplicate_field("grantee")); + } + grantee__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllowancesRequest { + grantee: grantee__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllowancesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.allowances.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.feegrant.v1beta1.QueryAllowancesResponse", len)?; + if !self.allowances.is_empty() { + struct_ser.serialize_field("allowances", &self.allowances)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllowancesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["allowances", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Allowances, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "allowances" => Ok(GeneratedField::Allowances), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllowancesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.feegrant.v1beta1.QueryAllowancesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut allowances__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Allowances => { + if allowances__.is_some() { + return Err(serde::de::Error::duplicate_field("allowances")); + } + allowances__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllowancesResponse { + allowances: allowances__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.feegrant.v1beta1.QueryAllowancesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.rs index 254fdd91..5be93326 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.rs @@ -7,4 +7,5 @@ pub struct GenesisState { #[prost(bytes = "vec", repeated, tag = "1")] pub gen_txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } +include!("cosmos.genutil.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.serde.rs new file mode 100644 index 00000000..b4ba04e5 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.serde.rs @@ -0,0 +1,113 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.gen_txs.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.genutil.v1beta1.GenesisState", len)?; + if !self.gen_txs.is_empty() { + struct_ser.serialize_field( + "genTxs", + &self + .gen_txs + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["gen_txs", "genTxs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GenTxs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "genTxs" | "gen_txs" => Ok(GeneratedField::GenTxs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.genutil.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut gen_txs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GenTxs => { + if gen_txs__.is_some() { + return Err(serde::de::Error::duplicate_field("genTxs")); + } + gen_txs__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(GenesisState { + gen_txs: gen_txs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.genutil.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.rs index 7ff33edd..c83db60b 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.rs @@ -480,5 +480,6 @@ pub struct MsgDeposit { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgDepositResponse {} +include!("cosmos.gov.v1.serde.rs"); include!("cosmos.gov.v1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.serde.rs new file mode 100644 index 00000000..b1603129 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1.serde.rs @@ -0,0 +1,4541 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Deposit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.Deposit", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Deposit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Deposit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.Deposit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(Deposit { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.Deposit", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DepositParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.min_deposit.is_empty() { + len += 1; + } + if self.max_deposit_period.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.DepositParams", len)?; + if !self.min_deposit.is_empty() { + struct_ser.serialize_field("minDeposit", &self.min_deposit)?; + } + if let Some(v) = self.max_deposit_period.as_ref() { + struct_ser.serialize_field("maxDepositPeriod", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DepositParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "min_deposit", + "minDeposit", + "max_deposit_period", + "maxDepositPeriod", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MinDeposit, + MaxDepositPeriod, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "minDeposit" | "min_deposit" => Ok(GeneratedField::MinDeposit), + "maxDepositPeriod" | "max_deposit_period" => { + Ok(GeneratedField::MaxDepositPeriod) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DepositParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.DepositParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut min_deposit__ = None; + let mut max_deposit_period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MinDeposit => { + if min_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("minDeposit")); + } + min_deposit__ = Some(map_.next_value()?); + } + GeneratedField::MaxDepositPeriod => { + if max_deposit_period__.is_some() { + return Err(serde::de::Error::duplicate_field("maxDepositPeriod")); + } + max_deposit_period__ = map_.next_value()?; + } + } + } + Ok(DepositParams { + min_deposit: min_deposit__.unwrap_or_default(), + max_deposit_period: max_deposit_period__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.DepositParams", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.starting_proposal_id != 0 { + len += 1; + } + if !self.deposits.is_empty() { + len += 1; + } + if !self.votes.is_empty() { + len += 1; + } + if !self.proposals.is_empty() { + len += 1; + } + if self.deposit_params.is_some() { + len += 1; + } + if self.voting_params.is_some() { + len += 1; + } + if self.tally_params.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.GenesisState", len)?; + if self.starting_proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "startingProposalId", + ToString::to_string(&self.starting_proposal_id).as_str(), + )?; + } + if !self.deposits.is_empty() { + struct_ser.serialize_field("deposits", &self.deposits)?; + } + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if let Some(v) = self.deposit_params.as_ref() { + struct_ser.serialize_field("depositParams", v)?; + } + if let Some(v) = self.voting_params.as_ref() { + struct_ser.serialize_field("votingParams", v)?; + } + if let Some(v) = self.tally_params.as_ref() { + struct_ser.serialize_field("tallyParams", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "starting_proposal_id", + "startingProposalId", + "deposits", + "votes", + "proposals", + "deposit_params", + "depositParams", + "voting_params", + "votingParams", + "tally_params", + "tallyParams", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StartingProposalId, + Deposits, + Votes, + Proposals, + DepositParams, + VotingParams, + TallyParams, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "startingProposalId" | "starting_proposal_id" => { + Ok(GeneratedField::StartingProposalId) + } + "deposits" => Ok(GeneratedField::Deposits), + "votes" => Ok(GeneratedField::Votes), + "proposals" => Ok(GeneratedField::Proposals), + "depositParams" | "deposit_params" => Ok(GeneratedField::DepositParams), + "votingParams" | "voting_params" => Ok(GeneratedField::VotingParams), + "tallyParams" | "tally_params" => Ok(GeneratedField::TallyParams), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut starting_proposal_id__ = None; + let mut deposits__ = None; + let mut votes__ = None; + let mut proposals__ = None; + let mut deposit_params__ = None; + let mut voting_params__ = None; + let mut tally_params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StartingProposalId => { + if starting_proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field( + "startingProposalId", + )); + } + starting_proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Deposits => { + if deposits__.is_some() { + return Err(serde::de::Error::duplicate_field("deposits")); + } + deposits__ = Some(map_.next_value()?); + } + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::DepositParams => { + if deposit_params__.is_some() { + return Err(serde::de::Error::duplicate_field("depositParams")); + } + deposit_params__ = map_.next_value()?; + } + GeneratedField::VotingParams => { + if voting_params__.is_some() { + return Err(serde::de::Error::duplicate_field("votingParams")); + } + voting_params__ = map_.next_value()?; + } + GeneratedField::TallyParams => { + if tally_params__.is_some() { + return Err(serde::de::Error::duplicate_field("tallyParams")); + } + tally_params__ = map_.next_value()?; + } + } + } + Ok(GenesisState { + starting_proposal_id: starting_proposal_id__.unwrap_or_default(), + deposits: deposits__.unwrap_or_default(), + votes: votes__.unwrap_or_default(), + proposals: proposals__.unwrap_or_default(), + deposit_params: deposit_params__, + voting_params: voting_params__, + tally_params: tally_params__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.GenesisState", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDeposit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgDeposit", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDeposit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDeposit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgDeposit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgDeposit { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.MsgDeposit", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDepositResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgDepositResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDepositResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDepositResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgDepositResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgDepositResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.MsgDepositResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecLegacyContent { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.content.is_some() { + len += 1; + } + if !self.authority.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.MsgExecLegacyContent", len)?; + if let Some(v) = self.content.as_ref() { + struct_ser.serialize_field("content", v)?; + } + if !self.authority.is_empty() { + struct_ser.serialize_field("authority", &self.authority)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecLegacyContent { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["content", "authority"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Content, + Authority, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "content" => Ok(GeneratedField::Content), + "authority" => Ok(GeneratedField::Authority), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecLegacyContent; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgExecLegacyContent") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut content__ = None; + let mut authority__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Content => { + if content__.is_some() { + return Err(serde::de::Error::duplicate_field("content")); + } + content__ = map_.next_value()?; + } + GeneratedField::Authority => { + if authority__.is_some() { + return Err(serde::de::Error::duplicate_field("authority")); + } + authority__ = Some(map_.next_value()?); + } + } + } + Ok(MsgExecLegacyContent { + content: content__, + authority: authority__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.MsgExecLegacyContent", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecLegacyContentResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.gov.v1.MsgExecLegacyContentResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecLegacyContentResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecLegacyContentResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgExecLegacyContentResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgExecLegacyContentResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.MsgExecLegacyContentResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.messages.is_empty() { + len += 1; + } + if !self.initial_deposit.is_empty() { + len += 1; + } + if !self.proposer.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgSubmitProposal", len)?; + if !self.messages.is_empty() { + struct_ser.serialize_field("messages", &self.messages)?; + } + if !self.initial_deposit.is_empty() { + struct_ser.serialize_field("initialDeposit", &self.initial_deposit)?; + } + if !self.proposer.is_empty() { + struct_ser.serialize_field("proposer", &self.proposer)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "messages", + "initial_deposit", + "initialDeposit", + "proposer", + "metadata", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Messages, + InitialDeposit, + Proposer, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "messages" => Ok(GeneratedField::Messages), + "initialDeposit" | "initial_deposit" => { + Ok(GeneratedField::InitialDeposit) + } + "proposer" => Ok(GeneratedField::Proposer), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgSubmitProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut messages__ = None; + let mut initial_deposit__ = None; + let mut proposer__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Messages => { + if messages__.is_some() { + return Err(serde::de::Error::duplicate_field("messages")); + } + messages__ = Some(map_.next_value()?); + } + GeneratedField::InitialDeposit => { + if initial_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("initialDeposit")); + } + initial_deposit__ = Some(map_.next_value()?); + } + GeneratedField::Proposer => { + if proposer__.is_some() { + return Err(serde::de::Error::duplicate_field("proposer")); + } + proposer__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgSubmitProposal { + messages: messages__.unwrap_or_default(), + initial_deposit: initial_deposit__.unwrap_or_default(), + proposer: proposer__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.MsgSubmitProposal", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.MsgSubmitProposalResponse", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgSubmitProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgSubmitProposalResponse { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.MsgSubmitProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if self.option != 0 { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgVote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "option", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Option, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "option" => Ok(GeneratedField::Option), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgVote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut option__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgVote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + option: option__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.MsgVote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgVoteResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgVoteResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVoteResponse {}) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.MsgVoteResponse", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteWeighted { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if !self.options.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.MsgVoteWeighted", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if !self.options.is_empty() { + struct_ser.serialize_field("options", &self.options)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteWeighted { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "options", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Options, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "options" => Ok(GeneratedField::Options), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteWeighted; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgVoteWeighted") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut options__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Options => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); + } + options__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgVoteWeighted { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + options: options__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.MsgVoteWeighted", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteWeightedResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.gov.v1.MsgVoteWeightedResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteWeightedResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteWeightedResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.MsgVoteWeightedResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVoteWeightedResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.MsgVoteWeightedResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Proposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + if !self.messages.is_empty() { + len += 1; + } + if self.status != 0 { + len += 1; + } + if self.final_tally_result.is_some() { + len += 1; + } + if self.submit_time.is_some() { + len += 1; + } + if self.deposit_end_time.is_some() { + len += 1; + } + if !self.total_deposit.is_empty() { + len += 1; + } + if self.voting_start_time.is_some() { + len += 1; + } + if self.voting_end_time.is_some() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.Proposal", len)?; + if self.id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; + } + if !self.messages.is_empty() { + struct_ser.serialize_field("messages", &self.messages)?; + } + if self.status != 0 { + let v = ProposalStatus::try_from(self.status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.status)) + })?; + struct_ser.serialize_field("status", &v)?; + } + if let Some(v) = self.final_tally_result.as_ref() { + struct_ser.serialize_field("finalTallyResult", v)?; + } + if let Some(v) = self.submit_time.as_ref() { + struct_ser.serialize_field("submitTime", v)?; + } + if let Some(v) = self.deposit_end_time.as_ref() { + struct_ser.serialize_field("depositEndTime", v)?; + } + if !self.total_deposit.is_empty() { + struct_ser.serialize_field("totalDeposit", &self.total_deposit)?; + } + if let Some(v) = self.voting_start_time.as_ref() { + struct_ser.serialize_field("votingStartTime", v)?; + } + if let Some(v) = self.voting_end_time.as_ref() { + struct_ser.serialize_field("votingEndTime", v)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Proposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "messages", + "status", + "final_tally_result", + "finalTallyResult", + "submit_time", + "submitTime", + "deposit_end_time", + "depositEndTime", + "total_deposit", + "totalDeposit", + "voting_start_time", + "votingStartTime", + "voting_end_time", + "votingEndTime", + "metadata", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + Messages, + Status, + FinalTallyResult, + SubmitTime, + DepositEndTime, + TotalDeposit, + VotingStartTime, + VotingEndTime, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "messages" => Ok(GeneratedField::Messages), + "status" => Ok(GeneratedField::Status), + "finalTallyResult" | "final_tally_result" => { + Ok(GeneratedField::FinalTallyResult) + } + "submitTime" | "submit_time" => Ok(GeneratedField::SubmitTime), + "depositEndTime" | "deposit_end_time" => { + Ok(GeneratedField::DepositEndTime) + } + "totalDeposit" | "total_deposit" => Ok(GeneratedField::TotalDeposit), + "votingStartTime" | "voting_start_time" => { + Ok(GeneratedField::VotingStartTime) + } + "votingEndTime" | "voting_end_time" => { + Ok(GeneratedField::VotingEndTime) + } + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Proposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.Proposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut messages__ = None; + let mut status__ = None; + let mut final_tally_result__ = None; + let mut submit_time__ = None; + let mut deposit_end_time__ = None; + let mut total_deposit__ = None; + let mut voting_start_time__ = None; + let mut voting_end_time__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Messages => { + if messages__.is_some() { + return Err(serde::de::Error::duplicate_field("messages")); + } + messages__ = Some(map_.next_value()?); + } + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::FinalTallyResult => { + if final_tally_result__.is_some() { + return Err(serde::de::Error::duplicate_field("finalTallyResult")); + } + final_tally_result__ = map_.next_value()?; + } + GeneratedField::SubmitTime => { + if submit_time__.is_some() { + return Err(serde::de::Error::duplicate_field("submitTime")); + } + submit_time__ = map_.next_value()?; + } + GeneratedField::DepositEndTime => { + if deposit_end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("depositEndTime")); + } + deposit_end_time__ = map_.next_value()?; + } + GeneratedField::TotalDeposit => { + if total_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("totalDeposit")); + } + total_deposit__ = Some(map_.next_value()?); + } + GeneratedField::VotingStartTime => { + if voting_start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("votingStartTime")); + } + voting_start_time__ = map_.next_value()?; + } + GeneratedField::VotingEndTime => { + if voting_end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("votingEndTime")); + } + voting_end_time__ = map_.next_value()?; + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(Proposal { + id: id__.unwrap_or_default(), + messages: messages__.unwrap_or_default(), + status: status__.unwrap_or_default(), + final_tally_result: final_tally_result__, + submit_time: submit_time__, + deposit_end_time: deposit_end_time__, + total_deposit: total_deposit__.unwrap_or_default(), + voting_start_time: voting_start_time__, + voting_end_time: voting_end_time__, + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.Proposal", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProposalStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", + Self::DepositPeriod => "PROPOSAL_STATUS_DEPOSIT_PERIOD", + Self::VotingPeriod => "PROPOSAL_STATUS_VOTING_PERIOD", + Self::Passed => "PROPOSAL_STATUS_PASSED", + Self::Rejected => "PROPOSAL_STATUS_REJECTED", + Self::Failed => "PROPOSAL_STATUS_FAILED", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProposalStatus { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "PROPOSAL_STATUS_UNSPECIFIED", + "PROPOSAL_STATUS_DEPOSIT_PERIOD", + "PROPOSAL_STATUS_VOTING_PERIOD", + "PROPOSAL_STATUS_PASSED", + "PROPOSAL_STATUS_REJECTED", + "PROPOSAL_STATUS_FAILED", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProposalStatus; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "PROPOSAL_STATUS_UNSPECIFIED" => Ok(ProposalStatus::Unspecified), + "PROPOSAL_STATUS_DEPOSIT_PERIOD" => Ok(ProposalStatus::DepositPeriod), + "PROPOSAL_STATUS_VOTING_PERIOD" => Ok(ProposalStatus::VotingPeriod), + "PROPOSAL_STATUS_PASSED" => Ok(ProposalStatus::Passed), + "PROPOSAL_STATUS_REJECTED" => Ok(ProposalStatus::Rejected), + "PROPOSAL_STATUS_FAILED" => Ok(ProposalStatus::Failed), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryDepositRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryDepositRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDepositRequest { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryDepositRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.deposit.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryDepositResponse", len)?; + if let Some(v) = self.deposit.as_ref() { + struct_ser.serialize_field("deposit", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["deposit"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Deposit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "deposit" => Ok(GeneratedField::Deposit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryDepositResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut deposit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Deposit => { + if deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("deposit")); + } + deposit__ = map_.next_value()?; + } + } + } + Ok(QueryDepositResponse { deposit: deposit__ }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryDepositResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryDepositsRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryDepositsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDepositsRequest { + proposal_id: proposal_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryDepositsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.deposits.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryDepositsResponse", len)?; + if !self.deposits.is_empty() { + struct_ser.serialize_field("deposits", &self.deposits)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["deposits", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Deposits, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "deposits" => Ok(GeneratedField::Deposits), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryDepositsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut deposits__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Deposits => { + if deposits__.is_some() { + return Err(serde::de::Error::duplicate_field("deposits")); + } + deposits__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDepositsResponse { + deposits: deposits__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryDepositsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.params_type.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryParamsRequest", len)?; + if !self.params_type.is_empty() { + struct_ser.serialize_field("paramsType", &self.params_type)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params_type", "paramsType"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ParamsType, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "paramsType" | "params_type" => Ok(GeneratedField::ParamsType), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params_type__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ParamsType => { + if params_type__.is_some() { + return Err(serde::de::Error::duplicate_field("paramsType")); + } + params_type__ = Some(map_.next_value()?); + } + } + } + Ok(QueryParamsRequest { + params_type: params_type__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.voting_params.is_some() { + len += 1; + } + if self.deposit_params.is_some() { + len += 1; + } + if self.tally_params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryParamsResponse", len)?; + if let Some(v) = self.voting_params.as_ref() { + struct_ser.serialize_field("votingParams", v)?; + } + if let Some(v) = self.deposit_params.as_ref() { + struct_ser.serialize_field("depositParams", v)?; + } + if let Some(v) = self.tally_params.as_ref() { + struct_ser.serialize_field("tallyParams", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "voting_params", + "votingParams", + "deposit_params", + "depositParams", + "tally_params", + "tallyParams", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + VotingParams, + DepositParams, + TallyParams, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votingParams" | "voting_params" => Ok(GeneratedField::VotingParams), + "depositParams" | "deposit_params" => Ok(GeneratedField::DepositParams), + "tallyParams" | "tally_params" => Ok(GeneratedField::TallyParams), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voting_params__ = None; + let mut deposit_params__ = None; + let mut tally_params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::VotingParams => { + if voting_params__.is_some() { + return Err(serde::de::Error::duplicate_field("votingParams")); + } + voting_params__ = map_.next_value()?; + } + GeneratedField::DepositParams => { + if deposit_params__.is_some() { + return Err(serde::de::Error::duplicate_field("depositParams")); + } + deposit_params__ = map_.next_value()?; + } + GeneratedField::TallyParams => { + if tally_params__.is_some() { + return Err(serde::de::Error::duplicate_field("tallyParams")); + } + tally_params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { + voting_params: voting_params__, + deposit_params: deposit_params__, + tally_params: tally_params__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryProposalRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryProposalRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryProposalRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryProposalRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryProposalResponse", len)?; + if let Some(v) = self.proposal.as_ref() { + struct_ser.serialize_field("proposal", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposal, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposal" => Ok(GeneratedField::Proposal), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposal => { + if proposal__.is_some() { + return Err(serde::de::Error::duplicate_field("proposal")); + } + proposal__ = map_.next_value()?; + } + } + } + Ok(QueryProposalResponse { + proposal: proposal__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_status != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryProposalsRequest", len)?; + if self.proposal_status != 0 { + let v = ProposalStatus::try_from(self.proposal_status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.proposal_status)) + })?; + struct_ser.serialize_field("proposalStatus", &v)?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_status", + "proposalStatus", + "voter", + "depositor", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalStatus, + Voter, + Depositor, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalStatus" | "proposal_status" => { + Ok(GeneratedField::ProposalStatus) + } + "voter" => Ok(GeneratedField::Voter), + "depositor" => Ok(GeneratedField::Depositor), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryProposalsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_status__ = None; + let mut voter__ = None; + let mut depositor__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalStatus => { + if proposal_status__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalStatus")); + } + proposal_status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsRequest { + proposal_status: proposal_status__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryProposalsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.proposals.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryProposalsResponse", len)?; + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposals", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposals, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposals" => Ok(GeneratedField::Proposals), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryProposalsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposals__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsResponse { + proposals: proposals__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryProposalsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryTallyResultRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryTallyResultRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryTallyResultRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryTallyResultRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tally.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryTallyResultResponse", len)?; + if let Some(v) = self.tally.as_ref() { + struct_ser.serialize_field("tally", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tally"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tally, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tally" => Ok(GeneratedField::Tally), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryTallyResultResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tally__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tally => { + if tally__.is_some() { + return Err(serde::de::Error::duplicate_field("tally")); + } + tally__ = map_.next_value()?; + } + } + } + Ok(QueryTallyResultResponse { tally: tally__ }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryTallyResultResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.QueryVoteRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryVoteRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + } + } + Ok(QueryVoteRequest { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.QueryVoteRequest", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.vote.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.QueryVoteResponse", len)?; + if let Some(v) = self.vote.as_ref() { + struct_ser.serialize_field("vote", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["vote"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Vote, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "vote" => Ok(GeneratedField::Vote), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryVoteResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut vote__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Vote => { + if vote__.is_some() { + return Err(serde::de::Error::duplicate_field("vote")); + } + vote__ = map_.next_value()?; + } + } + } + Ok(QueryVoteResponse { vote: vote__ }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.QueryVoteResponse", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.QueryVotesRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryVotesRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesRequest { + proposal_id: proposal_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.QueryVotesRequest", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.votes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.QueryVotesResponse", len)?; + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["votes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Votes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votes" => Ok(GeneratedField::Votes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.QueryVotesResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut votes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesResponse { + votes: votes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.QueryVotesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TallyParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.quorum.is_empty() { + len += 1; + } + if !self.threshold.is_empty() { + len += 1; + } + if !self.veto_threshold.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.TallyParams", len)?; + if !self.quorum.is_empty() { + struct_ser.serialize_field("quorum", &self.quorum)?; + } + if !self.threshold.is_empty() { + struct_ser.serialize_field("threshold", &self.threshold)?; + } + if !self.veto_threshold.is_empty() { + struct_ser.serialize_field("vetoThreshold", &self.veto_threshold)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TallyParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["quorum", "threshold", "veto_threshold", "vetoThreshold"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Quorum, + Threshold, + VetoThreshold, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "quorum" => Ok(GeneratedField::Quorum), + "threshold" => Ok(GeneratedField::Threshold), + "vetoThreshold" | "veto_threshold" => Ok(GeneratedField::VetoThreshold), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TallyParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.TallyParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut quorum__ = None; + let mut threshold__ = None; + let mut veto_threshold__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Quorum => { + if quorum__.is_some() { + return Err(serde::de::Error::duplicate_field("quorum")); + } + quorum__ = Some(map_.next_value()?); + } + GeneratedField::Threshold => { + if threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("threshold")); + } + threshold__ = Some(map_.next_value()?); + } + GeneratedField::VetoThreshold => { + if veto_threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("vetoThreshold")); + } + veto_threshold__ = Some(map_.next_value()?); + } + } + } + Ok(TallyParams { + quorum: quorum__.unwrap_or_default(), + threshold: threshold__.unwrap_or_default(), + veto_threshold: veto_threshold__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.TallyParams", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TallyResult { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.yes_count.is_empty() { + len += 1; + } + if !self.abstain_count.is_empty() { + len += 1; + } + if !self.no_count.is_empty() { + len += 1; + } + if !self.no_with_veto_count.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.TallyResult", len)?; + if !self.yes_count.is_empty() { + struct_ser.serialize_field("yesCount", &self.yes_count)?; + } + if !self.abstain_count.is_empty() { + struct_ser.serialize_field("abstainCount", &self.abstain_count)?; + } + if !self.no_count.is_empty() { + struct_ser.serialize_field("noCount", &self.no_count)?; + } + if !self.no_with_veto_count.is_empty() { + struct_ser.serialize_field("noWithVetoCount", &self.no_with_veto_count)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TallyResult { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "yes_count", + "yesCount", + "abstain_count", + "abstainCount", + "no_count", + "noCount", + "no_with_veto_count", + "noWithVetoCount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + YesCount, + AbstainCount, + NoCount, + NoWithVetoCount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "yesCount" | "yes_count" => Ok(GeneratedField::YesCount), + "abstainCount" | "abstain_count" => Ok(GeneratedField::AbstainCount), + "noCount" | "no_count" => Ok(GeneratedField::NoCount), + "noWithVetoCount" | "no_with_veto_count" => { + Ok(GeneratedField::NoWithVetoCount) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TallyResult; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.TallyResult") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut yes_count__ = None; + let mut abstain_count__ = None; + let mut no_count__ = None; + let mut no_with_veto_count__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::YesCount => { + if yes_count__.is_some() { + return Err(serde::de::Error::duplicate_field("yesCount")); + } + yes_count__ = Some(map_.next_value()?); + } + GeneratedField::AbstainCount => { + if abstain_count__.is_some() { + return Err(serde::de::Error::duplicate_field("abstainCount")); + } + abstain_count__ = Some(map_.next_value()?); + } + GeneratedField::NoCount => { + if no_count__.is_some() { + return Err(serde::de::Error::duplicate_field("noCount")); + } + no_count__ = Some(map_.next_value()?); + } + GeneratedField::NoWithVetoCount => { + if no_with_veto_count__.is_some() { + return Err(serde::de::Error::duplicate_field("noWithVetoCount")); + } + no_with_veto_count__ = Some(map_.next_value()?); + } + } + } + Ok(TallyResult { + yes_count: yes_count__.unwrap_or_default(), + abstain_count: abstain_count__.unwrap_or_default(), + no_count: no_count__.unwrap_or_default(), + no_with_veto_count: no_with_veto_count__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.TallyResult", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Vote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if !self.options.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.Vote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if !self.options.is_empty() { + struct_ser.serialize_field("options", &self.options)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Vote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "options", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Options, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "options" => Ok(GeneratedField::Options), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Vote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.Vote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut options__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Options => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); + } + options__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(Vote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + options: options__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.Vote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VoteOption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "VOTE_OPTION_UNSPECIFIED", + Self::Yes => "VOTE_OPTION_YES", + Self::Abstain => "VOTE_OPTION_ABSTAIN", + Self::No => "VOTE_OPTION_NO", + Self::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VoteOption { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "VOTE_OPTION_UNSPECIFIED", + "VOTE_OPTION_YES", + "VOTE_OPTION_ABSTAIN", + "VOTE_OPTION_NO", + "VOTE_OPTION_NO_WITH_VETO", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VoteOption; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "VOTE_OPTION_UNSPECIFIED" => Ok(VoteOption::Unspecified), + "VOTE_OPTION_YES" => Ok(VoteOption::Yes), + "VOTE_OPTION_ABSTAIN" => Ok(VoteOption::Abstain), + "VOTE_OPTION_NO" => Ok(VoteOption::No), + "VOTE_OPTION_NO_WITH_VETO" => Ok(VoteOption::NoWithVeto), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VotingParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.voting_period.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1.VotingParams", len)?; + if let Some(v) = self.voting_period.as_ref() { + struct_ser.serialize_field("votingPeriod", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VotingParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["voting_period", "votingPeriod"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + VotingPeriod, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votingPeriod" | "voting_period" => Ok(GeneratedField::VotingPeriod), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VotingParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.VotingParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voting_period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::VotingPeriod => { + if voting_period__.is_some() { + return Err(serde::de::Error::duplicate_field("votingPeriod")); + } + voting_period__ = map_.next_value()?; + } + } + } + Ok(VotingParams { + voting_period: voting_period__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1.VotingParams", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for WeightedVoteOption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.option != 0 { + len += 1; + } + if !self.weight.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1.WeightedVoteOption", len)?; + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.weight.is_empty() { + struct_ser.serialize_field("weight", &self.weight)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for WeightedVoteOption { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["option", "weight"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Option, + Weight, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "option" => Ok(GeneratedField::Option), + "weight" => Ok(GeneratedField::Weight), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = WeightedVoteOption; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1.WeightedVoteOption") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut option__ = None; + let mut weight__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Weight => { + if weight__.is_some() { + return Err(serde::de::Error::duplicate_field("weight")); + } + weight__ = Some(map_.next_value()?); + } + } + } + Ok(WeightedVoteOption { + option: option__.unwrap_or_default(), + weight: weight__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1.WeightedVoteOption", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.rs index ed1897f5..5a7a808a 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.rs @@ -474,5 +474,6 @@ pub struct MsgDeposit { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgDepositResponse {} +include!("cosmos.gov.v1beta1.serde.rs"); include!("cosmos.gov.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.serde.rs new file mode 100644 index 00000000..e67aaac7 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.v1beta1.serde.rs @@ -0,0 +1,4432 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Deposit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.Deposit", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Deposit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Deposit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.Deposit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(Deposit { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.Deposit", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DepositParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.min_deposit.is_empty() { + len += 1; + } + if self.max_deposit_period.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.DepositParams", len)?; + if !self.min_deposit.is_empty() { + struct_ser.serialize_field("minDeposit", &self.min_deposit)?; + } + if let Some(v) = self.max_deposit_period.as_ref() { + struct_ser.serialize_field("maxDepositPeriod", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DepositParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "min_deposit", + "minDeposit", + "max_deposit_period", + "maxDepositPeriod", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MinDeposit, + MaxDepositPeriod, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "minDeposit" | "min_deposit" => Ok(GeneratedField::MinDeposit), + "maxDepositPeriod" | "max_deposit_period" => { + Ok(GeneratedField::MaxDepositPeriod) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DepositParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.DepositParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut min_deposit__ = None; + let mut max_deposit_period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MinDeposit => { + if min_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("minDeposit")); + } + min_deposit__ = Some(map_.next_value()?); + } + GeneratedField::MaxDepositPeriod => { + if max_deposit_period__.is_some() { + return Err(serde::de::Error::duplicate_field("maxDepositPeriod")); + } + max_deposit_period__ = map_.next_value()?; + } + } + } + Ok(DepositParams { + min_deposit: min_deposit__.unwrap_or_default(), + max_deposit_period: max_deposit_period__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.DepositParams", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.starting_proposal_id != 0 { + len += 1; + } + if !self.deposits.is_empty() { + len += 1; + } + if !self.votes.is_empty() { + len += 1; + } + if !self.proposals.is_empty() { + len += 1; + } + if self.deposit_params.is_some() { + len += 1; + } + if self.voting_params.is_some() { + len += 1; + } + if self.tally_params.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.GenesisState", len)?; + if self.starting_proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "startingProposalId", + ToString::to_string(&self.starting_proposal_id).as_str(), + )?; + } + if !self.deposits.is_empty() { + struct_ser.serialize_field("deposits", &self.deposits)?; + } + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if let Some(v) = self.deposit_params.as_ref() { + struct_ser.serialize_field("depositParams", v)?; + } + if let Some(v) = self.voting_params.as_ref() { + struct_ser.serialize_field("votingParams", v)?; + } + if let Some(v) = self.tally_params.as_ref() { + struct_ser.serialize_field("tallyParams", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "starting_proposal_id", + "startingProposalId", + "deposits", + "votes", + "proposals", + "deposit_params", + "depositParams", + "voting_params", + "votingParams", + "tally_params", + "tallyParams", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StartingProposalId, + Deposits, + Votes, + Proposals, + DepositParams, + VotingParams, + TallyParams, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "startingProposalId" | "starting_proposal_id" => { + Ok(GeneratedField::StartingProposalId) + } + "deposits" => Ok(GeneratedField::Deposits), + "votes" => Ok(GeneratedField::Votes), + "proposals" => Ok(GeneratedField::Proposals), + "depositParams" | "deposit_params" => Ok(GeneratedField::DepositParams), + "votingParams" | "voting_params" => Ok(GeneratedField::VotingParams), + "tallyParams" | "tally_params" => Ok(GeneratedField::TallyParams), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut starting_proposal_id__ = None; + let mut deposits__ = None; + let mut votes__ = None; + let mut proposals__ = None; + let mut deposit_params__ = None; + let mut voting_params__ = None; + let mut tally_params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StartingProposalId => { + if starting_proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field( + "startingProposalId", + )); + } + starting_proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Deposits => { + if deposits__.is_some() { + return Err(serde::de::Error::duplicate_field("deposits")); + } + deposits__ = Some(map_.next_value()?); + } + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::DepositParams => { + if deposit_params__.is_some() { + return Err(serde::de::Error::duplicate_field("depositParams")); + } + deposit_params__ = map_.next_value()?; + } + GeneratedField::VotingParams => { + if voting_params__.is_some() { + return Err(serde::de::Error::duplicate_field("votingParams")); + } + voting_params__ = map_.next_value()?; + } + GeneratedField::TallyParams => { + if tally_params__.is_some() { + return Err(serde::de::Error::duplicate_field("tallyParams")); + } + tally_params__ = map_.next_value()?; + } + } + } + Ok(GenesisState { + starting_proposal_id: starting_proposal_id__.unwrap_or_default(), + deposits: deposits__.unwrap_or_default(), + votes: votes__.unwrap_or_default(), + proposals: proposals__.unwrap_or_default(), + deposit_params: deposit_params__, + voting_params: voting_params__, + tally_params: tally_params__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.GenesisState", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDeposit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.MsgDeposit", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDeposit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDeposit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgDeposit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgDeposit { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.MsgDeposit", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDepositResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.MsgDepositResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDepositResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDepositResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgDepositResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgDepositResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgDepositResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.content.is_some() { + len += 1; + } + if !self.initial_deposit.is_empty() { + len += 1; + } + if !self.proposer.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.MsgSubmitProposal", len)?; + if let Some(v) = self.content.as_ref() { + struct_ser.serialize_field("content", v)?; + } + if !self.initial_deposit.is_empty() { + struct_ser.serialize_field("initialDeposit", &self.initial_deposit)?; + } + if !self.proposer.is_empty() { + struct_ser.serialize_field("proposer", &self.proposer)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["content", "initial_deposit", "initialDeposit", "proposer"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Content, + InitialDeposit, + Proposer, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "content" => Ok(GeneratedField::Content), + "initialDeposit" | "initial_deposit" => { + Ok(GeneratedField::InitialDeposit) + } + "proposer" => Ok(GeneratedField::Proposer), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgSubmitProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut content__ = None; + let mut initial_deposit__ = None; + let mut proposer__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Content => { + if content__.is_some() { + return Err(serde::de::Error::duplicate_field("content")); + } + content__ = map_.next_value()?; + } + GeneratedField::InitialDeposit => { + if initial_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("initialDeposit")); + } + initial_deposit__ = Some(map_.next_value()?); + } + GeneratedField::Proposer => { + if proposer__.is_some() { + return Err(serde::de::Error::duplicate_field("proposer")); + } + proposer__ = Some(map_.next_value()?); + } + } + } + Ok(MsgSubmitProposal { + content: content__, + initial_deposit: initial_deposit__.unwrap_or_default(), + proposer: proposer__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgSubmitProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.MsgSubmitProposalResponse", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgSubmitProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgSubmitProposalResponse { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgSubmitProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if self.option != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.MsgVote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "option"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Option, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "option" => Ok(GeneratedField::Option), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgVote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut option__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(MsgVote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + option: option__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.MsgVote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.MsgVoteResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgVoteResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVoteResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgVoteResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteWeighted { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if !self.options.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.MsgVoteWeighted", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if !self.options.is_empty() { + struct_ser.serialize_field("options", &self.options)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteWeighted { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "options"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Options, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "options" => Ok(GeneratedField::Options), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteWeighted; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgVoteWeighted") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut options__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Options => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); + } + options__ = Some(map_.next_value()?); + } + } + } + Ok(MsgVoteWeighted { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + options: options__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgVoteWeighted", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteWeightedResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.MsgVoteWeightedResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteWeightedResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteWeightedResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.MsgVoteWeightedResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVoteWeightedResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.MsgVoteWeightedResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Proposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.content.is_some() { + len += 1; + } + if self.status != 0 { + len += 1; + } + if self.final_tally_result.is_some() { + len += 1; + } + if self.submit_time.is_some() { + len += 1; + } + if self.deposit_end_time.is_some() { + len += 1; + } + if !self.total_deposit.is_empty() { + len += 1; + } + if self.voting_start_time.is_some() { + len += 1; + } + if self.voting_end_time.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.Proposal", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.content.as_ref() { + struct_ser.serialize_field("content", v)?; + } + if self.status != 0 { + let v = ProposalStatus::try_from(self.status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.status)) + })?; + struct_ser.serialize_field("status", &v)?; + } + if let Some(v) = self.final_tally_result.as_ref() { + struct_ser.serialize_field("finalTallyResult", v)?; + } + if let Some(v) = self.submit_time.as_ref() { + struct_ser.serialize_field("submitTime", v)?; + } + if let Some(v) = self.deposit_end_time.as_ref() { + struct_ser.serialize_field("depositEndTime", v)?; + } + if !self.total_deposit.is_empty() { + struct_ser.serialize_field("totalDeposit", &self.total_deposit)?; + } + if let Some(v) = self.voting_start_time.as_ref() { + struct_ser.serialize_field("votingStartTime", v)?; + } + if let Some(v) = self.voting_end_time.as_ref() { + struct_ser.serialize_field("votingEndTime", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Proposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_id", + "proposalId", + "content", + "status", + "final_tally_result", + "finalTallyResult", + "submit_time", + "submitTime", + "deposit_end_time", + "depositEndTime", + "total_deposit", + "totalDeposit", + "voting_start_time", + "votingStartTime", + "voting_end_time", + "votingEndTime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Content, + Status, + FinalTallyResult, + SubmitTime, + DepositEndTime, + TotalDeposit, + VotingStartTime, + VotingEndTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "content" => Ok(GeneratedField::Content), + "status" => Ok(GeneratedField::Status), + "finalTallyResult" | "final_tally_result" => { + Ok(GeneratedField::FinalTallyResult) + } + "submitTime" | "submit_time" => Ok(GeneratedField::SubmitTime), + "depositEndTime" | "deposit_end_time" => { + Ok(GeneratedField::DepositEndTime) + } + "totalDeposit" | "total_deposit" => Ok(GeneratedField::TotalDeposit), + "votingStartTime" | "voting_start_time" => { + Ok(GeneratedField::VotingStartTime) + } + "votingEndTime" | "voting_end_time" => { + Ok(GeneratedField::VotingEndTime) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Proposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.Proposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut content__ = None; + let mut status__ = None; + let mut final_tally_result__ = None; + let mut submit_time__ = None; + let mut deposit_end_time__ = None; + let mut total_deposit__ = None; + let mut voting_start_time__ = None; + let mut voting_end_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Content => { + if content__.is_some() { + return Err(serde::de::Error::duplicate_field("content")); + } + content__ = map_.next_value()?; + } + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::FinalTallyResult => { + if final_tally_result__.is_some() { + return Err(serde::de::Error::duplicate_field("finalTallyResult")); + } + final_tally_result__ = map_.next_value()?; + } + GeneratedField::SubmitTime => { + if submit_time__.is_some() { + return Err(serde::de::Error::duplicate_field("submitTime")); + } + submit_time__ = map_.next_value()?; + } + GeneratedField::DepositEndTime => { + if deposit_end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("depositEndTime")); + } + deposit_end_time__ = map_.next_value()?; + } + GeneratedField::TotalDeposit => { + if total_deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("totalDeposit")); + } + total_deposit__ = Some(map_.next_value()?); + } + GeneratedField::VotingStartTime => { + if voting_start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("votingStartTime")); + } + voting_start_time__ = map_.next_value()?; + } + GeneratedField::VotingEndTime => { + if voting_end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("votingEndTime")); + } + voting_end_time__ = map_.next_value()?; + } + } + } + Ok(Proposal { + proposal_id: proposal_id__.unwrap_or_default(), + content: content__, + status: status__.unwrap_or_default(), + final_tally_result: final_tally_result__, + submit_time: submit_time__, + deposit_end_time: deposit_end_time__, + total_deposit: total_deposit__.unwrap_or_default(), + voting_start_time: voting_start_time__, + voting_end_time: voting_end_time__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.Proposal", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProposalStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", + Self::DepositPeriod => "PROPOSAL_STATUS_DEPOSIT_PERIOD", + Self::VotingPeriod => "PROPOSAL_STATUS_VOTING_PERIOD", + Self::Passed => "PROPOSAL_STATUS_PASSED", + Self::Rejected => "PROPOSAL_STATUS_REJECTED", + Self::Failed => "PROPOSAL_STATUS_FAILED", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProposalStatus { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "PROPOSAL_STATUS_UNSPECIFIED", + "PROPOSAL_STATUS_DEPOSIT_PERIOD", + "PROPOSAL_STATUS_VOTING_PERIOD", + "PROPOSAL_STATUS_PASSED", + "PROPOSAL_STATUS_REJECTED", + "PROPOSAL_STATUS_FAILED", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProposalStatus; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "PROPOSAL_STATUS_UNSPECIFIED" => Ok(ProposalStatus::Unspecified), + "PROPOSAL_STATUS_DEPOSIT_PERIOD" => Ok(ProposalStatus::DepositPeriod), + "PROPOSAL_STATUS_VOTING_PERIOD" => Ok(ProposalStatus::VotingPeriod), + "PROPOSAL_STATUS_PASSED" => Ok(ProposalStatus::Passed), + "PROPOSAL_STATUS_REJECTED" => Ok(ProposalStatus::Rejected), + "PROPOSAL_STATUS_FAILED" => Ok(ProposalStatus::Failed), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryDepositRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "depositor"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Depositor, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "depositor" => Ok(GeneratedField::Depositor), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryDepositRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut depositor__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDepositRequest { + proposal_id: proposal_id__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryDepositRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.deposit.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryDepositResponse", len)?; + if let Some(v) = self.deposit.as_ref() { + struct_ser.serialize_field("deposit", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["deposit"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Deposit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "deposit" => Ok(GeneratedField::Deposit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryDepositResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut deposit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Deposit => { + if deposit__.is_some() { + return Err(serde::de::Error::duplicate_field("deposit")); + } + deposit__ = map_.next_value()?; + } + } + } + Ok(QueryDepositResponse { deposit: deposit__ }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryDepositResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryDepositsRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryDepositsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDepositsRequest { + proposal_id: proposal_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryDepositsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDepositsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.deposits.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryDepositsResponse", len)?; + if !self.deposits.is_empty() { + struct_ser.serialize_field("deposits", &self.deposits)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDepositsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["deposits", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Deposits, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "deposits" => Ok(GeneratedField::Deposits), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDepositsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryDepositsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut deposits__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Deposits => { + if deposits__.is_some() { + return Err(serde::de::Error::duplicate_field("deposits")); + } + deposits__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDepositsResponse { + deposits: deposits__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryDepositsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.params_type.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryParamsRequest", len)?; + if !self.params_type.is_empty() { + struct_ser.serialize_field("paramsType", &self.params_type)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params_type", "paramsType"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ParamsType, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "paramsType" | "params_type" => Ok(GeneratedField::ParamsType), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params_type__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ParamsType => { + if params_type__.is_some() { + return Err(serde::de::Error::duplicate_field("paramsType")); + } + params_type__ = Some(map_.next_value()?); + } + } + } + Ok(QueryParamsRequest { + params_type: params_type__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.voting_params.is_some() { + len += 1; + } + if self.deposit_params.is_some() { + len += 1; + } + if self.tally_params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.voting_params.as_ref() { + struct_ser.serialize_field("votingParams", v)?; + } + if let Some(v) = self.deposit_params.as_ref() { + struct_ser.serialize_field("depositParams", v)?; + } + if let Some(v) = self.tally_params.as_ref() { + struct_ser.serialize_field("tallyParams", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "voting_params", + "votingParams", + "deposit_params", + "depositParams", + "tally_params", + "tallyParams", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + VotingParams, + DepositParams, + TallyParams, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votingParams" | "voting_params" => Ok(GeneratedField::VotingParams), + "depositParams" | "deposit_params" => Ok(GeneratedField::DepositParams), + "tallyParams" | "tally_params" => Ok(GeneratedField::TallyParams), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voting_params__ = None; + let mut deposit_params__ = None; + let mut tally_params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::VotingParams => { + if voting_params__.is_some() { + return Err(serde::de::Error::duplicate_field("votingParams")); + } + voting_params__ = map_.next_value()?; + } + GeneratedField::DepositParams => { + if deposit_params__.is_some() { + return Err(serde::de::Error::duplicate_field("depositParams")); + } + deposit_params__ = map_.next_value()?; + } + GeneratedField::TallyParams => { + if tally_params__.is_some() { + return Err(serde::de::Error::duplicate_field("tallyParams")); + } + tally_params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { + voting_params: voting_params__, + deposit_params: deposit_params__, + tally_params: tally_params__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryProposalRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryProposalRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryProposalRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryProposalRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryProposalResponse", len)?; + if let Some(v) = self.proposal.as_ref() { + struct_ser.serialize_field("proposal", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposal, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposal" => Ok(GeneratedField::Proposal), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposal => { + if proposal__.is_some() { + return Err(serde::de::Error::duplicate_field("proposal")); + } + proposal__ = map_.next_value()?; + } + } + } + Ok(QueryProposalResponse { + proposal: proposal__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_status != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if !self.depositor.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryProposalsRequest", len)?; + if self.proposal_status != 0 { + let v = ProposalStatus::try_from(self.proposal_status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.proposal_status)) + })?; + struct_ser.serialize_field("proposalStatus", &v)?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if !self.depositor.is_empty() { + struct_ser.serialize_field("depositor", &self.depositor)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_status", + "proposalStatus", + "voter", + "depositor", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalStatus, + Voter, + Depositor, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalStatus" | "proposal_status" => { + Ok(GeneratedField::ProposalStatus) + } + "voter" => Ok(GeneratedField::Voter), + "depositor" => Ok(GeneratedField::Depositor), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryProposalsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_status__ = None; + let mut voter__ = None; + let mut depositor__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalStatus => { + if proposal_status__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalStatus")); + } + proposal_status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Depositor => { + if depositor__.is_some() { + return Err(serde::de::Error::duplicate_field("depositor")); + } + depositor__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsRequest { + proposal_status: proposal_status__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + depositor: depositor__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryProposalsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.proposals.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryProposalsResponse", len)?; + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposals", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposals, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposals" => Ok(GeneratedField::Proposals), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryProposalsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposals__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsResponse { + proposals: proposals__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryProposalsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryTallyResultRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryTallyResultRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryTallyResultRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryTallyResultRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tally.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryTallyResultResponse", len)?; + if let Some(v) = self.tally.as_ref() { + struct_ser.serialize_field("tally", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tally"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tally, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tally" => Ok(GeneratedField::Tally), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryTallyResultResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tally__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tally => { + if tally__.is_some() { + return Err(serde::de::Error::duplicate_field("tally")); + } + tally__ = map_.next_value()?; + } + } + } + Ok(QueryTallyResultResponse { tally: tally__ }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryTallyResultResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryVoteRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryVoteRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + } + } + Ok(QueryVoteRequest { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryVoteRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.vote.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryVoteResponse", len)?; + if let Some(v) = self.vote.as_ref() { + struct_ser.serialize_field("vote", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["vote"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Vote, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "vote" => Ok(GeneratedField::Vote), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryVoteResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut vote__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Vote => { + if vote__.is_some() { + return Err(serde::de::Error::duplicate_field("vote")); + } + vote__ = map_.next_value()?; + } + } + } + Ok(QueryVoteResponse { vote: vote__ }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryVoteResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryVotesRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryVotesRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesRequest { + proposal_id: proposal_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryVotesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.votes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.QueryVotesResponse", len)?; + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["votes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Votes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votes" => Ok(GeneratedField::Votes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.QueryVotesResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut votes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesResponse { + votes: votes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.QueryVotesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TallyParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.quorum.is_empty() { + len += 1; + } + if !self.threshold.is_empty() { + len += 1; + } + if !self.veto_threshold.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.TallyParams", len)?; + if !self.quorum.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "quorum", + pbjson::private::base64::encode(&self.quorum).as_str(), + )?; + } + if !self.threshold.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "threshold", + pbjson::private::base64::encode(&self.threshold).as_str(), + )?; + } + if !self.veto_threshold.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "vetoThreshold", + pbjson::private::base64::encode(&self.veto_threshold).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TallyParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["quorum", "threshold", "veto_threshold", "vetoThreshold"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Quorum, + Threshold, + VetoThreshold, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "quorum" => Ok(GeneratedField::Quorum), + "threshold" => Ok(GeneratedField::Threshold), + "vetoThreshold" | "veto_threshold" => Ok(GeneratedField::VetoThreshold), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TallyParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.TallyParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut quorum__ = None; + let mut threshold__ = None; + let mut veto_threshold__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Quorum => { + if quorum__.is_some() { + return Err(serde::de::Error::duplicate_field("quorum")); + } + quorum__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Threshold => { + if threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("threshold")); + } + threshold__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::VetoThreshold => { + if veto_threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("vetoThreshold")); + } + veto_threshold__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(TallyParams { + quorum: quorum__.unwrap_or_default(), + threshold: threshold__.unwrap_or_default(), + veto_threshold: veto_threshold__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.TallyParams", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TallyResult { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.yes.is_empty() { + len += 1; + } + if !self.abstain.is_empty() { + len += 1; + } + if !self.no.is_empty() { + len += 1; + } + if !self.no_with_veto.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.TallyResult", len)?; + if !self.yes.is_empty() { + struct_ser.serialize_field("yes", &self.yes)?; + } + if !self.abstain.is_empty() { + struct_ser.serialize_field("abstain", &self.abstain)?; + } + if !self.no.is_empty() { + struct_ser.serialize_field("no", &self.no)?; + } + if !self.no_with_veto.is_empty() { + struct_ser.serialize_field("noWithVeto", &self.no_with_veto)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TallyResult { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["yes", "abstain", "no", "no_with_veto", "noWithVeto"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Yes, + Abstain, + No, + NoWithVeto, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "yes" => Ok(GeneratedField::Yes), + "abstain" => Ok(GeneratedField::Abstain), + "no" => Ok(GeneratedField::No), + "noWithVeto" | "no_with_veto" => Ok(GeneratedField::NoWithVeto), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TallyResult; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.TallyResult") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut yes__ = None; + let mut abstain__ = None; + let mut no__ = None; + let mut no_with_veto__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Yes => { + if yes__.is_some() { + return Err(serde::de::Error::duplicate_field("yes")); + } + yes__ = Some(map_.next_value()?); + } + GeneratedField::Abstain => { + if abstain__.is_some() { + return Err(serde::de::Error::duplicate_field("abstain")); + } + abstain__ = Some(map_.next_value()?); + } + GeneratedField::No => { + if no__.is_some() { + return Err(serde::de::Error::duplicate_field("no")); + } + no__ = Some(map_.next_value()?); + } + GeneratedField::NoWithVeto => { + if no_with_veto__.is_some() { + return Err(serde::de::Error::duplicate_field("noWithVeto")); + } + no_with_veto__ = Some(map_.next_value()?); + } + } + } + Ok(TallyResult { + yes: yes__.unwrap_or_default(), + abstain: abstain__.unwrap_or_default(), + no: no__.unwrap_or_default(), + no_with_veto: no_with_veto__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.TallyResult", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TextProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.TextProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TextProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TextProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.TextProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + } + } + Ok(TextProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.TextProposal", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Vote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if self.option != 0 { + len += 1; + } + if !self.options.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.Vote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.options.is_empty() { + struct_ser.serialize_field("options", &self.options)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Vote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter", "option", "options"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Option, + Options, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "option" => Ok(GeneratedField::Option), + "options" => Ok(GeneratedField::Options), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Vote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.Vote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut option__ = None; + let mut options__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Options => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); + } + options__ = Some(map_.next_value()?); + } + } + } + Ok(Vote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + option: option__.unwrap_or_default(), + options: options__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.Vote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VoteOption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "VOTE_OPTION_UNSPECIFIED", + Self::Yes => "VOTE_OPTION_YES", + Self::Abstain => "VOTE_OPTION_ABSTAIN", + Self::No => "VOTE_OPTION_NO", + Self::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VoteOption { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "VOTE_OPTION_UNSPECIFIED", + "VOTE_OPTION_YES", + "VOTE_OPTION_ABSTAIN", + "VOTE_OPTION_NO", + "VOTE_OPTION_NO_WITH_VETO", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VoteOption; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "VOTE_OPTION_UNSPECIFIED" => Ok(VoteOption::Unspecified), + "VOTE_OPTION_YES" => Ok(VoteOption::Yes), + "VOTE_OPTION_ABSTAIN" => Ok(VoteOption::Abstain), + "VOTE_OPTION_NO" => Ok(VoteOption::No), + "VOTE_OPTION_NO_WITH_VETO" => Ok(VoteOption::NoWithVeto), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VotingParams { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.voting_period.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.gov.v1beta1.VotingParams", len)?; + if let Some(v) = self.voting_period.as_ref() { + struct_ser.serialize_field("votingPeriod", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VotingParams { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["voting_period", "votingPeriod"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + VotingPeriod, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votingPeriod" | "voting_period" => Ok(GeneratedField::VotingPeriod), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VotingParams; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.VotingParams") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voting_period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::VotingPeriod => { + if voting_period__.is_some() { + return Err(serde::de::Error::duplicate_field("votingPeriod")); + } + voting_period__ = map_.next_value()?; + } + } + } + Ok(VotingParams { + voting_period: voting_period__, + }) + } + } + deserializer.deserialize_struct("cosmos.gov.v1beta1.VotingParams", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for WeightedVoteOption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.option != 0 { + len += 1; + } + if !self.weight.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.gov.v1beta1.WeightedVoteOption", len)?; + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.weight.is_empty() { + struct_ser.serialize_field("weight", &self.weight)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for WeightedVoteOption { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["option", "weight"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Option, + Weight, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "option" => Ok(GeneratedField::Option), + "weight" => Ok(GeneratedField::Weight), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = WeightedVoteOption; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.gov.v1beta1.WeightedVoteOption") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut option__ = None; + let mut weight__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Weight => { + if weight__.is_some() { + return Err(serde::de::Error::duplicate_field("weight")); + } + weight__ = Some(map_.next_value()?); + } + } + } + Ok(WeightedVoteOption { + option: option__.unwrap_or_default(), + weight: weight__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.gov.v1beta1.WeightedVoteOption", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.rs index d824204b..951b9c0f 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.rs @@ -1128,5 +1128,6 @@ impl Exec { } } } +include!("cosmos.group.v1.serde.rs"); include!("cosmos.group.v1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.serde.rs new file mode 100644 index 00000000..1eeadb41 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.v1.serde.rs @@ -0,0 +1,10053 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for DecisionPolicyWindows { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.voting_period.is_some() { + len += 1; + } + if self.min_execution_period.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.DecisionPolicyWindows", len)?; + if let Some(v) = self.voting_period.as_ref() { + struct_ser.serialize_field("votingPeriod", v)?; + } + if let Some(v) = self.min_execution_period.as_ref() { + struct_ser.serialize_field("minExecutionPeriod", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DecisionPolicyWindows { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "voting_period", + "votingPeriod", + "min_execution_period", + "minExecutionPeriod", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + VotingPeriod, + MinExecutionPeriod, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votingPeriod" | "voting_period" => Ok(GeneratedField::VotingPeriod), + "minExecutionPeriod" | "min_execution_period" => { + Ok(GeneratedField::MinExecutionPeriod) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DecisionPolicyWindows; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.DecisionPolicyWindows") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voting_period__ = None; + let mut min_execution_period__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::VotingPeriod => { + if voting_period__.is_some() { + return Err(serde::de::Error::duplicate_field("votingPeriod")); + } + voting_period__ = map_.next_value()?; + } + GeneratedField::MinExecutionPeriod => { + if min_execution_period__.is_some() { + return Err(serde::de::Error::duplicate_field( + "minExecutionPeriod", + )); + } + min_execution_period__ = map_.next_value()?; + } + } + } + Ok(DecisionPolicyWindows { + voting_period: voting_period__, + min_execution_period: min_execution_period__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.DecisionPolicyWindows", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventCreateGroup { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventCreateGroup", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventCreateGroup { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventCreateGroup; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventCreateGroup") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(EventCreateGroup { + group_id: group_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventCreateGroup", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventCreateGroupPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventCreateGroupPolicy", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventCreateGroupPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventCreateGroupPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventCreateGroupPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(EventCreateGroupPolicy { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventCreateGroupPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventExec { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.result != 0 { + len += 1; + } + if !self.logs.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.EventExec", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if self.result != 0 { + let v = ProposalExecutorResult::try_from(self.result).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.result)) + })?; + struct_ser.serialize_field("result", &v)?; + } + if !self.logs.is_empty() { + struct_ser.serialize_field("logs", &self.logs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventExec { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "result", "logs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Result, + Logs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "result" => Ok(GeneratedField::Result), + "logs" => Ok(GeneratedField::Logs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventExec; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventExec") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut result__ = None; + let mut logs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Result => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("result")); + } + result__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Logs => { + if logs__.is_some() { + return Err(serde::de::Error::duplicate_field("logs")); + } + logs__ = Some(map_.next_value()?); + } + } + } + Ok(EventExec { + proposal_id: proposal_id__.unwrap_or_default(), + result: result__.unwrap_or_default(), + logs: logs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.EventExec", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventLeaveGroup { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.EventLeaveGroup", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventLeaveGroup { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId", "address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventLeaveGroup; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventLeaveGroup") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(EventLeaveGroup { + group_id: group_id__.unwrap_or_default(), + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.EventLeaveGroup", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventProposalPruned { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.status != 0 { + len += 1; + } + if self.tally_result.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventProposalPruned", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if self.status != 0 { + let v = ProposalStatus::try_from(self.status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.status)) + })?; + struct_ser.serialize_field("status", &v)?; + } + if let Some(v) = self.tally_result.as_ref() { + struct_ser.serialize_field("tallyResult", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventProposalPruned { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_id", + "proposalId", + "status", + "tally_result", + "tallyResult", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Status, + TallyResult, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "status" => Ok(GeneratedField::Status), + "tallyResult" | "tally_result" => Ok(GeneratedField::TallyResult), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventProposalPruned; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventProposalPruned") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut status__ = None; + let mut tally_result__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::TallyResult => { + if tally_result__.is_some() { + return Err(serde::de::Error::duplicate_field("tallyResult")); + } + tally_result__ = map_.next_value()?; + } + } + } + Ok(EventProposalPruned { + proposal_id: proposal_id__.unwrap_or_default(), + status: status__.unwrap_or_default(), + tally_result: tally_result__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventProposalPruned", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventSubmitProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventSubmitProposal", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventSubmitProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventSubmitProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventSubmitProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(EventSubmitProposal { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventSubmitProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventUpdateGroup { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventUpdateGroup", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventUpdateGroup { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventUpdateGroup; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventUpdateGroup") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(EventUpdateGroup { + group_id: group_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventUpdateGroup", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventUpdateGroupPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventUpdateGroupPolicy", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventUpdateGroupPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventUpdateGroupPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventUpdateGroupPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(EventUpdateGroupPolicy { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventUpdateGroupPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventVote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.EventVote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventVote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventVote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventVote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(EventVote { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.EventVote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventWithdrawProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.EventWithdrawProposal", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventWithdrawProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventWithdrawProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.EventWithdrawProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(EventWithdrawProposal { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.EventWithdrawProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Exec { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "EXEC_UNSPECIFIED", + Self::Try => "EXEC_TRY", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Exec { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["EXEC_UNSPECIFIED", "EXEC_TRY"]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Exec; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "EXEC_UNSPECIFIED" => Ok(Exec::Unspecified), + "EXEC_TRY" => Ok(Exec::Try), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_seq != 0 { + len += 1; + } + if !self.groups.is_empty() { + len += 1; + } + if !self.group_members.is_empty() { + len += 1; + } + if self.group_policy_seq != 0 { + len += 1; + } + if !self.group_policies.is_empty() { + len += 1; + } + if self.proposal_seq != 0 { + len += 1; + } + if !self.proposals.is_empty() { + len += 1; + } + if !self.votes.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.GenesisState", len)?; + if self.group_seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("groupSeq", ToString::to_string(&self.group_seq).as_str())?; + } + if !self.groups.is_empty() { + struct_ser.serialize_field("groups", &self.groups)?; + } + if !self.group_members.is_empty() { + struct_ser.serialize_field("groupMembers", &self.group_members)?; + } + if self.group_policy_seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "groupPolicySeq", + ToString::to_string(&self.group_policy_seq).as_str(), + )?; + } + if !self.group_policies.is_empty() { + struct_ser.serialize_field("groupPolicies", &self.group_policies)?; + } + if self.proposal_seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalSeq", + ToString::to_string(&self.proposal_seq).as_str(), + )?; + } + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "group_seq", + "groupSeq", + "groups", + "group_members", + "groupMembers", + "group_policy_seq", + "groupPolicySeq", + "group_policies", + "groupPolicies", + "proposal_seq", + "proposalSeq", + "proposals", + "votes", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupSeq, + Groups, + GroupMembers, + GroupPolicySeq, + GroupPolicies, + ProposalSeq, + Proposals, + Votes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupSeq" | "group_seq" => Ok(GeneratedField::GroupSeq), + "groups" => Ok(GeneratedField::Groups), + "groupMembers" | "group_members" => Ok(GeneratedField::GroupMembers), + "groupPolicySeq" | "group_policy_seq" => { + Ok(GeneratedField::GroupPolicySeq) + } + "groupPolicies" | "group_policies" => Ok(GeneratedField::GroupPolicies), + "proposalSeq" | "proposal_seq" => Ok(GeneratedField::ProposalSeq), + "proposals" => Ok(GeneratedField::Proposals), + "votes" => Ok(GeneratedField::Votes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_seq__ = None; + let mut groups__ = None; + let mut group_members__ = None; + let mut group_policy_seq__ = None; + let mut group_policies__ = None; + let mut proposal_seq__ = None; + let mut proposals__ = None; + let mut votes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupSeq => { + if group_seq__.is_some() { + return Err(serde::de::Error::duplicate_field("groupSeq")); + } + group_seq__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Groups => { + if groups__.is_some() { + return Err(serde::de::Error::duplicate_field("groups")); + } + groups__ = Some(map_.next_value()?); + } + GeneratedField::GroupMembers => { + if group_members__.is_some() { + return Err(serde::de::Error::duplicate_field("groupMembers")); + } + group_members__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicySeq => { + if group_policy_seq__.is_some() { + return Err(serde::de::Error::duplicate_field("groupPolicySeq")); + } + group_policy_seq__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GroupPolicies => { + if group_policies__.is_some() { + return Err(serde::de::Error::duplicate_field("groupPolicies")); + } + group_policies__ = Some(map_.next_value()?); + } + GeneratedField::ProposalSeq => { + if proposal_seq__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalSeq")); + } + proposal_seq__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + group_seq: group_seq__.unwrap_or_default(), + groups: groups__.unwrap_or_default(), + group_members: group_members__.unwrap_or_default(), + group_policy_seq: group_policy_seq__.unwrap_or_default(), + group_policies: group_policies__.unwrap_or_default(), + proposal_seq: proposal_seq__.unwrap_or_default(), + proposals: proposals__.unwrap_or_default(), + votes: votes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.GenesisState", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GroupInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.version != 0 { + len += 1; + } + if !self.total_weight.is_empty() { + len += 1; + } + if self.created_at.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.GroupInfo", len)?; + if self.id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + if !self.total_weight.is_empty() { + struct_ser.serialize_field("totalWeight", &self.total_weight)?; + } + if let Some(v) = self.created_at.as_ref() { + struct_ser.serialize_field("createdAt", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GroupInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "admin", + "metadata", + "version", + "total_weight", + "totalWeight", + "created_at", + "createdAt", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + Admin, + Metadata, + Version, + TotalWeight, + CreatedAt, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "admin" => Ok(GeneratedField::Admin), + "metadata" => Ok(GeneratedField::Metadata), + "version" => Ok(GeneratedField::Version), + "totalWeight" | "total_weight" => Ok(GeneratedField::TotalWeight), + "createdAt" | "created_at" => Ok(GeneratedField::CreatedAt), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GroupInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.GroupInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut admin__ = None; + let mut metadata__ = None; + let mut version__ = None; + let mut total_weight__ = None; + let mut created_at__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::TotalWeight => { + if total_weight__.is_some() { + return Err(serde::de::Error::duplicate_field("totalWeight")); + } + total_weight__ = Some(map_.next_value()?); + } + GeneratedField::CreatedAt => { + if created_at__.is_some() { + return Err(serde::de::Error::duplicate_field("createdAt")); + } + created_at__ = map_.next_value()?; + } + } + } + Ok(GroupInfo { + id: id__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + version: version__.unwrap_or_default(), + total_weight: total_weight__.unwrap_or_default(), + created_at: created_at__, + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.GroupInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GroupMember { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + if self.member.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.GroupMember", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if let Some(v) = self.member.as_ref() { + struct_ser.serialize_field("member", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GroupMember { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId", "member"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + Member, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "member" => Ok(GeneratedField::Member), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GroupMember; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.GroupMember") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + let mut member__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Member => { + if member__.is_some() { + return Err(serde::de::Error::duplicate_field("member")); + } + member__ = map_.next_value()?; + } + } + } + Ok(GroupMember { + group_id: group_id__.unwrap_or_default(), + member: member__, + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.GroupMember", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GroupPolicyInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.version != 0 { + len += 1; + } + if self.decision_policy.is_some() { + len += 1; + } + if self.created_at.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.GroupPolicyInfo", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + if let Some(v) = self.decision_policy.as_ref() { + struct_ser.serialize_field("decisionPolicy", v)?; + } + if let Some(v) = self.created_at.as_ref() { + struct_ser.serialize_field("createdAt", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GroupPolicyInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "address", + "group_id", + "groupId", + "admin", + "metadata", + "version", + "decision_policy", + "decisionPolicy", + "created_at", + "createdAt", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + GroupId, + Admin, + Metadata, + Version, + DecisionPolicy, + CreatedAt, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "admin" => Ok(GeneratedField::Admin), + "metadata" => Ok(GeneratedField::Metadata), + "version" => Ok(GeneratedField::Version), + "decisionPolicy" | "decision_policy" => { + Ok(GeneratedField::DecisionPolicy) + } + "createdAt" | "created_at" => Ok(GeneratedField::CreatedAt), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GroupPolicyInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.GroupPolicyInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut group_id__ = None; + let mut admin__ = None; + let mut metadata__ = None; + let mut version__ = None; + let mut decision_policy__ = None; + let mut created_at__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::DecisionPolicy => { + if decision_policy__.is_some() { + return Err(serde::de::Error::duplicate_field("decisionPolicy")); + } + decision_policy__ = map_.next_value()?; + } + GeneratedField::CreatedAt => { + if created_at__.is_some() { + return Err(serde::de::Error::duplicate_field("createdAt")); + } + created_at__ = map_.next_value()?; + } + } + } + Ok(GroupPolicyInfo { + address: address__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + version: version__.unwrap_or_default(), + decision_policy: decision_policy__, + created_at: created_at__, + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.GroupPolicyInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Member { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.weight.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.added_at.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.Member", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.weight.is_empty() { + struct_ser.serialize_field("weight", &self.weight)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if let Some(v) = self.added_at.as_ref() { + struct_ser.serialize_field("addedAt", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Member { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "weight", "metadata", "added_at", "addedAt"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Weight, + Metadata, + AddedAt, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "weight" => Ok(GeneratedField::Weight), + "metadata" => Ok(GeneratedField::Metadata), + "addedAt" | "added_at" => Ok(GeneratedField::AddedAt), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Member; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.Member") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut weight__ = None; + let mut metadata__ = None; + let mut added_at__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Weight => { + if weight__.is_some() { + return Err(serde::de::Error::duplicate_field("weight")); + } + weight__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::AddedAt => { + if added_at__.is_some() { + return Err(serde::de::Error::duplicate_field("addedAt")); + } + added_at__ = map_.next_value()?; + } + } + } + Ok(Member { + address: address__.unwrap_or_default(), + weight: weight__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + added_at: added_at__, + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.Member", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MemberRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.weight.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MemberRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.weight.is_empty() { + struct_ser.serialize_field("weight", &self.weight)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MemberRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "weight", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Weight, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "weight" => Ok(GeneratedField::Weight), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MemberRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MemberRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut weight__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Weight => { + if weight__.is_some() { + return Err(serde::de::Error::duplicate_field("weight")); + } + weight__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MemberRequest { + address: address__.unwrap_or_default(), + weight: weight__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MemberRequest", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroup { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if !self.members.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgCreateGroup", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.members.is_empty() { + struct_ser.serialize_field("members", &self.members)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroup { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["admin", "members", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + Members, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "members" => Ok(GeneratedField::Members), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroup; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroup") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut members__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Members => { + if members__.is_some() { + return Err(serde::de::Error::duplicate_field("members")); + } + members__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreateGroup { + admin: admin__.unwrap_or_default(), + members: members__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgCreateGroup", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroupPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.decision_policy.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgCreateGroupPolicy", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if let Some(v) = self.decision_policy.as_ref() { + struct_ser.serialize_field("decisionPolicy", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroupPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "group_id", + "groupId", + "metadata", + "decision_policy", + "decisionPolicy", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupId, + Metadata, + DecisionPolicy, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "metadata" => Ok(GeneratedField::Metadata), + "decisionPolicy" | "decision_policy" => { + Ok(GeneratedField::DecisionPolicy) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroupPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroupPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_id__ = None; + let mut metadata__ = None; + let mut decision_policy__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::DecisionPolicy => { + if decision_policy__.is_some() { + return Err(serde::de::Error::duplicate_field("decisionPolicy")); + } + decision_policy__ = map_.next_value()?; + } + } + } + Ok(MsgCreateGroupPolicy { + admin: admin__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + decision_policy: decision_policy__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgCreateGroupPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroupPolicyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgCreateGroupPolicyResponse", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroupPolicyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroupPolicyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroupPolicyResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreateGroupPolicyResponse { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgCreateGroupPolicyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroupResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgCreateGroupResponse", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroupResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroupResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroupResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgCreateGroupResponse { + group_id: group_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgCreateGroupResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroupWithPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if !self.members.is_empty() { + len += 1; + } + if !self.group_metadata.is_empty() { + len += 1; + } + if !self.group_policy_metadata.is_empty() { + len += 1; + } + if self.group_policy_as_admin { + len += 1; + } + if self.decision_policy.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgCreateGroupWithPolicy", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.members.is_empty() { + struct_ser.serialize_field("members", &self.members)?; + } + if !self.group_metadata.is_empty() { + struct_ser.serialize_field("groupMetadata", &self.group_metadata)?; + } + if !self.group_policy_metadata.is_empty() { + struct_ser.serialize_field("groupPolicyMetadata", &self.group_policy_metadata)?; + } + if self.group_policy_as_admin { + struct_ser.serialize_field("groupPolicyAsAdmin", &self.group_policy_as_admin)?; + } + if let Some(v) = self.decision_policy.as_ref() { + struct_ser.serialize_field("decisionPolicy", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroupWithPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "members", + "group_metadata", + "groupMetadata", + "group_policy_metadata", + "groupPolicyMetadata", + "group_policy_as_admin", + "groupPolicyAsAdmin", + "decision_policy", + "decisionPolicy", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + Members, + GroupMetadata, + GroupPolicyMetadata, + GroupPolicyAsAdmin, + DecisionPolicy, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "members" => Ok(GeneratedField::Members), + "groupMetadata" | "group_metadata" => Ok(GeneratedField::GroupMetadata), + "groupPolicyMetadata" | "group_policy_metadata" => { + Ok(GeneratedField::GroupPolicyMetadata) + } + "groupPolicyAsAdmin" | "group_policy_as_admin" => { + Ok(GeneratedField::GroupPolicyAsAdmin) + } + "decisionPolicy" | "decision_policy" => { + Ok(GeneratedField::DecisionPolicy) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroupWithPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroupWithPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut members__ = None; + let mut group_metadata__ = None; + let mut group_policy_metadata__ = None; + let mut group_policy_as_admin__ = None; + let mut decision_policy__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Members => { + if members__.is_some() { + return Err(serde::de::Error::duplicate_field("members")); + } + members__ = Some(map_.next_value()?); + } + GeneratedField::GroupMetadata => { + if group_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("groupMetadata")); + } + group_metadata__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicyMetadata => { + if group_policy_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyMetadata", + )); + } + group_policy_metadata__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicyAsAdmin => { + if group_policy_as_admin__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAsAdmin", + )); + } + group_policy_as_admin__ = Some(map_.next_value()?); + } + GeneratedField::DecisionPolicy => { + if decision_policy__.is_some() { + return Err(serde::de::Error::duplicate_field("decisionPolicy")); + } + decision_policy__ = map_.next_value()?; + } + } + } + Ok(MsgCreateGroupWithPolicy { + admin: admin__.unwrap_or_default(), + members: members__.unwrap_or_default(), + group_metadata: group_metadata__.unwrap_or_default(), + group_policy_metadata: group_policy_metadata__.unwrap_or_default(), + group_policy_as_admin: group_policy_as_admin__.unwrap_or_default(), + decision_policy: decision_policy__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgCreateGroupWithPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateGroupWithPolicyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + if !self.group_policy_address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgCreateGroupWithPolicyResponse", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateGroupWithPolicyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "group_id", + "groupId", + "group_policy_address", + "groupPolicyAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + GroupPolicyAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateGroupWithPolicyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgCreateGroupWithPolicyResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + let mut group_policy_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreateGroupWithPolicyResponse { + group_id: group_id__.unwrap_or_default(), + group_policy_address: group_policy_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExec { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.executor.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgExec", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.executor.is_empty() { + struct_ser.serialize_field("executor", &self.executor)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExec { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "executor"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Executor, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "executor" => Ok(GeneratedField::Executor), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExec; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgExec") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut executor__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Executor => { + if executor__.is_some() { + return Err(serde::de::Error::duplicate_field("executor")); + } + executor__ = Some(map_.next_value()?); + } + } + } + Ok(MsgExec { + proposal_id: proposal_id__.unwrap_or_default(), + executor: executor__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgExec", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.result != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgExecResponse", len)?; + if self.result != 0 { + let v = ProposalExecutorResult::try_from(self.result).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.result)) + })?; + struct_ser.serialize_field("result", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["result"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Result, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "result" => Ok(GeneratedField::Result), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgExecResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut result__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Result => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("result")); + } + result__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(MsgExecResponse { + result: result__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgExecResponse", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgLeaveGroup { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgLeaveGroup", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgLeaveGroup { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "group_id", "groupId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + GroupId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgLeaveGroup; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgLeaveGroup") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut group_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgLeaveGroup { + address: address__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgLeaveGroup", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgLeaveGroupResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgLeaveGroupResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgLeaveGroupResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgLeaveGroupResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgLeaveGroupResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgLeaveGroupResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgLeaveGroupResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.group_policy_address.is_empty() { + len += 1; + } + if !self.proposers.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if !self.messages.is_empty() { + len += 1; + } + if self.exec != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgSubmitProposal", len)?; + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + if !self.proposers.is_empty() { + struct_ser.serialize_field("proposers", &self.proposers)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if !self.messages.is_empty() { + struct_ser.serialize_field("messages", &self.messages)?; + } + if self.exec != 0 { + let v = Exec::try_from(self.exec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.exec)))?; + struct_ser.serialize_field("exec", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "group_policy_address", + "groupPolicyAddress", + "proposers", + "metadata", + "messages", + "exec", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupPolicyAddress, + Proposers, + Metadata, + Messages, + Exec, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + "proposers" => Ok(GeneratedField::Proposers), + "metadata" => Ok(GeneratedField::Metadata), + "messages" => Ok(GeneratedField::Messages), + "exec" => Ok(GeneratedField::Exec), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgSubmitProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_policy_address__ = None; + let mut proposers__ = None; + let mut metadata__ = None; + let mut messages__ = None; + let mut exec__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + GeneratedField::Proposers => { + if proposers__.is_some() { + return Err(serde::de::Error::duplicate_field("proposers")); + } + proposers__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::Messages => { + if messages__.is_some() { + return Err(serde::de::Error::duplicate_field("messages")); + } + messages__ = Some(map_.next_value()?); + } + GeneratedField::Exec => { + if exec__.is_some() { + return Err(serde::de::Error::duplicate_field("exec")); + } + exec__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(MsgSubmitProposal { + group_policy_address: group_policy_address__.unwrap_or_default(), + proposers: proposers__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + messages: messages__.unwrap_or_default(), + exec: exec__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgSubmitProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgSubmitProposalResponse", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSubmitProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSubmitProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgSubmitProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgSubmitProposalResponse { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgSubmitProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupAdmin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + if !self.new_admin.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupAdmin", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.new_admin.is_empty() { + struct_ser.serialize_field("newAdmin", &self.new_admin)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupAdmin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["admin", "group_id", "groupId", "new_admin", "newAdmin"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupId, + NewAdmin, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "newAdmin" | "new_admin" => Ok(GeneratedField::NewAdmin), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupAdmin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupAdmin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_id__ = None; + let mut new_admin__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::NewAdmin => { + if new_admin__.is_some() { + return Err(serde::de::Error::duplicate_field("newAdmin")); + } + new_admin__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateGroupAdmin { + admin: admin__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + new_admin: new_admin__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupAdmin", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupAdminResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupAdminResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupMembers { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + if !self.member_updates.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupMembers", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.member_updates.is_empty() { + struct_ser.serialize_field("memberUpdates", &self.member_updates)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupMembers { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "group_id", + "groupId", + "member_updates", + "memberUpdates", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupId, + MemberUpdates, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "memberUpdates" | "member_updates" => Ok(GeneratedField::MemberUpdates), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupMembers; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupMembers") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_id__ = None; + let mut member_updates__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::MemberUpdates => { + if member_updates__.is_some() { + return Err(serde::de::Error::duplicate_field("memberUpdates")); + } + member_updates__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateGroupMembers { + admin: admin__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + member_updates: member_updates__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupMembers", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupMembersResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupMembersResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupMembersResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupMembersResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupMembersResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupMembersResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupMembersResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupMetadata { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.group_id != 0 { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupMetadata", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupMetadata { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["admin", "group_id", "groupId", "metadata"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupId, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupMetadata; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupMetadata") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_id__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateGroupMetadata { + admin: admin__.unwrap_or_default(), + group_id: group_id__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupMetadata", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupMetadataResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupMetadataResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupMetadataResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupMetadataResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupMetadataResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupMetadataResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupMetadataResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyAdmin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if !self.group_policy_address.is_empty() { + len += 1; + } + if !self.new_admin.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupPolicyAdmin", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + if !self.new_admin.is_empty() { + struct_ser.serialize_field("newAdmin", &self.new_admin)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyAdmin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "group_policy_address", + "groupPolicyAddress", + "new_admin", + "newAdmin", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupPolicyAddress, + NewAdmin, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + "newAdmin" | "new_admin" => Ok(GeneratedField::NewAdmin), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyAdmin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyAdmin") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_policy_address__ = None; + let mut new_admin__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + GeneratedField::NewAdmin => { + if new_admin__.is_some() { + return Err(serde::de::Error::duplicate_field("newAdmin")); + } + new_admin__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateGroupPolicyAdmin { + admin: admin__.unwrap_or_default(), + group_policy_address: group_policy_address__.unwrap_or_default(), + new_admin: new_admin__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupPolicyAdminResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyDecisionPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if !self.group_policy_address.is_empty() { + len += 1; + } + if self.decision_policy.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + if let Some(v) = self.decision_policy.as_ref() { + struct_ser.serialize_field("decisionPolicy", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyDecisionPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "group_policy_address", + "groupPolicyAddress", + "decision_policy", + "decisionPolicy", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupPolicyAddress, + DecisionPolicy, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + "decisionPolicy" | "decision_policy" => { + Ok(GeneratedField::DecisionPolicy) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyDecisionPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_policy_address__ = None; + let mut decision_policy__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + GeneratedField::DecisionPolicy => { + if decision_policy__.is_some() { + return Err(serde::de::Error::duplicate_field("decisionPolicy")); + } + decision_policy__ = map_.next_value()?; + } + } + } + Ok(MsgUpdateGroupPolicyDecisionPolicy { + admin: admin__.unwrap_or_default(), + group_policy_address: group_policy_address__.unwrap_or_default(), + decision_policy: decision_policy__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyDecisionPolicyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyDecisionPolicyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyDecisionPolicyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupPolicyDecisionPolicyResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyMetadata { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if !self.group_policy_address.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgUpdateGroupPolicyMetadata", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyMetadata { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "admin", + "group_policy_address", + "groupPolicyAddress", + "metadata", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + GroupPolicyAddress, + Metadata, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + "metadata" => Ok(GeneratedField::Metadata), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyMetadata; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyMetadata") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut group_policy_address__ = None; + let mut metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateGroupPolicyMetadata { + admin: admin__.unwrap_or_default(), + group_policy_address: group_policy_address__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateGroupPolicyMetadataResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateGroupPolicyMetadataResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateGroupPolicyMetadataResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateGroupPolicyMetadataResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if self.option != 0 { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.exec != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgVote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if self.exec != 0 { + let v = Exec::try_from(self.exec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.exec)))?; + struct_ser.serialize_field("exec", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_id", + "proposalId", + "voter", + "option", + "metadata", + "exec", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Option, + Metadata, + Exec, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "option" => Ok(GeneratedField::Option), + "metadata" => Ok(GeneratedField::Metadata), + "exec" => Ok(GeneratedField::Exec), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgVote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut option__ = None; + let mut metadata__ = None; + let mut exec__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::Exec => { + if exec__.is_some() { + return Err(serde::de::Error::duplicate_field("exec")); + } + exec__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(MsgVote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + option: option__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + exec: exec__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgVote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgVoteResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.group.v1.MsgVoteResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgVoteResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgVoteResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgVoteResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgVoteResponse {}) + } + } + deserializer.deserialize_struct("cosmos.group.v1.MsgVoteResponse", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgWithdrawProposal", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgWithdrawProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(MsgWithdrawProposal { + proposal_id: proposal_id__.unwrap_or_default(), + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgWithdrawProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgWithdrawProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.group.v1.MsgWithdrawProposalResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgWithdrawProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgWithdrawProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.MsgWithdrawProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgWithdrawProposalResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.MsgWithdrawProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PercentageDecisionPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.percentage.is_empty() { + len += 1; + } + if self.windows.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.PercentageDecisionPolicy", len)?; + if !self.percentage.is_empty() { + struct_ser.serialize_field("percentage", &self.percentage)?; + } + if let Some(v) = self.windows.as_ref() { + struct_ser.serialize_field("windows", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PercentageDecisionPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["percentage", "windows"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Percentage, + Windows, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "percentage" => Ok(GeneratedField::Percentage), + "windows" => Ok(GeneratedField::Windows), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PercentageDecisionPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.PercentageDecisionPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut percentage__ = None; + let mut windows__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Percentage => { + if percentage__.is_some() { + return Err(serde::de::Error::duplicate_field("percentage")); + } + percentage__ = Some(map_.next_value()?); + } + GeneratedField::Windows => { + if windows__.is_some() { + return Err(serde::de::Error::duplicate_field("windows")); + } + windows__ = map_.next_value()?; + } + } + } + Ok(PercentageDecisionPolicy { + percentage: percentage__.unwrap_or_default(), + windows: windows__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.PercentageDecisionPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Proposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + if !self.group_policy_address.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if !self.proposers.is_empty() { + len += 1; + } + if self.submit_time.is_some() { + len += 1; + } + if self.group_version != 0 { + len += 1; + } + if self.group_policy_version != 0 { + len += 1; + } + if self.status != 0 { + len += 1; + } + if self.final_tally_result.is_some() { + len += 1; + } + if self.voting_period_end.is_some() { + len += 1; + } + if self.executor_result != 0 { + len += 1; + } + if !self.messages.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.Proposal", len)?; + if self.id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; + } + if !self.group_policy_address.is_empty() { + struct_ser.serialize_field("groupPolicyAddress", &self.group_policy_address)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if !self.proposers.is_empty() { + struct_ser.serialize_field("proposers", &self.proposers)?; + } + if let Some(v) = self.submit_time.as_ref() { + struct_ser.serialize_field("submitTime", v)?; + } + if self.group_version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "groupVersion", + ToString::to_string(&self.group_version).as_str(), + )?; + } + if self.group_policy_version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "groupPolicyVersion", + ToString::to_string(&self.group_policy_version).as_str(), + )?; + } + if self.status != 0 { + let v = ProposalStatus::try_from(self.status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.status)) + })?; + struct_ser.serialize_field("status", &v)?; + } + if let Some(v) = self.final_tally_result.as_ref() { + struct_ser.serialize_field("finalTallyResult", v)?; + } + if let Some(v) = self.voting_period_end.as_ref() { + struct_ser.serialize_field("votingPeriodEnd", v)?; + } + if self.executor_result != 0 { + let v = ProposalExecutorResult::try_from(self.executor_result).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.executor_result)) + })?; + struct_ser.serialize_field("executorResult", &v)?; + } + if !self.messages.is_empty() { + struct_ser.serialize_field("messages", &self.messages)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Proposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "group_policy_address", + "groupPolicyAddress", + "metadata", + "proposers", + "submit_time", + "submitTime", + "group_version", + "groupVersion", + "group_policy_version", + "groupPolicyVersion", + "status", + "final_tally_result", + "finalTallyResult", + "voting_period_end", + "votingPeriodEnd", + "executor_result", + "executorResult", + "messages", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + GroupPolicyAddress, + Metadata, + Proposers, + SubmitTime, + GroupVersion, + GroupPolicyVersion, + Status, + FinalTallyResult, + VotingPeriodEnd, + ExecutorResult, + Messages, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "groupPolicyAddress" | "group_policy_address" => { + Ok(GeneratedField::GroupPolicyAddress) + } + "metadata" => Ok(GeneratedField::Metadata), + "proposers" => Ok(GeneratedField::Proposers), + "submitTime" | "submit_time" => Ok(GeneratedField::SubmitTime), + "groupVersion" | "group_version" => Ok(GeneratedField::GroupVersion), + "groupPolicyVersion" | "group_policy_version" => { + Ok(GeneratedField::GroupPolicyVersion) + } + "status" => Ok(GeneratedField::Status), + "finalTallyResult" | "final_tally_result" => { + Ok(GeneratedField::FinalTallyResult) + } + "votingPeriodEnd" | "voting_period_end" => { + Ok(GeneratedField::VotingPeriodEnd) + } + "executorResult" | "executor_result" => { + Ok(GeneratedField::ExecutorResult) + } + "messages" => Ok(GeneratedField::Messages), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Proposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.Proposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut group_policy_address__ = None; + let mut metadata__ = None; + let mut proposers__ = None; + let mut submit_time__ = None; + let mut group_version__ = None; + let mut group_policy_version__ = None; + let mut status__ = None; + let mut final_tally_result__ = None; + let mut voting_period_end__ = None; + let mut executor_result__ = None; + let mut messages__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GroupPolicyAddress => { + if group_policy_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyAddress", + )); + } + group_policy_address__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::Proposers => { + if proposers__.is_some() { + return Err(serde::de::Error::duplicate_field("proposers")); + } + proposers__ = Some(map_.next_value()?); + } + GeneratedField::SubmitTime => { + if submit_time__.is_some() { + return Err(serde::de::Error::duplicate_field("submitTime")); + } + submit_time__ = map_.next_value()?; + } + GeneratedField::GroupVersion => { + if group_version__.is_some() { + return Err(serde::de::Error::duplicate_field("groupVersion")); + } + group_version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::GroupPolicyVersion => { + if group_policy_version__.is_some() { + return Err(serde::de::Error::duplicate_field( + "groupPolicyVersion", + )); + } + group_policy_version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::FinalTallyResult => { + if final_tally_result__.is_some() { + return Err(serde::de::Error::duplicate_field("finalTallyResult")); + } + final_tally_result__ = map_.next_value()?; + } + GeneratedField::VotingPeriodEnd => { + if voting_period_end__.is_some() { + return Err(serde::de::Error::duplicate_field("votingPeriodEnd")); + } + voting_period_end__ = map_.next_value()?; + } + GeneratedField::ExecutorResult => { + if executor_result__.is_some() { + return Err(serde::de::Error::duplicate_field("executorResult")); + } + executor_result__ = + Some(map_.next_value::()? as i32); + } + GeneratedField::Messages => { + if messages__.is_some() { + return Err(serde::de::Error::duplicate_field("messages")); + } + messages__ = Some(map_.next_value()?); + } + } + } + Ok(Proposal { + id: id__.unwrap_or_default(), + group_policy_address: group_policy_address__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + proposers: proposers__.unwrap_or_default(), + submit_time: submit_time__, + group_version: group_version__.unwrap_or_default(), + group_policy_version: group_policy_version__.unwrap_or_default(), + status: status__.unwrap_or_default(), + final_tally_result: final_tally_result__, + voting_period_end: voting_period_end__, + executor_result: executor_result__.unwrap_or_default(), + messages: messages__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.Proposal", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProposalExecutorResult { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED", + Self::NotRun => "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + Self::Success => "PROPOSAL_EXECUTOR_RESULT_SUCCESS", + Self::Failure => "PROPOSAL_EXECUTOR_RESULT_FAILURE", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProposalExecutorResult { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED", + "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + "PROPOSAL_EXECUTOR_RESULT_SUCCESS", + "PROPOSAL_EXECUTOR_RESULT_FAILURE", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProposalExecutorResult; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED" => { + Ok(ProposalExecutorResult::Unspecified) + } + "PROPOSAL_EXECUTOR_RESULT_NOT_RUN" => Ok(ProposalExecutorResult::NotRun), + "PROPOSAL_EXECUTOR_RESULT_SUCCESS" => Ok(ProposalExecutorResult::Success), + "PROPOSAL_EXECUTOR_RESULT_FAILURE" => Ok(ProposalExecutorResult::Failure), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ProposalStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", + Self::Submitted => "PROPOSAL_STATUS_SUBMITTED", + Self::Accepted => "PROPOSAL_STATUS_ACCEPTED", + Self::Rejected => "PROPOSAL_STATUS_REJECTED", + Self::Aborted => "PROPOSAL_STATUS_ABORTED", + Self::Withdrawn => "PROPOSAL_STATUS_WITHDRAWN", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ProposalStatus { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "PROPOSAL_STATUS_UNSPECIFIED", + "PROPOSAL_STATUS_SUBMITTED", + "PROPOSAL_STATUS_ACCEPTED", + "PROPOSAL_STATUS_REJECTED", + "PROPOSAL_STATUS_ABORTED", + "PROPOSAL_STATUS_WITHDRAWN", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProposalStatus; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "PROPOSAL_STATUS_UNSPECIFIED" => Ok(ProposalStatus::Unspecified), + "PROPOSAL_STATUS_SUBMITTED" => Ok(ProposalStatus::Submitted), + "PROPOSAL_STATUS_ACCEPTED" => Ok(ProposalStatus::Accepted), + "PROPOSAL_STATUS_REJECTED" => Ok(ProposalStatus::Rejected), + "PROPOSAL_STATUS_ABORTED" => Ok(ProposalStatus::Aborted), + "PROPOSAL_STATUS_WITHDRAWN" => Ok(ProposalStatus::Withdrawn), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupInfoRequest", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupInfoRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryGroupInfoRequest { + group_id: group_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.info.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupInfoResponse", len)?; + if let Some(v) = self.info.as_ref() { + struct_ser.serialize_field("info", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["info"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Info, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "info" => Ok(GeneratedField::Info), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupInfoResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = map_.next_value()?; + } + } + } + Ok(QueryGroupInfoResponse { info: info__ }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupMembersRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupMembersRequest", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupMembersRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupMembersRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupMembersRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupMembersRequest { + group_id: group_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupMembersRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupMembersResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.members.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupMembersResponse", len)?; + if !self.members.is_empty() { + struct_ser.serialize_field("members", &self.members)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupMembersResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["members", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Members, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "members" => Ok(GeneratedField::Members), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupMembersResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupMembersResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut members__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Members => { + if members__.is_some() { + return Err(serde::de::Error::duplicate_field("members")); + } + members__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupMembersResponse { + members: members__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupMembersResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPoliciesByAdminRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupPoliciesByAdminRequest", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPoliciesByAdminRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["admin", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPoliciesByAdminRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPoliciesByAdminRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupPoliciesByAdminRequest { + admin: admin__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPoliciesByAdminRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPoliciesByAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.group_policies.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.group.v1.QueryGroupPoliciesByAdminResponse", len)?; + if !self.group_policies.is_empty() { + struct_ser.serialize_field("groupPolicies", &self.group_policies)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPoliciesByAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_policies", "groupPolicies", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupPolicies, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupPolicies" | "group_policies" => Ok(GeneratedField::GroupPolicies), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPoliciesByAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPoliciesByAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_policies__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupPolicies => { + if group_policies__.is_some() { + return Err(serde::de::Error::duplicate_field("groupPolicies")); + } + group_policies__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupPoliciesByAdminResponse { + group_policies: group_policies__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPoliciesByAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPoliciesByGroupRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.group_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupPoliciesByGroupRequest", len)?; + if self.group_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("groupId", ToString::to_string(&self.group_id).as_str())?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPoliciesByGroupRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_id", "groupId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupId" | "group_id" => Ok(GeneratedField::GroupId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPoliciesByGroupRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPoliciesByGroupRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupId => { + if group_id__.is_some() { + return Err(serde::de::Error::duplicate_field("groupId")); + } + group_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupPoliciesByGroupRequest { + group_id: group_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPoliciesByGroupRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPoliciesByGroupResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.group_policies.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.group.v1.QueryGroupPoliciesByGroupResponse", len)?; + if !self.group_policies.is_empty() { + struct_ser.serialize_field("groupPolicies", &self.group_policies)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPoliciesByGroupResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["group_policies", "groupPolicies", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GroupPolicies, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groupPolicies" | "group_policies" => Ok(GeneratedField::GroupPolicies), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPoliciesByGroupResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPoliciesByGroupResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut group_policies__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GroupPolicies => { + if group_policies__.is_some() { + return Err(serde::de::Error::duplicate_field("groupPolicies")); + } + group_policies__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupPoliciesByGroupResponse { + group_policies: group_policies__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPoliciesByGroupResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPolicyInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupPolicyInfoRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPolicyInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPolicyInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPolicyInfoRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryGroupPolicyInfoRequest { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPolicyInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupPolicyInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.info.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupPolicyInfoResponse", len)?; + if let Some(v) = self.info.as_ref() { + struct_ser.serialize_field("info", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupPolicyInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["info"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Info, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "info" => Ok(GeneratedField::Info), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupPolicyInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupPolicyInfoResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = map_.next_value()?; + } + } + } + Ok(QueryGroupPolicyInfoResponse { info: info__ }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupPolicyInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsByAdminRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.admin.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsByAdminRequest", len)?; + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsByAdminRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["admin", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Admin, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "admin" => Ok(GeneratedField::Admin), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsByAdminRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsByAdminRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut admin__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsByAdminRequest { + admin: admin__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsByAdminRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsByAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.groups.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsByAdminResponse", len)?; + if !self.groups.is_empty() { + struct_ser.serialize_field("groups", &self.groups)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsByAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["groups", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Groups, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groups" => Ok(GeneratedField::Groups), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsByAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsByAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut groups__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Groups => { + if groups__.is_some() { + return Err(serde::de::Error::duplicate_field("groups")); + } + groups__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsByAdminResponse { + groups: groups__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsByAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsByMemberRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsByMemberRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsByMemberRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsByMemberRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsByMemberRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsByMemberRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsByMemberRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsByMemberResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.groups.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsByMemberResponse", len)?; + if !self.groups.is_empty() { + struct_ser.serialize_field("groups", &self.groups)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsByMemberResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["groups", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Groups, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groups" => Ok(GeneratedField::Groups), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsByMemberResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsByMemberResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut groups__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Groups => { + if groups__.is_some() { + return Err(serde::de::Error::duplicate_field("groups")); + } + groups__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsByMemberResponse { + groups: groups__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsByMemberResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryGroupsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.groups.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryGroupsResponse", len)?; + if !self.groups.is_empty() { + struct_ser.serialize_field("groups", &self.groups)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryGroupsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["groups", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Groups, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "groups" => Ok(GeneratedField::Groups), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryGroupsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryGroupsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut groups__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Groups => { + if groups__.is_some() { + return Err(serde::de::Error::duplicate_field("groups")); + } + groups__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryGroupsResponse { + groups: groups__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryGroupsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryProposalRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryProposalRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryProposalRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryProposalRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryProposalResponse", len)?; + if let Some(v) = self.proposal.as_ref() { + struct_ser.serialize_field("proposal", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposal, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposal" => Ok(GeneratedField::Proposal), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposal => { + if proposal__.is_some() { + return Err(serde::de::Error::duplicate_field("proposal")); + } + proposal__ = map_.next_value()?; + } + } + } + Ok(QueryProposalResponse { + proposal: proposal__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsByGroupPolicyRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.group.v1.QueryProposalsByGroupPolicyRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsByGroupPolicyRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsByGroupPolicyRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryProposalsByGroupPolicyRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsByGroupPolicyRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryProposalsByGroupPolicyRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryProposalsByGroupPolicyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.proposals.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.group.v1.QueryProposalsByGroupPolicyResponse", len)?; + if !self.proposals.is_empty() { + struct_ser.serialize_field("proposals", &self.proposals)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryProposalsByGroupPolicyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposals", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Proposals, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposals" => Ok(GeneratedField::Proposals), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryProposalsByGroupPolicyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryProposalsByGroupPolicyResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposals__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Proposals => { + if proposals__.is_some() { + return Err(serde::de::Error::duplicate_field("proposals")); + } + proposals__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryProposalsByGroupPolicyResponse { + proposals: proposals__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryProposalsByGroupPolicyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryTallyResultRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryTallyResultRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryTallyResultRequest { + proposal_id: proposal_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryTallyResultRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryTallyResultResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tally.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryTallyResultResponse", len)?; + if let Some(v) = self.tally.as_ref() { + struct_ser.serialize_field("tally", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryTallyResultResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tally"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tally, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tally" => Ok(GeneratedField::Tally), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryTallyResultResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryTallyResultResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tally__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tally => { + if tally__.is_some() { + return Err(serde::de::Error::duplicate_field("tally")); + } + tally__ = map_.next_value()?; + } + } + } + Ok(QueryTallyResultResponse { tally: tally__ }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryTallyResultResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteByProposalVoterRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVoteByProposalVoterRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteByProposalVoterRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "voter"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteByProposalVoterRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVoteByProposalVoterRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + } + } + Ok(QueryVoteByProposalVoterRequest { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVoteByProposalVoterRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVoteByProposalVoterResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.vote.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVoteByProposalVoterResponse", len)?; + if let Some(v) = self.vote.as_ref() { + struct_ser.serialize_field("vote", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVoteByProposalVoterResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["vote"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Vote, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "vote" => Ok(GeneratedField::Vote), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVoteByProposalVoterResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVoteByProposalVoterResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut vote__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Vote => { + if vote__.is_some() { + return Err(serde::de::Error::duplicate_field("vote")); + } + vote__ = map_.next_value()?; + } + } + } + Ok(QueryVoteByProposalVoterResponse { vote: vote__ }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVoteByProposalVoterResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesByProposalRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVotesByProposalRequest", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesByProposalRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["proposal_id", "proposalId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesByProposalRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVotesByProposalRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesByProposalRequest { + proposal_id: proposal_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVotesByProposalRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesByProposalResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.votes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVotesByProposalResponse", len)?; + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesByProposalResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["votes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Votes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votes" => Ok(GeneratedField::Votes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesByProposalResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVotesByProposalResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut votes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesByProposalResponse { + votes: votes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVotesByProposalResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesByVoterRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.voter.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVotesByVoterRequest", len)?; + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesByVoterRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["voter", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Voter, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "voter" => Ok(GeneratedField::Voter), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesByVoterRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVotesByVoterRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut voter__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesByVoterRequest { + voter: voter__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVotesByVoterRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryVotesByVoterResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.votes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.QueryVotesByVoterResponse", len)?; + if !self.votes.is_empty() { + struct_ser.serialize_field("votes", &self.votes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryVotesByVoterResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["votes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Votes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "votes" => Ok(GeneratedField::Votes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryVotesByVoterResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.QueryVotesByVoterResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut votes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Votes => { + if votes__.is_some() { + return Err(serde::de::Error::duplicate_field("votes")); + } + votes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryVotesByVoterResponse { + votes: votes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.QueryVotesByVoterResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TallyResult { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.yes_count.is_empty() { + len += 1; + } + if !self.abstain_count.is_empty() { + len += 1; + } + if !self.no_count.is_empty() { + len += 1; + } + if !self.no_with_veto_count.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.TallyResult", len)?; + if !self.yes_count.is_empty() { + struct_ser.serialize_field("yesCount", &self.yes_count)?; + } + if !self.abstain_count.is_empty() { + struct_ser.serialize_field("abstainCount", &self.abstain_count)?; + } + if !self.no_count.is_empty() { + struct_ser.serialize_field("noCount", &self.no_count)?; + } + if !self.no_with_veto_count.is_empty() { + struct_ser.serialize_field("noWithVetoCount", &self.no_with_veto_count)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TallyResult { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "yes_count", + "yesCount", + "abstain_count", + "abstainCount", + "no_count", + "noCount", + "no_with_veto_count", + "noWithVetoCount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + YesCount, + AbstainCount, + NoCount, + NoWithVetoCount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "yesCount" | "yes_count" => Ok(GeneratedField::YesCount), + "abstainCount" | "abstain_count" => Ok(GeneratedField::AbstainCount), + "noCount" | "no_count" => Ok(GeneratedField::NoCount), + "noWithVetoCount" | "no_with_veto_count" => { + Ok(GeneratedField::NoWithVetoCount) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TallyResult; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.TallyResult") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut yes_count__ = None; + let mut abstain_count__ = None; + let mut no_count__ = None; + let mut no_with_veto_count__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::YesCount => { + if yes_count__.is_some() { + return Err(serde::de::Error::duplicate_field("yesCount")); + } + yes_count__ = Some(map_.next_value()?); + } + GeneratedField::AbstainCount => { + if abstain_count__.is_some() { + return Err(serde::de::Error::duplicate_field("abstainCount")); + } + abstain_count__ = Some(map_.next_value()?); + } + GeneratedField::NoCount => { + if no_count__.is_some() { + return Err(serde::de::Error::duplicate_field("noCount")); + } + no_count__ = Some(map_.next_value()?); + } + GeneratedField::NoWithVetoCount => { + if no_with_veto_count__.is_some() { + return Err(serde::de::Error::duplicate_field("noWithVetoCount")); + } + no_with_veto_count__ = Some(map_.next_value()?); + } + } + } + Ok(TallyResult { + yes_count: yes_count__.unwrap_or_default(), + abstain_count: abstain_count__.unwrap_or_default(), + no_count: no_count__.unwrap_or_default(), + no_with_veto_count: no_with_veto_count__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.TallyResult", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ThresholdDecisionPolicy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.threshold.is_empty() { + len += 1; + } + if self.windows.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.group.v1.ThresholdDecisionPolicy", len)?; + if !self.threshold.is_empty() { + struct_ser.serialize_field("threshold", &self.threshold)?; + } + if let Some(v) = self.windows.as_ref() { + struct_ser.serialize_field("windows", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ThresholdDecisionPolicy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["threshold", "windows"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Threshold, + Windows, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "threshold" => Ok(GeneratedField::Threshold), + "windows" => Ok(GeneratedField::Windows), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ThresholdDecisionPolicy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.ThresholdDecisionPolicy") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut threshold__ = None; + let mut windows__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Threshold => { + if threshold__.is_some() { + return Err(serde::de::Error::duplicate_field("threshold")); + } + threshold__ = Some(map_.next_value()?); + } + GeneratedField::Windows => { + if windows__.is_some() { + return Err(serde::de::Error::duplicate_field("windows")); + } + windows__ = map_.next_value()?; + } + } + } + Ok(ThresholdDecisionPolicy { + threshold: threshold__.unwrap_or_default(), + windows: windows__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.group.v1.ThresholdDecisionPolicy", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Vote { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.proposal_id != 0 { + len += 1; + } + if !self.voter.is_empty() { + len += 1; + } + if self.option != 0 { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.submit_time.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.group.v1.Vote", len)?; + if self.proposal_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "proposalId", + ToString::to_string(&self.proposal_id).as_str(), + )?; + } + if !self.voter.is_empty() { + struct_ser.serialize_field("voter", &self.voter)?; + } + if self.option != 0 { + let v = VoteOption::try_from(self.option).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.option)) + })?; + struct_ser.serialize_field("option", &v)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if let Some(v) = self.submit_time.as_ref() { + struct_ser.serialize_field("submitTime", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Vote { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "proposal_id", + "proposalId", + "voter", + "option", + "metadata", + "submit_time", + "submitTime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ProposalId, + Voter, + Option, + Metadata, + SubmitTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "proposalId" | "proposal_id" => Ok(GeneratedField::ProposalId), + "voter" => Ok(GeneratedField::Voter), + "option" => Ok(GeneratedField::Option), + "metadata" => Ok(GeneratedField::Metadata), + "submitTime" | "submit_time" => Ok(GeneratedField::SubmitTime), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Vote; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.group.v1.Vote") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut proposal_id__ = None; + let mut voter__ = None; + let mut option__ = None; + let mut metadata__ = None; + let mut submit_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ProposalId => { + if proposal_id__.is_some() { + return Err(serde::de::Error::duplicate_field("proposalId")); + } + proposal_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Voter => { + if voter__.is_some() { + return Err(serde::de::Error::duplicate_field("voter")); + } + voter__ = Some(map_.next_value()?); + } + GeneratedField::Option => { + if option__.is_some() { + return Err(serde::de::Error::duplicate_field("option")); + } + option__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::SubmitTime => { + if submit_time__.is_some() { + return Err(serde::de::Error::duplicate_field("submitTime")); + } + submit_time__ = map_.next_value()?; + } + } + } + Ok(Vote { + proposal_id: proposal_id__.unwrap_or_default(), + voter: voter__.unwrap_or_default(), + option: option__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + submit_time: submit_time__, + }) + } + } + deserializer.deserialize_struct("cosmos.group.v1.Vote", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for VoteOption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "VOTE_OPTION_UNSPECIFIED", + Self::Yes => "VOTE_OPTION_YES", + Self::Abstain => "VOTE_OPTION_ABSTAIN", + Self::No => "VOTE_OPTION_NO", + Self::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for VoteOption { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "VOTE_OPTION_UNSPECIFIED", + "VOTE_OPTION_YES", + "VOTE_OPTION_ABSTAIN", + "VOTE_OPTION_NO", + "VOTE_OPTION_NO_WITH_VETO", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = VoteOption; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "VOTE_OPTION_UNSPECIFIED" => Ok(VoteOption::Unspecified), + "VOTE_OPTION_YES" => Ok(VoteOption::Yes), + "VOTE_OPTION_ABSTAIN" => Ok(VoteOption::Abstain), + "VOTE_OPTION_NO" => Ok(VoteOption::No), + "VOTE_OPTION_NO_WITH_VETO" => Ok(VoteOption::NoWithVeto), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.rs index 06dfcff7..9fbb0398 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.rs @@ -83,5 +83,6 @@ pub struct QueryAnnualProvisionsResponse { #[prost(bytes = "vec", tag = "1")] pub annual_provisions: ::prost::alloc::vec::Vec, } +include!("cosmos.mint.v1beta1.serde.rs"); include!("cosmos.mint.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.serde.rs new file mode 100644 index 00000000..53c957ef --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.v1beta1.serde.rs @@ -0,0 +1,994 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.minter.is_some() { + len += 1; + } + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.GenesisState", len)?; + if let Some(v) = self.minter.as_ref() { + struct_ser.serialize_field("minter", v)?; + } + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["minter", "params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Minter, + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "minter" => Ok(GeneratedField::Minter), + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut minter__ = None; + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Minter => { + if minter__.is_some() { + return Err(serde::de::Error::duplicate_field("minter")); + } + minter__ = map_.next_value()?; + } + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(GenesisState { + minter: minter__, + params: params__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Minter { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.inflation.is_empty() { + len += 1; + } + if !self.annual_provisions.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.mint.v1beta1.Minter", len)?; + if !self.inflation.is_empty() { + struct_ser.serialize_field("inflation", &self.inflation)?; + } + if !self.annual_provisions.is_empty() { + struct_ser.serialize_field("annualProvisions", &self.annual_provisions)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Minter { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["inflation", "annual_provisions", "annualProvisions"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Inflation, + AnnualProvisions, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "inflation" => Ok(GeneratedField::Inflation), + "annualProvisions" | "annual_provisions" => { + Ok(GeneratedField::AnnualProvisions) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Minter; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.Minter") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut inflation__ = None; + let mut annual_provisions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Inflation => { + if inflation__.is_some() { + return Err(serde::de::Error::duplicate_field("inflation")); + } + inflation__ = Some(map_.next_value()?); + } + GeneratedField::AnnualProvisions => { + if annual_provisions__.is_some() { + return Err(serde::de::Error::duplicate_field("annualProvisions")); + } + annual_provisions__ = Some(map_.next_value()?); + } + } + } + Ok(Minter { + inflation: inflation__.unwrap_or_default(), + annual_provisions: annual_provisions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.mint.v1beta1.Minter", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.mint_denom.is_empty() { + len += 1; + } + if !self.inflation_rate_change.is_empty() { + len += 1; + } + if !self.inflation_max.is_empty() { + len += 1; + } + if !self.inflation_min.is_empty() { + len += 1; + } + if !self.goal_bonded.is_empty() { + len += 1; + } + if self.blocks_per_year != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.mint.v1beta1.Params", len)?; + if !self.mint_denom.is_empty() { + struct_ser.serialize_field("mintDenom", &self.mint_denom)?; + } + if !self.inflation_rate_change.is_empty() { + struct_ser.serialize_field("inflationRateChange", &self.inflation_rate_change)?; + } + if !self.inflation_max.is_empty() { + struct_ser.serialize_field("inflationMax", &self.inflation_max)?; + } + if !self.inflation_min.is_empty() { + struct_ser.serialize_field("inflationMin", &self.inflation_min)?; + } + if !self.goal_bonded.is_empty() { + struct_ser.serialize_field("goalBonded", &self.goal_bonded)?; + } + if self.blocks_per_year != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "blocksPerYear", + ToString::to_string(&self.blocks_per_year).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "mint_denom", + "mintDenom", + "inflation_rate_change", + "inflationRateChange", + "inflation_max", + "inflationMax", + "inflation_min", + "inflationMin", + "goal_bonded", + "goalBonded", + "blocks_per_year", + "blocksPerYear", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MintDenom, + InflationRateChange, + InflationMax, + InflationMin, + GoalBonded, + BlocksPerYear, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "mintDenom" | "mint_denom" => Ok(GeneratedField::MintDenom), + "inflationRateChange" | "inflation_rate_change" => { + Ok(GeneratedField::InflationRateChange) + } + "inflationMax" | "inflation_max" => Ok(GeneratedField::InflationMax), + "inflationMin" | "inflation_min" => Ok(GeneratedField::InflationMin), + "goalBonded" | "goal_bonded" => Ok(GeneratedField::GoalBonded), + "blocksPerYear" | "blocks_per_year" => { + Ok(GeneratedField::BlocksPerYear) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut mint_denom__ = None; + let mut inflation_rate_change__ = None; + let mut inflation_max__ = None; + let mut inflation_min__ = None; + let mut goal_bonded__ = None; + let mut blocks_per_year__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MintDenom => { + if mint_denom__.is_some() { + return Err(serde::de::Error::duplicate_field("mintDenom")); + } + mint_denom__ = Some(map_.next_value()?); + } + GeneratedField::InflationRateChange => { + if inflation_rate_change__.is_some() { + return Err(serde::de::Error::duplicate_field( + "inflationRateChange", + )); + } + inflation_rate_change__ = Some(map_.next_value()?); + } + GeneratedField::InflationMax => { + if inflation_max__.is_some() { + return Err(serde::de::Error::duplicate_field("inflationMax")); + } + inflation_max__ = Some(map_.next_value()?); + } + GeneratedField::InflationMin => { + if inflation_min__.is_some() { + return Err(serde::de::Error::duplicate_field("inflationMin")); + } + inflation_min__ = Some(map_.next_value()?); + } + GeneratedField::GoalBonded => { + if goal_bonded__.is_some() { + return Err(serde::de::Error::duplicate_field("goalBonded")); + } + goal_bonded__ = Some(map_.next_value()?); + } + GeneratedField::BlocksPerYear => { + if blocks_per_year__.is_some() { + return Err(serde::de::Error::duplicate_field("blocksPerYear")); + } + blocks_per_year__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Params { + mint_denom: mint_denom__.unwrap_or_default(), + inflation_rate_change: inflation_rate_change__.unwrap_or_default(), + inflation_max: inflation_max__.unwrap_or_default(), + inflation_min: inflation_min__.unwrap_or_default(), + goal_bonded: goal_bonded__.unwrap_or_default(), + blocks_per_year: blocks_per_year__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.mint.v1beta1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAnnualProvisionsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAnnualProvisionsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAnnualProvisionsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryAnnualProvisionsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryAnnualProvisionsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAnnualProvisionsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.annual_provisions.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", len)?; + if !self.annual_provisions.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "annualProvisions", + pbjson::private::base64::encode(&self.annual_provisions).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAnnualProvisionsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["annual_provisions", "annualProvisions"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AnnualProvisions, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "annualProvisions" | "annual_provisions" => { + Ok(GeneratedField::AnnualProvisions) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAnnualProvisionsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryAnnualProvisionsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut annual_provisions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AnnualProvisions => { + if annual_provisions__.is_some() { + return Err(serde::de::Error::duplicate_field("annualProvisions")); + } + annual_provisions__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryAnnualProvisionsResponse { + annual_provisions: annual_provisions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryInflationRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.QueryInflationRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryInflationRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryInflationRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryInflationRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryInflationRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryInflationRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryInflationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.inflation.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.QueryInflationResponse", len)?; + if !self.inflation.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "inflation", + pbjson::private::base64::encode(&self.inflation).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryInflationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["inflation"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Inflation, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "inflation" => Ok(GeneratedField::Inflation), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryInflationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryInflationResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut inflation__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Inflation => { + if inflation__.is_some() { + return Err(serde::de::Error::duplicate_field("inflation")); + } + inflation__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryInflationResponse { + inflation: inflation__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryInflationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.mint.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.mint.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.mint.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.rs index b6eaf039..3da7a6fd 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.rs @@ -235,5 +235,6 @@ pub struct MsgSend { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSendResponse {} +include!("cosmos.nft.v1beta1.serde.rs"); include!("cosmos.nft.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.serde.rs new file mode 100644 index 00000000..a61ca837 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.v1beta1.serde.rs @@ -0,0 +1,2724 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Class { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.id.is_empty() { + len += 1; + } + if !self.name.is_empty() { + len += 1; + } + if !self.symbol.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.uri.is_empty() { + len += 1; + } + if !self.uri_hash.is_empty() { + len += 1; + } + if self.data.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.Class", len)?; + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.symbol.is_empty() { + struct_ser.serialize_field("symbol", &self.symbol)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.uri.is_empty() { + struct_ser.serialize_field("uri", &self.uri)?; + } + if !self.uri_hash.is_empty() { + struct_ser.serialize_field("uriHash", &self.uri_hash)?; + } + if let Some(v) = self.data.as_ref() { + struct_ser.serialize_field("data", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Class { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "name", + "symbol", + "description", + "uri", + "uri_hash", + "uriHash", + "data", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + Name, + Symbol, + Description, + Uri, + UriHash, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "name" => Ok(GeneratedField::Name), + "symbol" => Ok(GeneratedField::Symbol), + "description" => Ok(GeneratedField::Description), + "uri" => Ok(GeneratedField::Uri), + "uriHash" | "uri_hash" => Ok(GeneratedField::UriHash), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Class; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.Class") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut name__ = None; + let mut symbol__ = None; + let mut description__ = None; + let mut uri__ = None; + let mut uri_hash__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Symbol => { + if symbol__.is_some() { + return Err(serde::de::Error::duplicate_field("symbol")); + } + symbol__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Uri => { + if uri__.is_some() { + return Err(serde::de::Error::duplicate_field("uri")); + } + uri__ = Some(map_.next_value()?); + } + GeneratedField::UriHash => { + if uri_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("uriHash")); + } + uri_hash__ = Some(map_.next_value()?); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = map_.next_value()?; + } + } + } + Ok(Class { + id: id__.unwrap_or_default(), + name: name__.unwrap_or_default(), + symbol: symbol__.unwrap_or_default(), + description: description__.unwrap_or_default(), + uri: uri__.unwrap_or_default(), + uri_hash: uri_hash__.unwrap_or_default(), + data: data__, + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.Class", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Entry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.owner.is_empty() { + len += 1; + } + if !self.nfts.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.Entry", len)?; + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + if !self.nfts.is_empty() { + struct_ser.serialize_field("nfts", &self.nfts)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Entry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["owner", "nfts"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Owner, + Nfts, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "owner" => Ok(GeneratedField::Owner), + "nfts" => Ok(GeneratedField::Nfts), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Entry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.Entry") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut owner__ = None; + let mut nfts__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + GeneratedField::Nfts => { + if nfts__.is_some() { + return Err(serde::de::Error::duplicate_field("nfts")); + } + nfts__ = Some(map_.next_value()?); + } + } + } + Ok(Entry { + owner: owner__.unwrap_or_default(), + nfts: nfts__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.Entry", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventBurn { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + if !self.owner.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.EventBurn", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventBurn { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id", "owner"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + Owner, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + "owner" => Ok(GeneratedField::Owner), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventBurn; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.EventBurn") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + let mut owner__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + } + } + Ok(EventBurn { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + owner: owner__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.EventBurn", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventMint { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + if !self.owner.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.EventMint", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventMint { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id", "owner"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + Owner, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + "owner" => Ok(GeneratedField::Owner), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventMint; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.EventMint") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + let mut owner__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + } + } + Ok(EventMint { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + owner: owner__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.EventMint", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for EventSend { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + if !self.sender.is_empty() { + len += 1; + } + if !self.receiver.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.EventSend", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.receiver.is_empty() { + struct_ser.serialize_field("receiver", &self.receiver)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for EventSend { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id", "sender", "receiver"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + Sender, + Receiver, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + "sender" => Ok(GeneratedField::Sender), + "receiver" => Ok(GeneratedField::Receiver), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventSend; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.EventSend") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + let mut sender__ = None; + let mut receiver__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Receiver => { + if receiver__.is_some() { + return Err(serde::de::Error::duplicate_field("receiver")); + } + receiver__ = Some(map_.next_value()?); + } + } + } + Ok(EventSend { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + sender: sender__.unwrap_or_default(), + receiver: receiver__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.EventSend", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.classes.is_empty() { + len += 1; + } + if !self.entries.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.GenesisState", len)?; + if !self.classes.is_empty() { + struct_ser.serialize_field("classes", &self.classes)?; + } + if !self.entries.is_empty() { + struct_ser.serialize_field("entries", &self.entries)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["classes", "entries"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Classes, + Entries, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classes" => Ok(GeneratedField::Classes), + "entries" => Ok(GeneratedField::Entries), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut classes__ = None; + let mut entries__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Classes => { + if classes__.is_some() { + return Err(serde::de::Error::duplicate_field("classes")); + } + classes__ = Some(map_.next_value()?); + } + GeneratedField::Entries => { + if entries__.is_some() { + return Err(serde::de::Error::duplicate_field("entries")); + } + entries__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + classes: classes__.unwrap_or_default(), + entries: entries__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.GenesisState", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSend { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + if !self.sender.is_empty() { + len += 1; + } + if !self.receiver.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.MsgSend", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.receiver.is_empty() { + struct_ser.serialize_field("receiver", &self.receiver)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSend { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id", "sender", "receiver"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + Sender, + Receiver, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + "sender" => Ok(GeneratedField::Sender), + "receiver" => Ok(GeneratedField::Receiver), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSend; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.MsgSend") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + let mut sender__ = None; + let mut receiver__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Receiver => { + if receiver__.is_some() { + return Err(serde::de::Error::duplicate_field("receiver")); + } + receiver__ = Some(map_.next_value()?); + } + } + } + Ok(MsgSend { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + sender: sender__.unwrap_or_default(), + receiver: receiver__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.MsgSend", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSendResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.MsgSendResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSendResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSendResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.MsgSendResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgSendResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.MsgSendResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Nft { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + if !self.uri.is_empty() { + len += 1; + } + if !self.uri_hash.is_empty() { + len += 1; + } + if self.data.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.nft.v1beta1.NFT", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.uri.is_empty() { + struct_ser.serialize_field("uri", &self.uri)?; + } + if !self.uri_hash.is_empty() { + struct_ser.serialize_field("uriHash", &self.uri_hash)?; + } + if let Some(v) = self.data.as_ref() { + struct_ser.serialize_field("data", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Nft { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "class_id", "classId", "id", "uri", "uri_hash", "uriHash", "data", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + Uri, + UriHash, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + "uri" => Ok(GeneratedField::Uri), + "uriHash" | "uri_hash" => Ok(GeneratedField::UriHash), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Nft; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.NFT") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + let mut uri__ = None; + let mut uri_hash__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::Uri => { + if uri__.is_some() { + return Err(serde::de::Error::duplicate_field("uri")); + } + uri__ = Some(map_.next_value()?); + } + GeneratedField::UriHash => { + if uri_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("uriHash")); + } + uri_hash__ = Some(map_.next_value()?); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = map_.next_value()?; + } + } + } + Ok(Nft { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + uri: uri__.unwrap_or_default(), + uri_hash: uri_hash__.unwrap_or_default(), + data: data__, + }) + } + } + deserializer.deserialize_struct("cosmos.nft.v1beta1.NFT", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryBalanceRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.owner.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryBalanceRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryBalanceRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "owner"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Owner, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "owner" => Ok(GeneratedField::Owner), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryBalanceRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryBalanceRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut owner__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + } + } + Ok(QueryBalanceRequest { + class_id: class_id__.unwrap_or_default(), + owner: owner__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryBalanceRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryBalanceResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.amount != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryBalanceResponse", len)?; + if self.amount != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("amount", ToString::to_string(&self.amount).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryBalanceResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryBalanceResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryBalanceResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryBalanceResponse { + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryBalanceResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryClassRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryClassRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryClassRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryClassRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + } + } + Ok(QueryClassRequest { + class_id: class_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryClassRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryClassResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.class.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryClassResponse", len)?; + if let Some(v) = self.class.as_ref() { + struct_ser.serialize_field("class", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryClassResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Class, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "class" => Ok(GeneratedField::Class), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryClassResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Class => { + if class__.is_some() { + return Err(serde::de::Error::duplicate_field("class")); + } + class__ = map_.next_value()?; + } + } + } + Ok(QueryClassResponse { class: class__ }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryClassResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryClassesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryClassesRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryClassesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryClassesRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryClassesRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryClassesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryClassesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.classes.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryClassesResponse", len)?; + if !self.classes.is_empty() { + struct_ser.serialize_field("classes", &self.classes)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryClassesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["classes", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Classes, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classes" => Ok(GeneratedField::Classes), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryClassesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryClassesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut classes__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Classes => { + if classes__.is_some() { + return Err(serde::de::Error::duplicate_field("classes")); + } + classes__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryClassesResponse { + classes: classes__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryClassesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryNftRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryNFTRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryNftRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryNftRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryNFTRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + } + } + Ok(QueryNftRequest { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryNFTRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryNftResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.nft.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryNFTResponse", len)?; + if let Some(v) = self.nft.as_ref() { + struct_ser.serialize_field("nft", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryNftResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["nft"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Nft, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "nft" => Ok(GeneratedField::Nft), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryNftResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryNFTResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut nft__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Nft => { + if nft__.is_some() { + return Err(serde::de::Error::duplicate_field("nft")); + } + nft__ = map_.next_value()?; + } + } + } + Ok(QueryNftResponse { nft: nft__ }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryNFTResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryNfTsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.owner.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryNFTsRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryNfTsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "owner", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Owner, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "owner" => Ok(GeneratedField::Owner), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryNfTsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryNFTsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut owner__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryNfTsRequest { + class_id: class_id__.unwrap_or_default(), + owner: owner__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryNFTsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryNfTsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.nfts.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryNFTsResponse", len)?; + if !self.nfts.is_empty() { + struct_ser.serialize_field("nfts", &self.nfts)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryNfTsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["nfts", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Nfts, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "nfts" => Ok(GeneratedField::Nfts), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryNfTsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryNFTsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut nfts__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Nfts => { + if nfts__.is_some() { + return Err(serde::de::Error::duplicate_field("nfts")); + } + nfts__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryNfTsResponse { + nfts: nfts__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryNFTsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryOwnerRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + if !self.id.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryOwnerRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryOwnerRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId", "id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryOwnerRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryOwnerRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + } + } + Ok(QueryOwnerRequest { + class_id: class_id__.unwrap_or_default(), + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryOwnerRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryOwnerResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.owner.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QueryOwnerResponse", len)?; + if !self.owner.is_empty() { + struct_ser.serialize_field("owner", &self.owner)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryOwnerResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["owner"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Owner, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "owner" => Ok(GeneratedField::Owner), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryOwnerResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QueryOwnerResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut owner__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Owner => { + if owner__.is_some() { + return Err(serde::de::Error::duplicate_field("owner")); + } + owner__ = Some(map_.next_value()?); + } + } + } + Ok(QueryOwnerResponse { + owner: owner__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QueryOwnerResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySupplyRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.class_id.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QuerySupplyRequest", len)?; + if !self.class_id.is_empty() { + struct_ser.serialize_field("classId", &self.class_id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySupplyRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["class_id", "classId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ClassId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "classId" | "class_id" => Ok(GeneratedField::ClassId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySupplyRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QuerySupplyRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut class_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ClassId => { + if class_id__.is_some() { + return Err(serde::de::Error::duplicate_field("classId")); + } + class_id__ = Some(map_.next_value()?); + } + } + } + Ok(QuerySupplyRequest { + class_id: class_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QuerySupplyRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySupplyResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.amount != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.nft.v1beta1.QuerySupplyResponse", len)?; + if self.amount != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("amount", ToString::to_string(&self.amount).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySupplyResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySupplyResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.nft.v1beta1.QuerySupplyResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QuerySupplyResponse { + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.nft.v1beta1.QuerySupplyResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.rs index 02431f9e..0301a2cb 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.rs @@ -5,4 +5,5 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Module {} +include!("cosmos.orm.module.v1alpha1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.serde.rs new file mode 100644 index 00000000..632f3636 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.serde.rs @@ -0,0 +1,79 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Module { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmos.orm.module.v1alpha1.Module", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Module { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Module; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.module.v1alpha1.Module") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(Module {}) + } + } + deserializer.deserialize_struct( + "cosmos.orm.module.v1alpha1.Module", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.rs index 5d3a362f..f444af15 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.rs @@ -91,4 +91,5 @@ pub struct SingletonDescriptor { #[prost(uint32, tag = "1")] pub id: u32, } +include!("cosmos.orm.v1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.serde.rs new file mode 100644 index 00000000..c39fcf7c --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1.serde.rs @@ -0,0 +1,491 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PrimaryKeyDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fields.is_empty() { + len += 1; + } + if self.auto_increment { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.orm.v1.PrimaryKeyDescriptor", len)?; + if !self.fields.is_empty() { + struct_ser.serialize_field("fields", &self.fields)?; + } + if self.auto_increment { + struct_ser.serialize_field("autoIncrement", &self.auto_increment)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PrimaryKeyDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fields", "auto_increment", "autoIncrement"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fields, + AutoIncrement, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fields" => Ok(GeneratedField::Fields), + "autoIncrement" | "auto_increment" => Ok(GeneratedField::AutoIncrement), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PrimaryKeyDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1.PrimaryKeyDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fields__ = None; + let mut auto_increment__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fields => { + if fields__.is_some() { + return Err(serde::de::Error::duplicate_field("fields")); + } + fields__ = Some(map_.next_value()?); + } + GeneratedField::AutoIncrement => { + if auto_increment__.is_some() { + return Err(serde::de::Error::duplicate_field("autoIncrement")); + } + auto_increment__ = Some(map_.next_value()?); + } + } + } + Ok(PrimaryKeyDescriptor { + fields: fields__.unwrap_or_default(), + auto_increment: auto_increment__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.orm.v1.PrimaryKeyDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SecondaryIndexDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.fields.is_empty() { + len += 1; + } + if self.id != 0 { + len += 1; + } + if self.unique { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.orm.v1.SecondaryIndexDescriptor", len)?; + if !self.fields.is_empty() { + struct_ser.serialize_field("fields", &self.fields)?; + } + if self.id != 0 { + struct_ser.serialize_field("id", &self.id)?; + } + if self.unique { + struct_ser.serialize_field("unique", &self.unique)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SecondaryIndexDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["fields", "id", "unique"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Fields, + Id, + Unique, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fields" => Ok(GeneratedField::Fields), + "id" => Ok(GeneratedField::Id), + "unique" => Ok(GeneratedField::Unique), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SecondaryIndexDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1.SecondaryIndexDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut fields__ = None; + let mut id__ = None; + let mut unique__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Fields => { + if fields__.is_some() { + return Err(serde::de::Error::duplicate_field("fields")); + } + fields__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Unique => { + if unique__.is_some() { + return Err(serde::de::Error::duplicate_field("unique")); + } + unique__ = Some(map_.next_value()?); + } + } + } + Ok(SecondaryIndexDescriptor { + fields: fields__.unwrap_or_default(), + id: id__.unwrap_or_default(), + unique: unique__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.orm.v1.SecondaryIndexDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SingletonDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.orm.v1.SingletonDescriptor", len)?; + if self.id != 0 { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SingletonDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SingletonDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1.SingletonDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SingletonDescriptor { + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.orm.v1.SingletonDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TableDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.primary_key.is_some() { + len += 1; + } + if !self.index.is_empty() { + len += 1; + } + if self.id != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.orm.v1.TableDescriptor", len)?; + if let Some(v) = self.primary_key.as_ref() { + struct_ser.serialize_field("primaryKey", v)?; + } + if !self.index.is_empty() { + struct_ser.serialize_field("index", &self.index)?; + } + if self.id != 0 { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TableDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["primary_key", "primaryKey", "index", "id"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PrimaryKey, + Index, + Id, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "primaryKey" | "primary_key" => Ok(GeneratedField::PrimaryKey), + "index" => Ok(GeneratedField::Index), + "id" => Ok(GeneratedField::Id), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TableDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1.TableDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut primary_key__ = None; + let mut index__ = None; + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::PrimaryKey => { + if primary_key__.is_some() { + return Err(serde::de::Error::duplicate_field("primaryKey")); + } + primary_key__ = map_.next_value()?; + } + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(TableDescriptor { + primary_key: primary_key__, + index: index__.unwrap_or_default(), + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.orm.v1.TableDescriptor", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.rs index e5c5e548..8753b2ec 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.rs @@ -92,4 +92,5 @@ impl StorageType { } } } +include!("cosmos.orm.v1alpha1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.serde.rs new file mode 100644 index 00000000..2b5b4f84 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.v1alpha1.serde.rs @@ -0,0 +1,358 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for ModuleSchemaDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.schema_file.is_empty() { + len += 1; + } + if !self.prefix.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.orm.v1alpha1.ModuleSchemaDescriptor", len)?; + if !self.schema_file.is_empty() { + struct_ser.serialize_field("schemaFile", &self.schema_file)?; + } + if !self.prefix.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "prefix", + pbjson::private::base64::encode(&self.prefix).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModuleSchemaDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["schema_file", "schemaFile", "prefix"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SchemaFile, + Prefix, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "schemaFile" | "schema_file" => Ok(GeneratedField::SchemaFile), + "prefix" => Ok(GeneratedField::Prefix), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModuleSchemaDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1alpha1.ModuleSchemaDescriptor") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut schema_file__ = None; + let mut prefix__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SchemaFile => { + if schema_file__.is_some() { + return Err(serde::de::Error::duplicate_field("schemaFile")); + } + schema_file__ = Some(map_.next_value()?); + } + GeneratedField::Prefix => { + if prefix__.is_some() { + return Err(serde::de::Error::duplicate_field("prefix")); + } + prefix__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ModuleSchemaDescriptor { + schema_file: schema_file__.unwrap_or_default(), + prefix: prefix__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.orm.v1alpha1.ModuleSchemaDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for module_schema_descriptor::FileEntry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id != 0 { + len += 1; + } + if !self.proto_file_name.is_empty() { + len += 1; + } + if self.storage_type != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry", len)?; + if self.id != 0 { + struct_ser.serialize_field("id", &self.id)?; + } + if !self.proto_file_name.is_empty() { + struct_ser.serialize_field("protoFileName", &self.proto_file_name)?; + } + if self.storage_type != 0 { + let v = StorageType::try_from(self.storage_type).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.storage_type)) + })?; + struct_ser.serialize_field("storageType", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for module_schema_descriptor::FileEntry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "proto_file_name", + "protoFileName", + "storage_type", + "storageType", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + ProtoFileName, + StorageType, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "protoFileName" | "proto_file_name" => { + Ok(GeneratedField::ProtoFileName) + } + "storageType" | "storage_type" => Ok(GeneratedField::StorageType), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = module_schema_descriptor::FileEntry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut proto_file_name__ = None; + let mut storage_type__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::ProtoFileName => { + if proto_file_name__.is_some() { + return Err(serde::de::Error::duplicate_field("protoFileName")); + } + proto_file_name__ = Some(map_.next_value()?); + } + GeneratedField::StorageType => { + if storage_type__.is_some() { + return Err(serde::de::Error::duplicate_field("storageType")); + } + storage_type__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(module_schema_descriptor::FileEntry { + id: id__.unwrap_or_default(), + proto_file_name: proto_file_name__.unwrap_or_default(), + storage_type: storage_type__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StorageType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::DefaultUnspecified => "STORAGE_TYPE_DEFAULT_UNSPECIFIED", + Self::Memory => "STORAGE_TYPE_MEMORY", + Self::Transient => "STORAGE_TYPE_TRANSIENT", + Self::Index => "STORAGE_TYPE_INDEX", + Self::Commitment => "STORAGE_TYPE_COMMITMENT", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StorageType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "STORAGE_TYPE_DEFAULT_UNSPECIFIED", + "STORAGE_TYPE_MEMORY", + "STORAGE_TYPE_TRANSIENT", + "STORAGE_TYPE_INDEX", + "STORAGE_TYPE_COMMITMENT", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StorageType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "STORAGE_TYPE_DEFAULT_UNSPECIFIED" => Ok(StorageType::DefaultUnspecified), + "STORAGE_TYPE_MEMORY" => Ok(StorageType::Memory), + "STORAGE_TYPE_TRANSIENT" => Ok(StorageType::Transient), + "STORAGE_TYPE_INDEX" => Ok(StorageType::Index), + "STORAGE_TYPE_COMMITMENT" => Ok(StorageType::Commitment), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.rs index 637fa514..de96b78e 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.rs @@ -70,5 +70,6 @@ pub struct Subspace { #[prost(string, repeated, tag = "2")] pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } +include!("cosmos.params.v1beta1.serde.rs"); include!("cosmos.params.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.serde.rs new file mode 100644 index 00000000..a06d6009 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.v1beta1.serde.rs @@ -0,0 +1,778 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for ParamChange { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.subspace.is_empty() { + len += 1; + } + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.ParamChange", len)?; + if !self.subspace.is_empty() { + struct_ser.serialize_field("subspace", &self.subspace)?; + } + if !self.key.is_empty() { + struct_ser.serialize_field("key", &self.key)?; + } + if !self.value.is_empty() { + struct_ser.serialize_field("value", &self.value)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ParamChange { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["subspace", "key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Subspace, + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "subspace" => Ok(GeneratedField::Subspace), + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ParamChange; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.ParamChange") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut subspace__ = None; + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Subspace => { + if subspace__.is_some() { + return Err(serde::de::Error::duplicate_field("subspace")); + } + subspace__ = Some(map_.next_value()?); + } + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some(map_.next_value()?); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some(map_.next_value()?); + } + } + } + Ok(ParamChange { + subspace: subspace__.unwrap_or_default(), + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.ParamChange", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ParameterChangeProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.changes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.ParameterChangeProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.changes.is_empty() { + struct_ser.serialize_field("changes", &self.changes)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ParameterChangeProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "changes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Changes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "changes" => Ok(GeneratedField::Changes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ParameterChangeProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.ParameterChangeProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut changes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Changes => { + if changes__.is_some() { + return Err(serde::de::Error::duplicate_field("changes")); + } + changes__ = Some(map_.next_value()?); + } + } + } + Ok(ParameterChangeProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + changes: changes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.ParameterChangeProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.subspace.is_empty() { + len += 1; + } + if !self.key.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.QueryParamsRequest", len)?; + if !self.subspace.is_empty() { + struct_ser.serialize_field("subspace", &self.subspace)?; + } + if !self.key.is_empty() { + struct_ser.serialize_field("key", &self.key)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["subspace", "key"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Subspace, + Key, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "subspace" => Ok(GeneratedField::Subspace), + "key" => Ok(GeneratedField::Key), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut subspace__ = None; + let mut key__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Subspace => { + if subspace__.is_some() { + return Err(serde::de::Error::duplicate_field("subspace")); + } + subspace__ = Some(map_.next_value()?); + } + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some(map_.next_value()?); + } + } + } + Ok(QueryParamsRequest { + subspace: subspace__.unwrap_or_default(), + key: key__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.param.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.param.as_ref() { + struct_ser.serialize_field("param", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["param"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Param, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "param" => Ok(GeneratedField::Param), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut param__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Param => { + if param__.is_some() { + return Err(serde::de::Error::duplicate_field("param")); + } + param__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { param: param__ }) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySubspacesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.QuerySubspacesRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySubspacesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySubspacesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.QuerySubspacesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QuerySubspacesRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.QuerySubspacesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySubspacesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.subspaces.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.params.v1beta1.QuerySubspacesResponse", len)?; + if !self.subspaces.is_empty() { + struct_ser.serialize_field("subspaces", &self.subspaces)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySubspacesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["subspaces"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Subspaces, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "subspaces" => Ok(GeneratedField::Subspaces), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySubspacesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.QuerySubspacesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut subspaces__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Subspaces => { + if subspaces__.is_some() { + return Err(serde::de::Error::duplicate_field("subspaces")); + } + subspaces__ = Some(map_.next_value()?); + } + } + } + Ok(QuerySubspacesResponse { + subspaces: subspaces__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.params.v1beta1.QuerySubspacesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Subspace { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.subspace.is_empty() { + len += 1; + } + if !self.keys.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.params.v1beta1.Subspace", len)?; + if !self.subspace.is_empty() { + struct_ser.serialize_field("subspace", &self.subspace)?; + } + if !self.keys.is_empty() { + struct_ser.serialize_field("keys", &self.keys)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Subspace { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["subspace", "keys"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Subspace, + Keys, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "subspace" => Ok(GeneratedField::Subspace), + "keys" => Ok(GeneratedField::Keys), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Subspace; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.params.v1beta1.Subspace") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut subspace__ = None; + let mut keys__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Subspace => { + if subspace__.is_some() { + return Err(serde::de::Error::duplicate_field("subspace")); + } + subspace__ = Some(map_.next_value()?); + } + GeneratedField::Keys => { + if keys__.is_some() { + return Err(serde::de::Error::duplicate_field("keys")); + } + keys__ = Some(map_.next_value()?); + } + } + } + Ok(Subspace { + subspace: subspace__.unwrap_or_default(), + keys: keys__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.params.v1beta1.Subspace", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.rs index 2992bdb9..5eabd3e8 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.rs @@ -151,5 +151,6 @@ pub struct MsgUnjail { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUnjailResponse {} +include!("cosmos.slashing.v1beta1.serde.rs"); include!("cosmos.slashing.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.serde.rs new file mode 100644 index 00000000..47bc4d2b --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.v1beta1.serde.rs @@ -0,0 +1,1721 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if !self.signing_infos.is_empty() { + len += 1; + } + if !self.missed_blocks.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if !self.signing_infos.is_empty() { + struct_ser.serialize_field("signingInfos", &self.signing_infos)?; + } + if !self.missed_blocks.is_empty() { + struct_ser.serialize_field("missedBlocks", &self.missed_blocks)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + "signing_infos", + "signingInfos", + "missed_blocks", + "missedBlocks", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + SigningInfos, + MissedBlocks, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "signingInfos" | "signing_infos" => Ok(GeneratedField::SigningInfos), + "missedBlocks" | "missed_blocks" => Ok(GeneratedField::MissedBlocks), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut signing_infos__ = None; + let mut missed_blocks__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::SigningInfos => { + if signing_infos__.is_some() { + return Err(serde::de::Error::duplicate_field("signingInfos")); + } + signing_infos__ = Some(map_.next_value()?); + } + GeneratedField::MissedBlocks => { + if missed_blocks__.is_some() { + return Err(serde::de::Error::duplicate_field("missedBlocks")); + } + missed_blocks__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + signing_infos: signing_infos__.unwrap_or_default(), + missed_blocks: missed_blocks__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MissedBlock { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.index != 0 { + len += 1; + } + if self.missed { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.MissedBlock", len)?; + if self.index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("index", ToString::to_string(&self.index).as_str())?; + } + if self.missed { + struct_ser.serialize_field("missed", &self.missed)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MissedBlock { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["index", "missed"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Index, + Missed, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "index" => Ok(GeneratedField::Index), + "missed" => Ok(GeneratedField::Missed), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MissedBlock; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.MissedBlock") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut index__ = None; + let mut missed__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Index => { + if index__.is_some() { + return Err(serde::de::Error::duplicate_field("index")); + } + index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Missed => { + if missed__.is_some() { + return Err(serde::de::Error::duplicate_field("missed")); + } + missed__ = Some(map_.next_value()?); + } + } + } + Ok(MissedBlock { + index: index__.unwrap_or_default(), + missed: missed__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.MissedBlock", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUnjail { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_addr.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.MsgUnjail", len)?; + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUnjail { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_addr", "validatorAddr"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddr, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUnjail; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.MsgUnjail") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_addr__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUnjail { + validator_addr: validator_addr__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.MsgUnjail", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUnjailResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.MsgUnjailResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUnjailResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUnjailResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.MsgUnjailResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUnjailResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.MsgUnjailResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.signed_blocks_window != 0 { + len += 1; + } + if !self.min_signed_per_window.is_empty() { + len += 1; + } + if self.downtime_jail_duration.is_some() { + len += 1; + } + if !self.slash_fraction_double_sign.is_empty() { + len += 1; + } + if !self.slash_fraction_downtime.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.slashing.v1beta1.Params", len)?; + if self.signed_blocks_window != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "signedBlocksWindow", + ToString::to_string(&self.signed_blocks_window).as_str(), + )?; + } + if !self.min_signed_per_window.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "minSignedPerWindow", + pbjson::private::base64::encode(&self.min_signed_per_window).as_str(), + )?; + } + if let Some(v) = self.downtime_jail_duration.as_ref() { + struct_ser.serialize_field("downtimeJailDuration", v)?; + } + if !self.slash_fraction_double_sign.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "slashFractionDoubleSign", + pbjson::private::base64::encode(&self.slash_fraction_double_sign).as_str(), + )?; + } + if !self.slash_fraction_downtime.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "slashFractionDowntime", + pbjson::private::base64::encode(&self.slash_fraction_downtime).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "signed_blocks_window", + "signedBlocksWindow", + "min_signed_per_window", + "minSignedPerWindow", + "downtime_jail_duration", + "downtimeJailDuration", + "slash_fraction_double_sign", + "slashFractionDoubleSign", + "slash_fraction_downtime", + "slashFractionDowntime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SignedBlocksWindow, + MinSignedPerWindow, + DowntimeJailDuration, + SlashFractionDoubleSign, + SlashFractionDowntime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "signedBlocksWindow" | "signed_blocks_window" => { + Ok(GeneratedField::SignedBlocksWindow) + } + "minSignedPerWindow" | "min_signed_per_window" => { + Ok(GeneratedField::MinSignedPerWindow) + } + "downtimeJailDuration" | "downtime_jail_duration" => { + Ok(GeneratedField::DowntimeJailDuration) + } + "slashFractionDoubleSign" | "slash_fraction_double_sign" => { + Ok(GeneratedField::SlashFractionDoubleSign) + } + "slashFractionDowntime" | "slash_fraction_downtime" => { + Ok(GeneratedField::SlashFractionDowntime) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut signed_blocks_window__ = None; + let mut min_signed_per_window__ = None; + let mut downtime_jail_duration__ = None; + let mut slash_fraction_double_sign__ = None; + let mut slash_fraction_downtime__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SignedBlocksWindow => { + if signed_blocks_window__.is_some() { + return Err(serde::de::Error::duplicate_field( + "signedBlocksWindow", + )); + } + signed_blocks_window__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::MinSignedPerWindow => { + if min_signed_per_window__.is_some() { + return Err(serde::de::Error::duplicate_field( + "minSignedPerWindow", + )); + } + min_signed_per_window__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::DowntimeJailDuration => { + if downtime_jail_duration__.is_some() { + return Err(serde::de::Error::duplicate_field( + "downtimeJailDuration", + )); + } + downtime_jail_duration__ = map_.next_value()?; + } + GeneratedField::SlashFractionDoubleSign => { + if slash_fraction_double_sign__.is_some() { + return Err(serde::de::Error::duplicate_field( + "slashFractionDoubleSign", + )); + } + slash_fraction_double_sign__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::SlashFractionDowntime => { + if slash_fraction_downtime__.is_some() { + return Err(serde::de::Error::duplicate_field( + "slashFractionDowntime", + )); + } + slash_fraction_downtime__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Params { + signed_blocks_window: signed_blocks_window__.unwrap_or_default(), + min_signed_per_window: min_signed_per_window__.unwrap_or_default(), + downtime_jail_duration: downtime_jail_duration__, + slash_fraction_double_sign: slash_fraction_double_sign__.unwrap_or_default(), + slash_fraction_downtime: slash_fraction_downtime__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.slashing.v1beta1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySigningInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.cons_address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.QuerySigningInfoRequest", len)?; + if !self.cons_address.is_empty() { + struct_ser.serialize_field("consAddress", &self.cons_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySigningInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["cons_address", "consAddress"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ConsAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "consAddress" | "cons_address" => Ok(GeneratedField::ConsAddress), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySigningInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QuerySigningInfoRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut cons_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ConsAddress => { + if cons_address__.is_some() { + return Err(serde::de::Error::duplicate_field("consAddress")); + } + cons_address__ = Some(map_.next_value()?); + } + } + } + Ok(QuerySigningInfoRequest { + cons_address: cons_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QuerySigningInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySigningInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.val_signing_info.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.QuerySigningInfoResponse", len)?; + if let Some(v) = self.val_signing_info.as_ref() { + struct_ser.serialize_field("valSigningInfo", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySigningInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["val_signing_info", "valSigningInfo"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValSigningInfo, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "valSigningInfo" | "val_signing_info" => { + Ok(GeneratedField::ValSigningInfo) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySigningInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QuerySigningInfoResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut val_signing_info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValSigningInfo => { + if val_signing_info__.is_some() { + return Err(serde::de::Error::duplicate_field("valSigningInfo")); + } + val_signing_info__ = map_.next_value()?; + } + } + } + Ok(QuerySigningInfoResponse { + val_signing_info: val_signing_info__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QuerySigningInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySigningInfosRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.QuerySigningInfosRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySigningInfosRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySigningInfosRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QuerySigningInfosRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QuerySigningInfosRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QuerySigningInfosRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySigningInfosResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.info.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.slashing.v1beta1.QuerySigningInfosResponse", len)?; + if !self.info.is_empty() { + struct_ser.serialize_field("info", &self.info)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySigningInfosResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["info", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Info, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "info" => Ok(GeneratedField::Info), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySigningInfosResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.QuerySigningInfosResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut info__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QuerySigningInfosResponse { + info: info__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.QuerySigningInfosResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SigningInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.validator_signing_info.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.SigningInfo", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.validator_signing_info.as_ref() { + struct_ser.serialize_field("validatorSigningInfo", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SigningInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "validator_signing_info", "validatorSigningInfo"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + ValidatorSigningInfo, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "validatorSigningInfo" | "validator_signing_info" => { + Ok(GeneratedField::ValidatorSigningInfo) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SigningInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.SigningInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut validator_signing_info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorSigningInfo => { + if validator_signing_info__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSigningInfo", + )); + } + validator_signing_info__ = map_.next_value()?; + } + } + } + Ok(SigningInfo { + address: address__.unwrap_or_default(), + validator_signing_info: validator_signing_info__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.SigningInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorMissedBlocks { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.missed_blocks.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.ValidatorMissedBlocks", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.missed_blocks.is_empty() { + struct_ser.serialize_field("missedBlocks", &self.missed_blocks)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorMissedBlocks { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "missed_blocks", "missedBlocks"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + MissedBlocks, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "missedBlocks" | "missed_blocks" => Ok(GeneratedField::MissedBlocks), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorMissedBlocks; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.ValidatorMissedBlocks") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut missed_blocks__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::MissedBlocks => { + if missed_blocks__.is_some() { + return Err(serde::de::Error::duplicate_field("missedBlocks")); + } + missed_blocks__ = Some(map_.next_value()?); + } + } + } + Ok(ValidatorMissedBlocks { + address: address__.unwrap_or_default(), + missed_blocks: missed_blocks__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.ValidatorMissedBlocks", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValidatorSigningInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.start_height != 0 { + len += 1; + } + if self.index_offset != 0 { + len += 1; + } + if self.jailed_until.is_some() { + len += 1; + } + if self.tombstoned { + len += 1; + } + if self.missed_blocks_counter != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.slashing.v1beta1.ValidatorSigningInfo", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if self.start_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "startHeight", + ToString::to_string(&self.start_height).as_str(), + )?; + } + if self.index_offset != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "indexOffset", + ToString::to_string(&self.index_offset).as_str(), + )?; + } + if let Some(v) = self.jailed_until.as_ref() { + struct_ser.serialize_field("jailedUntil", v)?; + } + if self.tombstoned { + struct_ser.serialize_field("tombstoned", &self.tombstoned)?; + } + if self.missed_blocks_counter != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "missedBlocksCounter", + ToString::to_string(&self.missed_blocks_counter).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValidatorSigningInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "address", + "start_height", + "startHeight", + "index_offset", + "indexOffset", + "jailed_until", + "jailedUntil", + "tombstoned", + "missed_blocks_counter", + "missedBlocksCounter", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + StartHeight, + IndexOffset, + JailedUntil, + Tombstoned, + MissedBlocksCounter, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "startHeight" | "start_height" => Ok(GeneratedField::StartHeight), + "indexOffset" | "index_offset" => Ok(GeneratedField::IndexOffset), + "jailedUntil" | "jailed_until" => Ok(GeneratedField::JailedUntil), + "tombstoned" => Ok(GeneratedField::Tombstoned), + "missedBlocksCounter" | "missed_blocks_counter" => { + Ok(GeneratedField::MissedBlocksCounter) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValidatorSigningInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.slashing.v1beta1.ValidatorSigningInfo") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut start_height__ = None; + let mut index_offset__ = None; + let mut jailed_until__ = None; + let mut tombstoned__ = None; + let mut missed_blocks_counter__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::StartHeight => { + if start_height__.is_some() { + return Err(serde::de::Error::duplicate_field("startHeight")); + } + start_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::IndexOffset => { + if index_offset__.is_some() { + return Err(serde::de::Error::duplicate_field("indexOffset")); + } + index_offset__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::JailedUntil => { + if jailed_until__.is_some() { + return Err(serde::de::Error::duplicate_field("jailedUntil")); + } + jailed_until__ = map_.next_value()?; + } + GeneratedField::Tombstoned => { + if tombstoned__.is_some() { + return Err(serde::de::Error::duplicate_field("tombstoned")); + } + tombstoned__ = Some(map_.next_value()?); + } + GeneratedField::MissedBlocksCounter => { + if missed_blocks_counter__.is_some() { + return Err(serde::de::Error::duplicate_field( + "missedBlocksCounter", + )); + } + missed_blocks_counter__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ValidatorSigningInfo { + address: address__.unwrap_or_default(), + start_height: start_height__.unwrap_or_default(), + index_offset: index_offset__.unwrap_or_default(), + jailed_until: jailed_until__, + tombstoned: tombstoned__.unwrap_or_default(), + missed_blocks_counter: missed_blocks_counter__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.slashing.v1beta1.ValidatorSigningInfo", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs index 886e1139..b82d7792 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs @@ -868,5 +868,6 @@ pub struct MsgCancelUnbondingDelegation { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCancelUnbondingDelegationResponse {} +include!("cosmos.staking.v1beta1.serde.rs"); include!("cosmos.staking.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.serde.rs new file mode 100644 index 00000000..ec7d5727 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.serde.rs @@ -0,0 +1,8430 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AuthorizationType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "AUTHORIZATION_TYPE_UNSPECIFIED", + Self::Delegate => "AUTHORIZATION_TYPE_DELEGATE", + Self::Undelegate => "AUTHORIZATION_TYPE_UNDELEGATE", + Self::Redelegate => "AUTHORIZATION_TYPE_REDELEGATE", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AuthorizationType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "AUTHORIZATION_TYPE_UNSPECIFIED", + "AUTHORIZATION_TYPE_DELEGATE", + "AUTHORIZATION_TYPE_UNDELEGATE", + "AUTHORIZATION_TYPE_REDELEGATE", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuthorizationType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "AUTHORIZATION_TYPE_UNSPECIFIED" => Ok(AuthorizationType::Unspecified), + "AUTHORIZATION_TYPE_DELEGATE" => Ok(AuthorizationType::Delegate), + "AUTHORIZATION_TYPE_UNDELEGATE" => Ok(AuthorizationType::Undelegate), + "AUTHORIZATION_TYPE_REDELEGATE" => Ok(AuthorizationType::Redelegate), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BondStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "BOND_STATUS_UNSPECIFIED", + Self::Unbonded => "BOND_STATUS_UNBONDED", + Self::Unbonding => "BOND_STATUS_UNBONDING", + Self::Bonded => "BOND_STATUS_BONDED", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BondStatus { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "BOND_STATUS_UNSPECIFIED", + "BOND_STATUS_UNBONDED", + "BOND_STATUS_UNBONDING", + "BOND_STATUS_BONDED", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BondStatus; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "BOND_STATUS_UNSPECIFIED" => Ok(BondStatus::Unspecified), + "BOND_STATUS_UNBONDED" => Ok(BondStatus::Unbonded), + "BOND_STATUS_UNBONDING" => Ok(BondStatus::Unbonding), + "BOND_STATUS_BONDED" => Ok(BondStatus::Bonded), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Commission { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.commission_rates.is_some() { + len += 1; + } + if self.update_time.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.Commission", len)?; + if let Some(v) = self.commission_rates.as_ref() { + struct_ser.serialize_field("commissionRates", v)?; + } + if let Some(v) = self.update_time.as_ref() { + struct_ser.serialize_field("updateTime", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Commission { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "commission_rates", + "commissionRates", + "update_time", + "updateTime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CommissionRates, + UpdateTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "commissionRates" | "commission_rates" => { + Ok(GeneratedField::CommissionRates) + } + "updateTime" | "update_time" => Ok(GeneratedField::UpdateTime), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Commission; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Commission") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut commission_rates__ = None; + let mut update_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CommissionRates => { + if commission_rates__.is_some() { + return Err(serde::de::Error::duplicate_field("commissionRates")); + } + commission_rates__ = map_.next_value()?; + } + GeneratedField::UpdateTime => { + if update_time__.is_some() { + return Err(serde::de::Error::duplicate_field("updateTime")); + } + update_time__ = map_.next_value()?; + } + } + } + Ok(Commission { + commission_rates: commission_rates__, + update_time: update_time__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.Commission", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CommissionRates { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rate.is_empty() { + len += 1; + } + if !self.max_rate.is_empty() { + len += 1; + } + if !self.max_change_rate.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.CommissionRates", len)?; + if !self.rate.is_empty() { + struct_ser.serialize_field("rate", &self.rate)?; + } + if !self.max_rate.is_empty() { + struct_ser.serialize_field("maxRate", &self.max_rate)?; + } + if !self.max_change_rate.is_empty() { + struct_ser.serialize_field("maxChangeRate", &self.max_change_rate)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CommissionRates { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "rate", + "max_rate", + "maxRate", + "max_change_rate", + "maxChangeRate", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Rate, + MaxRate, + MaxChangeRate, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "rate" => Ok(GeneratedField::Rate), + "maxRate" | "max_rate" => Ok(GeneratedField::MaxRate), + "maxChangeRate" | "max_change_rate" => { + Ok(GeneratedField::MaxChangeRate) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CommissionRates; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.CommissionRates") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut rate__ = None; + let mut max_rate__ = None; + let mut max_change_rate__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Rate => { + if rate__.is_some() { + return Err(serde::de::Error::duplicate_field("rate")); + } + rate__ = Some(map_.next_value()?); + } + GeneratedField::MaxRate => { + if max_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("maxRate")); + } + max_rate__ = Some(map_.next_value()?); + } + GeneratedField::MaxChangeRate => { + if max_change_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("maxChangeRate")); + } + max_change_rate__ = Some(map_.next_value()?); + } + } + } + Ok(CommissionRates { + rate: rate__.unwrap_or_default(), + max_rate: max_rate__.unwrap_or_default(), + max_change_rate: max_change_rate__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.CommissionRates", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DvPair { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.staking.v1beta1.DVPair", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DvPair { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DvPair; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.DVPair") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + } + } + Ok(DvPair { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.staking.v1beta1.DVPair", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DvPairs { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.pairs.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.staking.v1beta1.DVPairs", len)?; + if !self.pairs.is_empty() { + struct_ser.serialize_field("pairs", &self.pairs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DvPairs { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pairs"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pairs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pairs" => Ok(GeneratedField::Pairs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DvPairs; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.DVPairs") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pairs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pairs => { + if pairs__.is_some() { + return Err(serde::de::Error::duplicate_field("pairs")); + } + pairs__ = Some(map_.next_value()?); + } + } + } + Ok(DvPairs { + pairs: pairs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.staking.v1beta1.DVPairs", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DvvTriplet { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_src_address.is_empty() { + len += 1; + } + if !self.validator_dst_address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.DVVTriplet", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_src_address.is_empty() { + struct_ser.serialize_field("validatorSrcAddress", &self.validator_src_address)?; + } + if !self.validator_dst_address.is_empty() { + struct_ser.serialize_field("validatorDstAddress", &self.validator_dst_address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DvvTriplet { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_src_address", + "validatorSrcAddress", + "validator_dst_address", + "validatorDstAddress", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorSrcAddress, + ValidatorDstAddress, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorSrcAddress" | "validator_src_address" => { + Ok(GeneratedField::ValidatorSrcAddress) + } + "validatorDstAddress" | "validator_dst_address" => { + Ok(GeneratedField::ValidatorDstAddress) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DvvTriplet; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.DVVTriplet") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_src_address__ = None; + let mut validator_dst_address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorSrcAddress => { + if validator_src_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSrcAddress", + )); + } + validator_src_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorDstAddress => { + if validator_dst_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorDstAddress", + )); + } + validator_dst_address__ = Some(map_.next_value()?); + } + } + } + Ok(DvvTriplet { + delegator_address: delegator_address__.unwrap_or_default(), + validator_src_address: validator_src_address__.unwrap_or_default(), + validator_dst_address: validator_dst_address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.DVVTriplet", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DvvTriplets { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.triplets.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.DVVTriplets", len)?; + if !self.triplets.is_empty() { + struct_ser.serialize_field("triplets", &self.triplets)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DvvTriplets { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["triplets"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Triplets, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "triplets" => Ok(GeneratedField::Triplets), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DvvTriplets; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.DVVTriplets") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut triplets__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Triplets => { + if triplets__.is_some() { + return Err(serde::de::Error::duplicate_field("triplets")); + } + triplets__ = Some(map_.next_value()?); + } + } + } + Ok(DvvTriplets { + triplets: triplets__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.DVVTriplets", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Delegation { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if !self.shares.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.Delegation", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if !self.shares.is_empty() { + struct_ser.serialize_field("shares", &self.shares)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Delegation { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "shares", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + Shares, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "shares" => Ok(GeneratedField::Shares), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Delegation; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Delegation") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut shares__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Shares => { + if shares__.is_some() { + return Err(serde::de::Error::duplicate_field("shares")); + } + shares__ = Some(map_.next_value()?); + } + } + } + Ok(Delegation { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + shares: shares__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.Delegation", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelegationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.delegation.is_some() { + len += 1; + } + if self.balance.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.DelegationResponse", len)?; + if let Some(v) = self.delegation.as_ref() { + struct_ser.serialize_field("delegation", v)?; + } + if let Some(v) = self.balance.as_ref() { + struct_ser.serialize_field("balance", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelegationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegation", "balance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Delegation, + Balance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegation" => Ok(GeneratedField::Delegation), + "balance" => Ok(GeneratedField::Balance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelegationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.DelegationResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegation__ = None; + let mut balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Delegation => { + if delegation__.is_some() { + return Err(serde::de::Error::duplicate_field("delegation")); + } + delegation__ = map_.next_value()?; + } + GeneratedField::Balance => { + if balance__.is_some() { + return Err(serde::de::Error::duplicate_field("balance")); + } + balance__ = map_.next_value()?; + } + } + } + Ok(DelegationResponse { + delegation: delegation__, + balance: balance__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.DelegationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Description { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.moniker.is_empty() { + len += 1; + } + if !self.identity.is_empty() { + len += 1; + } + if !self.website.is_empty() { + len += 1; + } + if !self.security_contact.is_empty() { + len += 1; + } + if !self.details.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.Description", len)?; + if !self.moniker.is_empty() { + struct_ser.serialize_field("moniker", &self.moniker)?; + } + if !self.identity.is_empty() { + struct_ser.serialize_field("identity", &self.identity)?; + } + if !self.website.is_empty() { + struct_ser.serialize_field("website", &self.website)?; + } + if !self.security_contact.is_empty() { + struct_ser.serialize_field("securityContact", &self.security_contact)?; + } + if !self.details.is_empty() { + struct_ser.serialize_field("details", &self.details)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Description { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "moniker", + "identity", + "website", + "security_contact", + "securityContact", + "details", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Moniker, + Identity, + Website, + SecurityContact, + Details, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "moniker" => Ok(GeneratedField::Moniker), + "identity" => Ok(GeneratedField::Identity), + "website" => Ok(GeneratedField::Website), + "securityContact" | "security_contact" => { + Ok(GeneratedField::SecurityContact) + } + "details" => Ok(GeneratedField::Details), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Description; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Description") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut moniker__ = None; + let mut identity__ = None; + let mut website__ = None; + let mut security_contact__ = None; + let mut details__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Moniker => { + if moniker__.is_some() { + return Err(serde::de::Error::duplicate_field("moniker")); + } + moniker__ = Some(map_.next_value()?); + } + GeneratedField::Identity => { + if identity__.is_some() { + return Err(serde::de::Error::duplicate_field("identity")); + } + identity__ = Some(map_.next_value()?); + } + GeneratedField::Website => { + if website__.is_some() { + return Err(serde::de::Error::duplicate_field("website")); + } + website__ = Some(map_.next_value()?); + } + GeneratedField::SecurityContact => { + if security_contact__.is_some() { + return Err(serde::de::Error::duplicate_field("securityContact")); + } + security_contact__ = Some(map_.next_value()?); + } + GeneratedField::Details => { + if details__.is_some() { + return Err(serde::de::Error::duplicate_field("details")); + } + details__ = Some(map_.next_value()?); + } + } + } + Ok(Description { + moniker: moniker__.unwrap_or_default(), + identity: identity__.unwrap_or_default(), + website: website__.unwrap_or_default(), + security_contact: security_contact__.unwrap_or_default(), + details: details__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.Description", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if !self.last_total_power.is_empty() { + len += 1; + } + if !self.last_validator_powers.is_empty() { + len += 1; + } + if !self.validators.is_empty() { + len += 1; + } + if !self.delegations.is_empty() { + len += 1; + } + if !self.unbonding_delegations.is_empty() { + len += 1; + } + if !self.redelegations.is_empty() { + len += 1; + } + if self.exported { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if !self.last_total_power.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "lastTotalPower", + pbjson::private::base64::encode(&self.last_total_power).as_str(), + )?; + } + if !self.last_validator_powers.is_empty() { + struct_ser.serialize_field("lastValidatorPowers", &self.last_validator_powers)?; + } + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + if !self.delegations.is_empty() { + struct_ser.serialize_field("delegations", &self.delegations)?; + } + if !self.unbonding_delegations.is_empty() { + struct_ser.serialize_field("unbondingDelegations", &self.unbonding_delegations)?; + } + if !self.redelegations.is_empty() { + struct_ser.serialize_field("redelegations", &self.redelegations)?; + } + if self.exported { + struct_ser.serialize_field("exported", &self.exported)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + "last_total_power", + "lastTotalPower", + "last_validator_powers", + "lastValidatorPowers", + "validators", + "delegations", + "unbonding_delegations", + "unbondingDelegations", + "redelegations", + "exported", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + LastTotalPower, + LastValidatorPowers, + Validators, + Delegations, + UnbondingDelegations, + Redelegations, + Exported, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "lastTotalPower" | "last_total_power" => { + Ok(GeneratedField::LastTotalPower) + } + "lastValidatorPowers" | "last_validator_powers" => { + Ok(GeneratedField::LastValidatorPowers) + } + "validators" => Ok(GeneratedField::Validators), + "delegations" => Ok(GeneratedField::Delegations), + "unbondingDelegations" | "unbonding_delegations" => { + Ok(GeneratedField::UnbondingDelegations) + } + "redelegations" => Ok(GeneratedField::Redelegations), + "exported" => Ok(GeneratedField::Exported), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut last_total_power__ = None; + let mut last_validator_powers__ = None; + let mut validators__ = None; + let mut delegations__ = None; + let mut unbonding_delegations__ = None; + let mut redelegations__ = None; + let mut exported__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::LastTotalPower => { + if last_total_power__.is_some() { + return Err(serde::de::Error::duplicate_field("lastTotalPower")); + } + last_total_power__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::LastValidatorPowers => { + if last_validator_powers__.is_some() { + return Err(serde::de::Error::duplicate_field( + "lastValidatorPowers", + )); + } + last_validator_powers__ = Some(map_.next_value()?); + } + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + GeneratedField::Delegations => { + if delegations__.is_some() { + return Err(serde::de::Error::duplicate_field("delegations")); + } + delegations__ = Some(map_.next_value()?); + } + GeneratedField::UnbondingDelegations => { + if unbonding_delegations__.is_some() { + return Err(serde::de::Error::duplicate_field( + "unbondingDelegations", + )); + } + unbonding_delegations__ = Some(map_.next_value()?); + } + GeneratedField::Redelegations => { + if redelegations__.is_some() { + return Err(serde::de::Error::duplicate_field("redelegations")); + } + redelegations__ = Some(map_.next_value()?); + } + GeneratedField::Exported => { + if exported__.is_some() { + return Err(serde::de::Error::duplicate_field("exported")); + } + exported__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + last_total_power: last_total_power__.unwrap_or_default(), + last_validator_powers: last_validator_powers__.unwrap_or_default(), + validators: validators__.unwrap_or_default(), + delegations: delegations__.unwrap_or_default(), + unbonding_delegations: unbonding_delegations__.unwrap_or_default(), + redelegations: redelegations__.unwrap_or_default(), + exported: exported__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.GenesisState", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for HistoricalInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.header.is_some() { + len += 1; + } + if !self.valset.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.HistoricalInfo", len)?; + if let Some(v) = self.header.as_ref() { + struct_ser.serialize_field("header", v)?; + } + if !self.valset.is_empty() { + struct_ser.serialize_field("valset", &self.valset)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for HistoricalInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["header", "valset"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Header, + Valset, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "header" => Ok(GeneratedField::Header), + "valset" => Ok(GeneratedField::Valset), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = HistoricalInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.HistoricalInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut header__ = None; + let mut valset__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Header => { + if header__.is_some() { + return Err(serde::de::Error::duplicate_field("header")); + } + header__ = map_.next_value()?; + } + GeneratedField::Valset => { + if valset__.is_some() { + return Err(serde::de::Error::duplicate_field("valset")); + } + valset__ = Some(map_.next_value()?); + } + } + } + Ok(HistoricalInfo { + header: header__, + valset: valset__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.HistoricalInfo", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for LastValidatorPower { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.power != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.LastValidatorPower", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if self.power != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("power", ToString::to_string(&self.power).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for LastValidatorPower { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "power"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Power, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "power" => Ok(GeneratedField::Power), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = LastValidatorPower; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.LastValidatorPower") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut power__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Power => { + if power__.is_some() { + return Err(serde::de::Error::duplicate_field("power")); + } + power__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(LastValidatorPower { + address: address__.unwrap_or_default(), + power: power__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.LastValidatorPower", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgBeginRedelegate { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_src_address.is_empty() { + len += 1; + } + if !self.validator_dst_address.is_empty() { + len += 1; + } + if self.amount.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgBeginRedelegate", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_src_address.is_empty() { + struct_ser.serialize_field("validatorSrcAddress", &self.validator_src_address)?; + } + if !self.validator_dst_address.is_empty() { + struct_ser.serialize_field("validatorDstAddress", &self.validator_dst_address)?; + } + if let Some(v) = self.amount.as_ref() { + struct_ser.serialize_field("amount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgBeginRedelegate { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_src_address", + "validatorSrcAddress", + "validator_dst_address", + "validatorDstAddress", + "amount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorSrcAddress, + ValidatorDstAddress, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorSrcAddress" | "validator_src_address" => { + Ok(GeneratedField::ValidatorSrcAddress) + } + "validatorDstAddress" | "validator_dst_address" => { + Ok(GeneratedField::ValidatorDstAddress) + } + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgBeginRedelegate; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgBeginRedelegate") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_src_address__ = None; + let mut validator_dst_address__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorSrcAddress => { + if validator_src_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSrcAddress", + )); + } + validator_src_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorDstAddress => { + if validator_dst_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorDstAddress", + )); + } + validator_dst_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = map_.next_value()?; + } + } + } + Ok(MsgBeginRedelegate { + delegator_address: delegator_address__.unwrap_or_default(), + validator_src_address: validator_src_address__.unwrap_or_default(), + validator_dst_address: validator_dst_address__.unwrap_or_default(), + amount: amount__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgBeginRedelegate", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgBeginRedelegateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.completion_time.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.MsgBeginRedelegateResponse", len)?; + if let Some(v) = self.completion_time.as_ref() { + struct_ser.serialize_field("completionTime", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgBeginRedelegateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["completion_time", "completionTime"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CompletionTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "completionTime" | "completion_time" => { + Ok(GeneratedField::CompletionTime) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgBeginRedelegateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgBeginRedelegateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut completion_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CompletionTime => { + if completion_time__.is_some() { + return Err(serde::de::Error::duplicate_field("completionTime")); + } + completion_time__ = map_.next_value()?; + } + } + } + Ok(MsgBeginRedelegateResponse { + completion_time: completion_time__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCancelUnbondingDelegation { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if self.amount.is_some() { + len += 1; + } + if self.creation_height != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.amount.as_ref() { + struct_ser.serialize_field("amount", v)?; + } + if self.creation_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "creationHeight", + ToString::to_string(&self.creation_height).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCancelUnbondingDelegation { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "amount", + "creation_height", + "creationHeight", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + Amount, + CreationHeight, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "amount" => Ok(GeneratedField::Amount), + "creationHeight" | "creation_height" => { + Ok(GeneratedField::CreationHeight) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCancelUnbondingDelegation; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgCancelUnbondingDelegation") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut amount__ = None; + let mut creation_height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = map_.next_value()?; + } + GeneratedField::CreationHeight => { + if creation_height__.is_some() { + return Err(serde::de::Error::duplicate_field("creationHeight")); + } + creation_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgCancelUnbondingDelegation { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + amount: amount__, + creation_height: creation_height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCancelUnbondingDelegationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCancelUnbondingDelegationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCancelUnbondingDelegationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCancelUnbondingDelegationResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateValidator { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.description.is_some() { + len += 1; + } + if self.commission.is_some() { + len += 1; + } + if !self.min_self_delegation.is_empty() { + len += 1; + } + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if self.pubkey.is_some() { + len += 1; + } + if self.value.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgCreateValidator", len)?; + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + if let Some(v) = self.commission.as_ref() { + struct_ser.serialize_field("commission", v)?; + } + if !self.min_self_delegation.is_empty() { + struct_ser.serialize_field("minSelfDelegation", &self.min_self_delegation)?; + } + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.pubkey.as_ref() { + struct_ser.serialize_field("pubkey", v)?; + } + if let Some(v) = self.value.as_ref() { + struct_ser.serialize_field("value", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateValidator { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "description", + "commission", + "min_self_delegation", + "minSelfDelegation", + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "pubkey", + "value", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Description, + Commission, + MinSelfDelegation, + DelegatorAddress, + ValidatorAddress, + Pubkey, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "description" => Ok(GeneratedField::Description), + "commission" => Ok(GeneratedField::Commission), + "minSelfDelegation" | "min_self_delegation" => { + Ok(GeneratedField::MinSelfDelegation) + } + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "pubkey" => Ok(GeneratedField::Pubkey), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateValidator; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgCreateValidator") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut description__ = None; + let mut commission__ = None; + let mut min_self_delegation__ = None; + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut pubkey__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::Commission => { + if commission__.is_some() { + return Err(serde::de::Error::duplicate_field("commission")); + } + commission__ = map_.next_value()?; + } + GeneratedField::MinSelfDelegation => { + if min_self_delegation__.is_some() { + return Err(serde::de::Error::duplicate_field("minSelfDelegation")); + } + min_self_delegation__ = Some(map_.next_value()?); + } + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Pubkey => { + if pubkey__.is_some() { + return Err(serde::de::Error::duplicate_field("pubkey")); + } + pubkey__ = map_.next_value()?; + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = map_.next_value()?; + } + } + } + Ok(MsgCreateValidator { + description: description__, + commission: commission__, + min_self_delegation: min_self_delegation__.unwrap_or_default(), + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + pubkey: pubkey__, + value: value__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgCreateValidator", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateValidatorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.MsgCreateValidatorResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateValidatorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateValidatorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgCreateValidatorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCreateValidatorResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgCreateValidatorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDelegate { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if self.amount.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgDelegate", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.amount.as_ref() { + struct_ser.serialize_field("amount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDelegate { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "amount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDelegate; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgDelegate") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = map_.next_value()?; + } + } + } + Ok(MsgDelegate { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + amount: amount__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgDelegate", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgDelegateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgDelegateResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgDelegateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgDelegateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgDelegateResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgDelegateResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgDelegateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgEditValidator { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.description.is_some() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if !self.commission_rate.is_empty() { + len += 1; + } + if !self.min_self_delegation.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgEditValidator", len)?; + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if !self.commission_rate.is_empty() { + struct_ser.serialize_field("commissionRate", &self.commission_rate)?; + } + if !self.min_self_delegation.is_empty() { + struct_ser.serialize_field("minSelfDelegation", &self.min_self_delegation)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgEditValidator { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "description", + "validator_address", + "validatorAddress", + "commission_rate", + "commissionRate", + "min_self_delegation", + "minSelfDelegation", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Description, + ValidatorAddress, + CommissionRate, + MinSelfDelegation, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "description" => Ok(GeneratedField::Description), + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "commissionRate" | "commission_rate" => { + Ok(GeneratedField::CommissionRate) + } + "minSelfDelegation" | "min_self_delegation" => { + Ok(GeneratedField::MinSelfDelegation) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgEditValidator; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgEditValidator") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut description__ = None; + let mut validator_address__ = None; + let mut commission_rate__ = None; + let mut min_self_delegation__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::CommissionRate => { + if commission_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("commissionRate")); + } + commission_rate__ = Some(map_.next_value()?); + } + GeneratedField::MinSelfDelegation => { + if min_self_delegation__.is_some() { + return Err(serde::de::Error::duplicate_field("minSelfDelegation")); + } + min_self_delegation__ = Some(map_.next_value()?); + } + } + } + Ok(MsgEditValidator { + description: description__, + validator_address: validator_address__.unwrap_or_default(), + commission_rate: commission_rate__.unwrap_or_default(), + min_self_delegation: min_self_delegation__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgEditValidator", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgEditValidatorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgEditValidatorResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgEditValidatorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgEditValidatorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgEditValidatorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgEditValidatorResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgEditValidatorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUndelegate { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if self.amount.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgUndelegate", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if let Some(v) = self.amount.as_ref() { + struct_ser.serialize_field("amount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUndelegate { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "amount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUndelegate; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgUndelegate") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = map_.next_value()?; + } + } + } + Ok(MsgUndelegate { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + amount: amount__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgUndelegate", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUndelegateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.completion_time.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.MsgUndelegateResponse", len)?; + if let Some(v) = self.completion_time.as_ref() { + struct_ser.serialize_field("completionTime", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUndelegateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["completion_time", "completionTime"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CompletionTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "completionTime" | "completion_time" => { + Ok(GeneratedField::CompletionTime) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUndelegateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.MsgUndelegateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut completion_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CompletionTime => { + if completion_time__.is_some() { + return Err(serde::de::Error::duplicate_field("completionTime")); + } + completion_time__ = map_.next_value()?; + } + } + } + Ok(MsgUndelegateResponse { + completion_time: completion_time__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.MsgUndelegateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.unbonding_time.is_some() { + len += 1; + } + if self.max_validators != 0 { + len += 1; + } + if self.max_entries != 0 { + len += 1; + } + if self.historical_entries != 0 { + len += 1; + } + if !self.bond_denom.is_empty() { + len += 1; + } + if !self.min_commission_rate.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.staking.v1beta1.Params", len)?; + if let Some(v) = self.unbonding_time.as_ref() { + struct_ser.serialize_field("unbondingTime", v)?; + } + if self.max_validators != 0 { + struct_ser.serialize_field("maxValidators", &self.max_validators)?; + } + if self.max_entries != 0 { + struct_ser.serialize_field("maxEntries", &self.max_entries)?; + } + if self.historical_entries != 0 { + struct_ser.serialize_field("historicalEntries", &self.historical_entries)?; + } + if !self.bond_denom.is_empty() { + struct_ser.serialize_field("bondDenom", &self.bond_denom)?; + } + if !self.min_commission_rate.is_empty() { + struct_ser.serialize_field("minCommissionRate", &self.min_commission_rate)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "unbonding_time", + "unbondingTime", + "max_validators", + "maxValidators", + "max_entries", + "maxEntries", + "historical_entries", + "historicalEntries", + "bond_denom", + "bondDenom", + "min_commission_rate", + "minCommissionRate", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + UnbondingTime, + MaxValidators, + MaxEntries, + HistoricalEntries, + BondDenom, + MinCommissionRate, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "unbondingTime" | "unbonding_time" => Ok(GeneratedField::UnbondingTime), + "maxValidators" | "max_validators" => Ok(GeneratedField::MaxValidators), + "maxEntries" | "max_entries" => Ok(GeneratedField::MaxEntries), + "historicalEntries" | "historical_entries" => { + Ok(GeneratedField::HistoricalEntries) + } + "bondDenom" | "bond_denom" => Ok(GeneratedField::BondDenom), + "minCommissionRate" | "min_commission_rate" => { + Ok(GeneratedField::MinCommissionRate) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut unbonding_time__ = None; + let mut max_validators__ = None; + let mut max_entries__ = None; + let mut historical_entries__ = None; + let mut bond_denom__ = None; + let mut min_commission_rate__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::UnbondingTime => { + if unbonding_time__.is_some() { + return Err(serde::de::Error::duplicate_field("unbondingTime")); + } + unbonding_time__ = map_.next_value()?; + } + GeneratedField::MaxValidators => { + if max_validators__.is_some() { + return Err(serde::de::Error::duplicate_field("maxValidators")); + } + max_validators__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::MaxEntries => { + if max_entries__.is_some() { + return Err(serde::de::Error::duplicate_field("maxEntries")); + } + max_entries__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::HistoricalEntries => { + if historical_entries__.is_some() { + return Err(serde::de::Error::duplicate_field("historicalEntries")); + } + historical_entries__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::BondDenom => { + if bond_denom__.is_some() { + return Err(serde::de::Error::duplicate_field("bondDenom")); + } + bond_denom__ = Some(map_.next_value()?); + } + GeneratedField::MinCommissionRate => { + if min_commission_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("minCommissionRate")); + } + min_commission_rate__ = Some(map_.next_value()?); + } + } + } + Ok(Params { + unbonding_time: unbonding_time__, + max_validators: max_validators__.unwrap_or_default(), + max_entries: max_entries__.unwrap_or_default(), + historical_entries: historical_entries__.unwrap_or_default(), + bond_denom: bond_denom__.unwrap_or_default(), + min_commission_rate: min_commission_rate__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.staking.v1beta1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Pool { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.not_bonded_tokens.is_empty() { + len += 1; + } + if !self.bonded_tokens.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.staking.v1beta1.Pool", len)?; + if !self.not_bonded_tokens.is_empty() { + struct_ser.serialize_field("notBondedTokens", &self.not_bonded_tokens)?; + } + if !self.bonded_tokens.is_empty() { + struct_ser.serialize_field("bondedTokens", &self.bonded_tokens)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Pool { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "not_bonded_tokens", + "notBondedTokens", + "bonded_tokens", + "bondedTokens", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + NotBondedTokens, + BondedTokens, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "notBondedTokens" | "not_bonded_tokens" => { + Ok(GeneratedField::NotBondedTokens) + } + "bondedTokens" | "bonded_tokens" => Ok(GeneratedField::BondedTokens), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Pool; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Pool") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut not_bonded_tokens__ = None; + let mut bonded_tokens__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::NotBondedTokens => { + if not_bonded_tokens__.is_some() { + return Err(serde::de::Error::duplicate_field("notBondedTokens")); + } + not_bonded_tokens__ = Some(map_.next_value()?); + } + GeneratedField::BondedTokens => { + if bonded_tokens__.is_some() { + return Err(serde::de::Error::duplicate_field("bondedTokens")); + } + bonded_tokens__ = Some(map_.next_value()?); + } + } + } + Ok(Pool { + not_bonded_tokens: not_bonded_tokens__.unwrap_or_default(), + bonded_tokens: bonded_tokens__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.staking.v1beta1.Pool", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if !self.validator_addr.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryDelegationRequest", len)?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_addr", + "delegatorAddr", + "validator_addr", + "validatorAddr", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + ValidatorAddr, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryDelegationRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut validator_addr__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegationRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + validator_addr: validator_addr__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegationRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.delegation_response.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryDelegationResponse", len)?; + if let Some(v) = self.delegation_response.as_ref() { + struct_ser.serialize_field("delegationResponse", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegation_response", "delegationResponse"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegationResponse, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegationResponse" | "delegation_response" => { + Ok(GeneratedField::DelegationResponse) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryDelegationResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegation_response__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegationResponse => { + if delegation_response__.is_some() { + return Err(serde::de::Error::duplicate_field( + "delegationResponse", + )); + } + delegation_response__ = map_.next_value()?; + } + } + } + Ok(QueryDelegationResponse { + delegation_response: delegation_response__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorDelegationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + len, + )?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorDelegationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_addr", "delegatorAddr", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorDelegationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorDelegationsRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorDelegationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegation_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + len, + )?; + if !self.delegation_responses.is_empty() { + struct_ser.serialize_field("delegationResponses", &self.delegation_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorDelegationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegation_responses", "delegationResponses", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegationResponses, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegationResponses" | "delegation_responses" => { + Ok(GeneratedField::DelegationResponses) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorDelegationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegation_responses__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegationResponses => { + if delegation_responses__.is_some() { + return Err(serde::de::Error::duplicate_field( + "delegationResponses", + )); + } + delegation_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorDelegationsResponse { + delegation_responses: delegation_responses__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorUnbondingDelegationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + len, + )?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorUnbondingDelegationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_addr", "delegatorAddr", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorUnbondingDelegationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorUnbondingDelegationsRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorUnbondingDelegationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.unbonding_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + len, + )?; + if !self.unbonding_responses.is_empty() { + struct_ser.serialize_field("unbondingResponses", &self.unbonding_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorUnbondingDelegationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["unbonding_responses", "unbondingResponses", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + UnbondingResponses, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "unbondingResponses" | "unbonding_responses" => { + Ok(GeneratedField::UnbondingResponses) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorUnbondingDelegationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut unbonding_responses__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::UnbondingResponses => { + if unbonding_responses__.is_some() { + return Err(serde::de::Error::duplicate_field( + "unbondingResponses", + )); + } + unbonding_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorUnbondingDelegationsResponse { + unbonding_responses: unbonding_responses__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if !self.validator_addr.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", len)?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_addr", + "delegatorAddr", + "validator_addr", + "validatorAddr", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + ValidatorAddr, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryDelegatorValidatorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut validator_addr__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + } + } + Ok(QueryDelegatorValidatorRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + validator_addr: validator_addr__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.validator.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + len, + )?; + if let Some(v) = self.validator.as_ref() { + struct_ser.serialize_field("validator", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Validator, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validator" => Ok(GeneratedField::Validator), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryDelegatorValidatorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Validator => { + if validator__.is_some() { + return Err(serde::de::Error::duplicate_field("validator")); + } + validator__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorValidatorResponse { + validator: validator__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + len, + )?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegator_addr", "delegatorAddr", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorValidatorsRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryDelegatorValidatorsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validators.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + len, + )?; + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryDelegatorValidatorsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validators", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Validators, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validators" => Ok(GeneratedField::Validators), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryDelegatorValidatorsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validators__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryDelegatorValidatorsResponse { + validators: validators__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryHistoricalInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.QueryHistoricalInfoRequest", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryHistoricalInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryHistoricalInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryHistoricalInfoRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryHistoricalInfoRequest { + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryHistoricalInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.hist.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.QueryHistoricalInfoResponse", len)?; + if let Some(v) = self.hist.as_ref() { + struct_ser.serialize_field("hist", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryHistoricalInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["hist"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Hist, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "hist" => Ok(GeneratedField::Hist), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryHistoricalInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryHistoricalInfoResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut hist__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Hist => { + if hist__.is_some() { + return Err(serde::de::Error::duplicate_field("hist")); + } + hist__ = map_.next_value()?; + } + } + } + Ok(QueryHistoricalInfoResponse { hist: hist__ }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryPoolRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryPoolRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryPoolRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryPoolRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryPoolRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryPoolRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryPoolRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryPoolResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pool.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryPoolResponse", len)?; + if let Some(v) = self.pool.as_ref() { + struct_ser.serialize_field("pool", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryPoolResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pool"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pool, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pool" => Ok(GeneratedField::Pool), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryPoolResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryPoolResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pool__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pool => { + if pool__.is_some() { + return Err(serde::de::Error::duplicate_field("pool")); + } + pool__ = map_.next_value()?; + } + } + } + Ok(QueryPoolResponse { pool: pool__ }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryPoolResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryRedelegationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if !self.src_validator_addr.is_empty() { + len += 1; + } + if !self.dst_validator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryRedelegationsRequest", len)?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if !self.src_validator_addr.is_empty() { + struct_ser.serialize_field("srcValidatorAddr", &self.src_validator_addr)?; + } + if !self.dst_validator_addr.is_empty() { + struct_ser.serialize_field("dstValidatorAddr", &self.dst_validator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryRedelegationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_addr", + "delegatorAddr", + "src_validator_addr", + "srcValidatorAddr", + "dst_validator_addr", + "dstValidatorAddr", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + SrcValidatorAddr, + DstValidatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "srcValidatorAddr" | "src_validator_addr" => { + Ok(GeneratedField::SrcValidatorAddr) + } + "dstValidatorAddr" | "dst_validator_addr" => { + Ok(GeneratedField::DstValidatorAddr) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryRedelegationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryRedelegationsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut src_validator_addr__ = None; + let mut dst_validator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::SrcValidatorAddr => { + if src_validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("srcValidatorAddr")); + } + src_validator_addr__ = Some(map_.next_value()?); + } + GeneratedField::DstValidatorAddr => { + if dst_validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("dstValidatorAddr")); + } + dst_validator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryRedelegationsRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + src_validator_addr: src_validator_addr__.unwrap_or_default(), + dst_validator_addr: dst_validator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryRedelegationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryRedelegationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.redelegation_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.QueryRedelegationsResponse", len)?; + if !self.redelegation_responses.is_empty() { + struct_ser.serialize_field("redelegationResponses", &self.redelegation_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryRedelegationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "redelegation_responses", + "redelegationResponses", + "pagination", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + RedelegationResponses, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "redelegationResponses" | "redelegation_responses" => { + Ok(GeneratedField::RedelegationResponses) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryRedelegationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryRedelegationsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut redelegation_responses__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::RedelegationResponses => { + if redelegation_responses__.is_some() { + return Err(serde::de::Error::duplicate_field( + "redelegationResponses", + )); + } + redelegation_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryRedelegationsResponse { + redelegation_responses: redelegation_responses__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryRedelegationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryUnbondingDelegationRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_addr.is_empty() { + len += 1; + } + if !self.validator_addr.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + len, + )?; + if !self.delegator_addr.is_empty() { + struct_ser.serialize_field("delegatorAddr", &self.delegator_addr)?; + } + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryUnbondingDelegationRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_addr", + "delegatorAddr", + "validator_addr", + "validatorAddr", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddr, + ValidatorAddr, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddr" | "delegator_addr" => Ok(GeneratedField::DelegatorAddr), + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryUnbondingDelegationRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryUnbondingDelegationRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_addr__ = None; + let mut validator_addr__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddr => { + if delegator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddr")); + } + delegator_addr__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + } + } + Ok(QueryUnbondingDelegationRequest { + delegator_addr: delegator_addr__.unwrap_or_default(), + validator_addr: validator_addr__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryUnbondingDelegationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.unbond.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + len, + )?; + if let Some(v) = self.unbond.as_ref() { + struct_ser.serialize_field("unbond", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryUnbondingDelegationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["unbond"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Unbond, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "unbond" => Ok(GeneratedField::Unbond), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryUnbondingDelegationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryUnbondingDelegationResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut unbond__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Unbond => { + if unbond__.is_some() { + return Err(serde::de::Error::duplicate_field("unbond")); + } + unbond__ = map_.next_value()?; + } + } + } + Ok(QueryUnbondingDelegationResponse { unbond: unbond__ }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorDelegationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + len, + )?; + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorDelegationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_addr", "validatorAddr", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorDelegationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryValidatorDelegationsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorDelegationsRequest { + validator_addr: validator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorDelegationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegation_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + len, + )?; + if !self.delegation_responses.is_empty() { + struct_ser.serialize_field("delegationResponses", &self.delegation_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorDelegationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["delegation_responses", "delegationResponses", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegationResponses, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegationResponses" | "delegation_responses" => { + Ok(GeneratedField::DelegationResponses) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorDelegationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.staking.v1beta1.QueryValidatorDelegationsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegation_responses__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegationResponses => { + if delegation_responses__.is_some() { + return Err(serde::de::Error::duplicate_field( + "delegationResponses", + )); + } + delegation_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorDelegationsResponse { + delegation_responses: delegation_responses__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_addr.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryValidatorRequest", len)?; + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_addr", "validatorAddr"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddr, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryValidatorRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_addr__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + } + } + Ok(QueryValidatorRequest { + validator_addr: validator_addr__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.validator.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryValidatorResponse", len)?; + if let Some(v) = self.validator.as_ref() { + struct_ser.serialize_field("validator", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Validator, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validator" => Ok(GeneratedField::Validator), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryValidatorResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Validator => { + if validator__.is_some() { + return Err(serde::de::Error::duplicate_field("validator")); + } + validator__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorResponse { + validator: validator__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorUnbondingDelegationsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validator_addr.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + len, + )?; + if !self.validator_addr.is_empty() { + struct_ser.serialize_field("validatorAddr", &self.validator_addr)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorUnbondingDelegationsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validator_addr", "validatorAddr", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ValidatorAddr, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validatorAddr" | "validator_addr" => Ok(GeneratedField::ValidatorAddr), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorUnbondingDelegationsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validator_addr__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ValidatorAddr => { + if validator_addr__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddr")); + } + validator_addr__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorUnbondingDelegationsRequest { + validator_addr: validator_addr__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorUnbondingDelegationsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.unbonding_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + len, + )?; + if !self.unbonding_responses.is_empty() { + struct_ser.serialize_field("unbondingResponses", &self.unbonding_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorUnbondingDelegationsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["unbonding_responses", "unbondingResponses", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + UnbondingResponses, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "unbondingResponses" | "unbonding_responses" => { + Ok(GeneratedField::UnbondingResponses) + } + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorUnbondingDelegationsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut unbonding_responses__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::UnbondingResponses => { + if unbonding_responses__.is_some() { + return Err(serde::de::Error::duplicate_field( + "unbondingResponses", + )); + } + unbonding_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorUnbondingDelegationsResponse { + unbonding_responses: unbonding_responses__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.status.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryValidatorsRequest", len)?; + if !self.status.is_empty() { + struct_ser.serialize_field("status", &self.status)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["status", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Status, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "status" => Ok(GeneratedField::Status), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryValidatorsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut status__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorsRequest { + status: status__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryValidatorsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.validators.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.QueryValidatorsResponse", len)?; + if !self.validators.is_empty() { + struct_ser.serialize_field("validators", &self.validators)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryValidatorsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["validators", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Validators, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "validators" => Ok(GeneratedField::Validators), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryValidatorsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.QueryValidatorsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut validators__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Validators => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("validators")); + } + validators__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryValidatorsResponse { + validators: validators__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.QueryValidatorsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Redelegation { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_src_address.is_empty() { + len += 1; + } + if !self.validator_dst_address.is_empty() { + len += 1; + } + if !self.entries.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.Redelegation", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_src_address.is_empty() { + struct_ser.serialize_field("validatorSrcAddress", &self.validator_src_address)?; + } + if !self.validator_dst_address.is_empty() { + struct_ser.serialize_field("validatorDstAddress", &self.validator_dst_address)?; + } + if !self.entries.is_empty() { + struct_ser.serialize_field("entries", &self.entries)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Redelegation { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_src_address", + "validatorSrcAddress", + "validator_dst_address", + "validatorDstAddress", + "entries", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorSrcAddress, + ValidatorDstAddress, + Entries, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorSrcAddress" | "validator_src_address" => { + Ok(GeneratedField::ValidatorSrcAddress) + } + "validatorDstAddress" | "validator_dst_address" => { + Ok(GeneratedField::ValidatorDstAddress) + } + "entries" => Ok(GeneratedField::Entries), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Redelegation; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Redelegation") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_src_address__ = None; + let mut validator_dst_address__ = None; + let mut entries__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorSrcAddress => { + if validator_src_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorSrcAddress", + )); + } + validator_src_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorDstAddress => { + if validator_dst_address__.is_some() { + return Err(serde::de::Error::duplicate_field( + "validatorDstAddress", + )); + } + validator_dst_address__ = Some(map_.next_value()?); + } + GeneratedField::Entries => { + if entries__.is_some() { + return Err(serde::de::Error::duplicate_field("entries")); + } + entries__ = Some(map_.next_value()?); + } + } + } + Ok(Redelegation { + delegator_address: delegator_address__.unwrap_or_default(), + validator_src_address: validator_src_address__.unwrap_or_default(), + validator_dst_address: validator_dst_address__.unwrap_or_default(), + entries: entries__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.Redelegation", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for RedelegationEntry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.creation_height != 0 { + len += 1; + } + if self.completion_time.is_some() { + len += 1; + } + if !self.initial_balance.is_empty() { + len += 1; + } + if !self.shares_dst.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.RedelegationEntry", len)?; + if self.creation_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "creationHeight", + ToString::to_string(&self.creation_height).as_str(), + )?; + } + if let Some(v) = self.completion_time.as_ref() { + struct_ser.serialize_field("completionTime", v)?; + } + if !self.initial_balance.is_empty() { + struct_ser.serialize_field("initialBalance", &self.initial_balance)?; + } + if !self.shares_dst.is_empty() { + struct_ser.serialize_field("sharesDst", &self.shares_dst)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for RedelegationEntry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "creation_height", + "creationHeight", + "completion_time", + "completionTime", + "initial_balance", + "initialBalance", + "shares_dst", + "sharesDst", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CreationHeight, + CompletionTime, + InitialBalance, + SharesDst, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "creationHeight" | "creation_height" => { + Ok(GeneratedField::CreationHeight) + } + "completionTime" | "completion_time" => { + Ok(GeneratedField::CompletionTime) + } + "initialBalance" | "initial_balance" => { + Ok(GeneratedField::InitialBalance) + } + "sharesDst" | "shares_dst" => Ok(GeneratedField::SharesDst), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RedelegationEntry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.RedelegationEntry") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut creation_height__ = None; + let mut completion_time__ = None; + let mut initial_balance__ = None; + let mut shares_dst__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CreationHeight => { + if creation_height__.is_some() { + return Err(serde::de::Error::duplicate_field("creationHeight")); + } + creation_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CompletionTime => { + if completion_time__.is_some() { + return Err(serde::de::Error::duplicate_field("completionTime")); + } + completion_time__ = map_.next_value()?; + } + GeneratedField::InitialBalance => { + if initial_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("initialBalance")); + } + initial_balance__ = Some(map_.next_value()?); + } + GeneratedField::SharesDst => { + if shares_dst__.is_some() { + return Err(serde::de::Error::duplicate_field("sharesDst")); + } + shares_dst__ = Some(map_.next_value()?); + } + } + } + Ok(RedelegationEntry { + creation_height: creation_height__.unwrap_or_default(), + completion_time: completion_time__, + initial_balance: initial_balance__.unwrap_or_default(), + shares_dst: shares_dst__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.RedelegationEntry", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for RedelegationEntryResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.redelegation_entry.is_some() { + len += 1; + } + if !self.balance.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.RedelegationEntryResponse", len)?; + if let Some(v) = self.redelegation_entry.as_ref() { + struct_ser.serialize_field("redelegationEntry", v)?; + } + if !self.balance.is_empty() { + struct_ser.serialize_field("balance", &self.balance)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for RedelegationEntryResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["redelegation_entry", "redelegationEntry", "balance"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + RedelegationEntry, + Balance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "redelegationEntry" | "redelegation_entry" => { + Ok(GeneratedField::RedelegationEntry) + } + "balance" => Ok(GeneratedField::Balance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RedelegationEntryResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.RedelegationEntryResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut redelegation_entry__ = None; + let mut balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::RedelegationEntry => { + if redelegation_entry__.is_some() { + return Err(serde::de::Error::duplicate_field("redelegationEntry")); + } + redelegation_entry__ = map_.next_value()?; + } + GeneratedField::Balance => { + if balance__.is_some() { + return Err(serde::de::Error::duplicate_field("balance")); + } + balance__ = Some(map_.next_value()?); + } + } + } + Ok(RedelegationEntryResponse { + redelegation_entry: redelegation_entry__, + balance: balance__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.RedelegationEntryResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for RedelegationResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.redelegation.is_some() { + len += 1; + } + if !self.entries.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.RedelegationResponse", len)?; + if let Some(v) = self.redelegation.as_ref() { + struct_ser.serialize_field("redelegation", v)?; + } + if !self.entries.is_empty() { + struct_ser.serialize_field("entries", &self.entries)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for RedelegationResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["redelegation", "entries"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Redelegation, + Entries, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "redelegation" => Ok(GeneratedField::Redelegation), + "entries" => Ok(GeneratedField::Entries), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RedelegationResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.RedelegationResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut redelegation__ = None; + let mut entries__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Redelegation => { + if redelegation__.is_some() { + return Err(serde::de::Error::duplicate_field("redelegation")); + } + redelegation__ = map_.next_value()?; + } + GeneratedField::Entries => { + if entries__.is_some() { + return Err(serde::de::Error::duplicate_field("entries")); + } + entries__ = Some(map_.next_value()?); + } + } + } + Ok(RedelegationResponse { + redelegation: redelegation__, + entries: entries__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.RedelegationResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StakeAuthorization { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.max_tokens.is_some() { + len += 1; + } + if self.authorization_type != 0 { + len += 1; + } + if self.validators.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.StakeAuthorization", len)?; + if let Some(v) = self.max_tokens.as_ref() { + struct_ser.serialize_field("maxTokens", v)?; + } + if self.authorization_type != 0 { + let v = AuthorizationType::try_from(self.authorization_type).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.authorization_type)) + })?; + struct_ser.serialize_field("authorizationType", &v)?; + } + if let Some(v) = self.validators.as_ref() { + match v { + stake_authorization::Policy::AllowList(v) => { + struct_ser.serialize_field("allowList", v)?; + } + stake_authorization::Policy::DenyList(v) => { + struct_ser.serialize_field("denyList", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StakeAuthorization { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "max_tokens", + "maxTokens", + "authorization_type", + "authorizationType", + "allow_list", + "allowList", + "deny_list", + "denyList", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + MaxTokens, + AuthorizationType, + AllowList, + DenyList, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "maxTokens" | "max_tokens" => Ok(GeneratedField::MaxTokens), + "authorizationType" | "authorization_type" => { + Ok(GeneratedField::AuthorizationType) + } + "allowList" | "allow_list" => Ok(GeneratedField::AllowList), + "denyList" | "deny_list" => Ok(GeneratedField::DenyList), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StakeAuthorization; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.StakeAuthorization") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut max_tokens__ = None; + let mut authorization_type__ = None; + let mut validators__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MaxTokens => { + if max_tokens__.is_some() { + return Err(serde::de::Error::duplicate_field("maxTokens")); + } + max_tokens__ = map_.next_value()?; + } + GeneratedField::AuthorizationType => { + if authorization_type__.is_some() { + return Err(serde::de::Error::duplicate_field("authorizationType")); + } + authorization_type__ = + Some(map_.next_value::()? as i32); + } + GeneratedField::AllowList => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("allowList")); + } + validators__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(stake_authorization::Policy::AllowList); + } + GeneratedField::DenyList => { + if validators__.is_some() { + return Err(serde::de::Error::duplicate_field("denyList")); + } + validators__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(stake_authorization::Policy::DenyList); + } + } + } + Ok(StakeAuthorization { + max_tokens: max_tokens__, + authorization_type: authorization_type__.unwrap_or_default(), + validators: validators__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.StakeAuthorization", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for stake_authorization::Validators { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.staking.v1beta1.StakeAuthorization.Validators", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for stake_authorization::Validators { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = stake_authorization::Validators; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.StakeAuthorization.Validators") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(stake_authorization::Validators { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.StakeAuthorization.Validators", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for UnbondingDelegation { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.delegator_address.is_empty() { + len += 1; + } + if !self.validator_address.is_empty() { + len += 1; + } + if !self.entries.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.UnbondingDelegation", len)?; + if !self.delegator_address.is_empty() { + struct_ser.serialize_field("delegatorAddress", &self.delegator_address)?; + } + if !self.validator_address.is_empty() { + struct_ser.serialize_field("validatorAddress", &self.validator_address)?; + } + if !self.entries.is_empty() { + struct_ser.serialize_field("entries", &self.entries)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for UnbondingDelegation { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "delegator_address", + "delegatorAddress", + "validator_address", + "validatorAddress", + "entries", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + DelegatorAddress, + ValidatorAddress, + Entries, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "delegatorAddress" | "delegator_address" => { + Ok(GeneratedField::DelegatorAddress) + } + "validatorAddress" | "validator_address" => { + Ok(GeneratedField::ValidatorAddress) + } + "entries" => Ok(GeneratedField::Entries), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UnbondingDelegation; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.UnbondingDelegation") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut delegator_address__ = None; + let mut validator_address__ = None; + let mut entries__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::DelegatorAddress => { + if delegator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorAddress")); + } + delegator_address__ = Some(map_.next_value()?); + } + GeneratedField::ValidatorAddress => { + if validator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("validatorAddress")); + } + validator_address__ = Some(map_.next_value()?); + } + GeneratedField::Entries => { + if entries__.is_some() { + return Err(serde::de::Error::duplicate_field("entries")); + } + entries__ = Some(map_.next_value()?); + } + } + } + Ok(UnbondingDelegation { + delegator_address: delegator_address__.unwrap_or_default(), + validator_address: validator_address__.unwrap_or_default(), + entries: entries__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.UnbondingDelegation", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for UnbondingDelegationEntry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.creation_height != 0 { + len += 1; + } + if self.completion_time.is_some() { + len += 1; + } + if !self.initial_balance.is_empty() { + len += 1; + } + if !self.balance.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.UnbondingDelegationEntry", len)?; + if self.creation_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "creationHeight", + ToString::to_string(&self.creation_height).as_str(), + )?; + } + if let Some(v) = self.completion_time.as_ref() { + struct_ser.serialize_field("completionTime", v)?; + } + if !self.initial_balance.is_empty() { + struct_ser.serialize_field("initialBalance", &self.initial_balance)?; + } + if !self.balance.is_empty() { + struct_ser.serialize_field("balance", &self.balance)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for UnbondingDelegationEntry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "creation_height", + "creationHeight", + "completion_time", + "completionTime", + "initial_balance", + "initialBalance", + "balance", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CreationHeight, + CompletionTime, + InitialBalance, + Balance, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "creationHeight" | "creation_height" => { + Ok(GeneratedField::CreationHeight) + } + "completionTime" | "completion_time" => { + Ok(GeneratedField::CompletionTime) + } + "initialBalance" | "initial_balance" => { + Ok(GeneratedField::InitialBalance) + } + "balance" => Ok(GeneratedField::Balance), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UnbondingDelegationEntry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.UnbondingDelegationEntry") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut creation_height__ = None; + let mut completion_time__ = None; + let mut initial_balance__ = None; + let mut balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CreationHeight => { + if creation_height__.is_some() { + return Err(serde::de::Error::duplicate_field("creationHeight")); + } + creation_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CompletionTime => { + if completion_time__.is_some() { + return Err(serde::de::Error::duplicate_field("completionTime")); + } + completion_time__ = map_.next_value()?; + } + GeneratedField::InitialBalance => { + if initial_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("initialBalance")); + } + initial_balance__ = Some(map_.next_value()?); + } + GeneratedField::Balance => { + if balance__.is_some() { + return Err(serde::de::Error::duplicate_field("balance")); + } + balance__ = Some(map_.next_value()?); + } + } + } + Ok(UnbondingDelegationEntry { + creation_height: creation_height__.unwrap_or_default(), + completion_time: completion_time__, + initial_balance: initial_balance__.unwrap_or_default(), + balance: balance__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.UnbondingDelegationEntry", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ValAddresses { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.addresses.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.ValAddresses", len)?; + if !self.addresses.is_empty() { + struct_ser.serialize_field("addresses", &self.addresses)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ValAddresses { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["addresses"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Addresses, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "addresses" => Ok(GeneratedField::Addresses), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ValAddresses; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.ValAddresses") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut addresses__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Addresses => { + if addresses__.is_some() { + return Err(serde::de::Error::duplicate_field("addresses")); + } + addresses__ = Some(map_.next_value()?); + } + } + } + Ok(ValAddresses { + addresses: addresses__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.ValAddresses", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Validator { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.operator_address.is_empty() { + len += 1; + } + if self.consensus_pubkey.is_some() { + len += 1; + } + if self.jailed { + len += 1; + } + if self.status != 0 { + len += 1; + } + if !self.tokens.is_empty() { + len += 1; + } + if !self.delegator_shares.is_empty() { + len += 1; + } + if self.description.is_some() { + len += 1; + } + if self.unbonding_height != 0 { + len += 1; + } + if self.unbonding_time.is_some() { + len += 1; + } + if self.commission.is_some() { + len += 1; + } + if !self.min_self_delegation.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.staking.v1beta1.Validator", len)?; + if !self.operator_address.is_empty() { + struct_ser.serialize_field("operatorAddress", &self.operator_address)?; + } + if let Some(v) = self.consensus_pubkey.as_ref() { + struct_ser.serialize_field("consensusPubkey", v)?; + } + if self.jailed { + struct_ser.serialize_field("jailed", &self.jailed)?; + } + if self.status != 0 { + let v = BondStatus::try_from(self.status).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.status)) + })?; + struct_ser.serialize_field("status", &v)?; + } + if !self.tokens.is_empty() { + struct_ser.serialize_field("tokens", &self.tokens)?; + } + if !self.delegator_shares.is_empty() { + struct_ser.serialize_field("delegatorShares", &self.delegator_shares)?; + } + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + if self.unbonding_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "unbondingHeight", + ToString::to_string(&self.unbonding_height).as_str(), + )?; + } + if let Some(v) = self.unbonding_time.as_ref() { + struct_ser.serialize_field("unbondingTime", v)?; + } + if let Some(v) = self.commission.as_ref() { + struct_ser.serialize_field("commission", v)?; + } + if !self.min_self_delegation.is_empty() { + struct_ser.serialize_field("minSelfDelegation", &self.min_self_delegation)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Validator { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "operator_address", + "operatorAddress", + "consensus_pubkey", + "consensusPubkey", + "jailed", + "status", + "tokens", + "delegator_shares", + "delegatorShares", + "description", + "unbonding_height", + "unbondingHeight", + "unbonding_time", + "unbondingTime", + "commission", + "min_self_delegation", + "minSelfDelegation", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + OperatorAddress, + ConsensusPubkey, + Jailed, + Status, + Tokens, + DelegatorShares, + Description, + UnbondingHeight, + UnbondingTime, + Commission, + MinSelfDelegation, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "operatorAddress" | "operator_address" => { + Ok(GeneratedField::OperatorAddress) + } + "consensusPubkey" | "consensus_pubkey" => { + Ok(GeneratedField::ConsensusPubkey) + } + "jailed" => Ok(GeneratedField::Jailed), + "status" => Ok(GeneratedField::Status), + "tokens" => Ok(GeneratedField::Tokens), + "delegatorShares" | "delegator_shares" => { + Ok(GeneratedField::DelegatorShares) + } + "description" => Ok(GeneratedField::Description), + "unbondingHeight" | "unbonding_height" => { + Ok(GeneratedField::UnbondingHeight) + } + "unbondingTime" | "unbonding_time" => Ok(GeneratedField::UnbondingTime), + "commission" => Ok(GeneratedField::Commission), + "minSelfDelegation" | "min_self_delegation" => { + Ok(GeneratedField::MinSelfDelegation) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Validator; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.staking.v1beta1.Validator") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut operator_address__ = None; + let mut consensus_pubkey__ = None; + let mut jailed__ = None; + let mut status__ = None; + let mut tokens__ = None; + let mut delegator_shares__ = None; + let mut description__ = None; + let mut unbonding_height__ = None; + let mut unbonding_time__ = None; + let mut commission__ = None; + let mut min_self_delegation__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::OperatorAddress => { + if operator_address__.is_some() { + return Err(serde::de::Error::duplicate_field("operatorAddress")); + } + operator_address__ = Some(map_.next_value()?); + } + GeneratedField::ConsensusPubkey => { + if consensus_pubkey__.is_some() { + return Err(serde::de::Error::duplicate_field("consensusPubkey")); + } + consensus_pubkey__ = map_.next_value()?; + } + GeneratedField::Jailed => { + if jailed__.is_some() { + return Err(serde::de::Error::duplicate_field("jailed")); + } + jailed__ = Some(map_.next_value()?); + } + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); + } + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Tokens => { + if tokens__.is_some() { + return Err(serde::de::Error::duplicate_field("tokens")); + } + tokens__ = Some(map_.next_value()?); + } + GeneratedField::DelegatorShares => { + if delegator_shares__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatorShares")); + } + delegator_shares__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::UnbondingHeight => { + if unbonding_height__.is_some() { + return Err(serde::de::Error::duplicate_field("unbondingHeight")); + } + unbonding_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::UnbondingTime => { + if unbonding_time__.is_some() { + return Err(serde::de::Error::duplicate_field("unbondingTime")); + } + unbonding_time__ = map_.next_value()?; + } + GeneratedField::Commission => { + if commission__.is_some() { + return Err(serde::de::Error::duplicate_field("commission")); + } + commission__ = map_.next_value()?; + } + GeneratedField::MinSelfDelegation => { + if min_self_delegation__.is_some() { + return Err(serde::de::Error::duplicate_field("minSelfDelegation")); + } + min_self_delegation__ = Some(map_.next_value()?); + } + } + } + Ok(Validator { + operator_address: operator_address__.unwrap_or_default(), + consensus_pubkey: consensus_pubkey__, + jailed: jailed__.unwrap_or_default(), + status: status__.unwrap_or_default(), + tokens: tokens__.unwrap_or_default(), + delegator_shares: delegator_shares__.unwrap_or_default(), + description: description__, + unbonding_height: unbonding_height__.unwrap_or_default(), + unbonding_time: unbonding_time__, + commission: commission__, + min_self_delegation: min_self_delegation__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.staking.v1beta1.Validator", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.rs index 0ce5e0a7..c98eddaf 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.rs @@ -145,4 +145,5 @@ impl SignMode { } } } +include!("cosmos.tx.signing.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.serde.rs new file mode 100644 index 00000000..3a33f86a --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.signing.v1beta1.serde.rs @@ -0,0 +1,698 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for SignMode { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "SIGN_MODE_UNSPECIFIED", + Self::Direct => "SIGN_MODE_DIRECT", + Self::Textual => "SIGN_MODE_TEXTUAL", + Self::DirectAux => "SIGN_MODE_DIRECT_AUX", + Self::LegacyAminoJson => "SIGN_MODE_LEGACY_AMINO_JSON", + Self::Eip191 => "SIGN_MODE_EIP_191", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignMode { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "SIGN_MODE_UNSPECIFIED", + "SIGN_MODE_DIRECT", + "SIGN_MODE_TEXTUAL", + "SIGN_MODE_DIRECT_AUX", + "SIGN_MODE_LEGACY_AMINO_JSON", + "SIGN_MODE_EIP_191", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignMode; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "SIGN_MODE_UNSPECIFIED" => Ok(SignMode::Unspecified), + "SIGN_MODE_DIRECT" => Ok(SignMode::Direct), + "SIGN_MODE_TEXTUAL" => Ok(SignMode::Textual), + "SIGN_MODE_DIRECT_AUX" => Ok(SignMode::DirectAux), + "SIGN_MODE_LEGACY_AMINO_JSON" => Ok(SignMode::LegacyAminoJson), + "SIGN_MODE_EIP_191" => Ok(SignMode::Eip191), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SignatureDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.public_key.is_some() { + len += 1; + } + if self.data.is_some() { + len += 1; + } + if self.sequence != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.signing.v1beta1.SignatureDescriptor", len)?; + if let Some(v) = self.public_key.as_ref() { + struct_ser.serialize_field("publicKey", v)?; + } + if let Some(v) = self.data.as_ref() { + struct_ser.serialize_field("data", v)?; + } + if self.sequence != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sequence", ToString::to_string(&self.sequence).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignatureDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["public_key", "publicKey", "data", "sequence"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PublicKey, + Data, + Sequence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "publicKey" | "public_key" => Ok(GeneratedField::PublicKey), + "data" => Ok(GeneratedField::Data), + "sequence" => Ok(GeneratedField::Sequence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignatureDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.signing.v1beta1.SignatureDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut public_key__ = None; + let mut data__ = None; + let mut sequence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::PublicKey => { + if public_key__.is_some() { + return Err(serde::de::Error::duplicate_field("publicKey")); + } + public_key__ = map_.next_value()?; + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = map_.next_value()?; + } + GeneratedField::Sequence => { + if sequence__.is_some() { + return Err(serde::de::Error::duplicate_field("sequence")); + } + sequence__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SignatureDescriptor { + public_key: public_key__, + data: data__, + sequence: sequence__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for signature_descriptor::Data { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.sum.is_some() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.tx.signing.v1beta1.SignatureDescriptor.Data", len)?; + if let Some(v) = self.sum.as_ref() { + match v { + signature_descriptor::data::Sum::Single(v) => { + struct_ser.serialize_field("single", v)?; + } + signature_descriptor::data::Sum::Multi(v) => { + struct_ser.serialize_field("multi", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for signature_descriptor::Data { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["single", "multi"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Single, + Multi, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "single" => Ok(GeneratedField::Single), + "multi" => Ok(GeneratedField::Multi), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = signature_descriptor::Data; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.signing.v1beta1.SignatureDescriptor.Data") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sum__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Single => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("single")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(signature_descriptor::data::Sum::Single); + } + GeneratedField::Multi => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("multi")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(signature_descriptor::data::Sum::Multi); + } + } + } + Ok(signature_descriptor::Data { sum: sum__ }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for signature_descriptor::data::Multi { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.bitarray.is_some() { + len += 1; + } + if !self.signatures.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi", + len, + )?; + if let Some(v) = self.bitarray.as_ref() { + struct_ser.serialize_field("bitarray", v)?; + } + if !self.signatures.is_empty() { + struct_ser.serialize_field("signatures", &self.signatures)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for signature_descriptor::data::Multi { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["bitarray", "signatures"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Bitarray, + Signatures, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bitarray" => Ok(GeneratedField::Bitarray), + "signatures" => Ok(GeneratedField::Signatures), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = signature_descriptor::data::Multi; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut bitarray__ = None; + let mut signatures__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Bitarray => { + if bitarray__.is_some() { + return Err(serde::de::Error::duplicate_field("bitarray")); + } + bitarray__ = map_.next_value()?; + } + GeneratedField::Signatures => { + if signatures__.is_some() { + return Err(serde::de::Error::duplicate_field("signatures")); + } + signatures__ = Some(map_.next_value()?); + } + } + } + Ok(signature_descriptor::data::Multi { + bitarray: bitarray__, + signatures: signatures__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for signature_descriptor::data::Single { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.mode != 0 { + len += 1; + } + if !self.signature.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single", + len, + )?; + if self.mode != 0 { + let v = SignMode::try_from(self.mode) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.mode)))?; + struct_ser.serialize_field("mode", &v)?; + } + if !self.signature.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "signature", + pbjson::private::base64::encode(&self.signature).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for signature_descriptor::data::Single { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["mode", "signature"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Mode, + Signature, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "mode" => Ok(GeneratedField::Mode), + "signature" => Ok(GeneratedField::Signature), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = signature_descriptor::data::Single; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut mode__ = None; + let mut signature__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Mode => { + if mode__.is_some() { + return Err(serde::de::Error::duplicate_field("mode")); + } + mode__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Signature => { + if signature__.is_some() { + return Err(serde::de::Error::duplicate_field("signature")); + } + signature__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(signature_descriptor::data::Single { + mode: mode__.unwrap_or_default(), + signature: signature__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SignatureDescriptors { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.signatures.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.signing.v1beta1.SignatureDescriptors", len)?; + if !self.signatures.is_empty() { + struct_ser.serialize_field("signatures", &self.signatures)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignatureDescriptors { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["signatures"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Signatures, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "signatures" => Ok(GeneratedField::Signatures), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignatureDescriptors; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.signing.v1beta1.SignatureDescriptors") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut signatures__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Signatures => { + if signatures__.is_some() { + return Err(serde::de::Error::duplicate_field("signatures")); + } + signatures__ = Some(map_.next_value()?); + } + } + } + Ok(SignatureDescriptors { + signatures: signatures__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.signing.v1beta1.SignatureDescriptors", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs index 363a157f..def3d18b 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs @@ -498,5 +498,6 @@ impl BroadcastMode { } } } +include!("cosmos.tx.v1beta1.serde.rs"); include!("cosmos.tx.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.serde.rs new file mode 100644 index 00000000..37cc696a --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.serde.rs @@ -0,0 +1,3306 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AuthInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.signer_infos.is_empty() { + len += 1; + } + if self.fee.is_some() { + len += 1; + } + if self.tip.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.AuthInfo", len)?; + if !self.signer_infos.is_empty() { + struct_ser.serialize_field("signerInfos", &self.signer_infos)?; + } + if let Some(v) = self.fee.as_ref() { + struct_ser.serialize_field("fee", v)?; + } + if let Some(v) = self.tip.as_ref() { + struct_ser.serialize_field("tip", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AuthInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["signer_infos", "signerInfos", "fee", "tip"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SignerInfos, + Fee, + Tip, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "signerInfos" | "signer_infos" => Ok(GeneratedField::SignerInfos), + "fee" => Ok(GeneratedField::Fee), + "tip" => Ok(GeneratedField::Tip), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuthInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.AuthInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut signer_infos__ = None; + let mut fee__ = None; + let mut tip__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SignerInfos => { + if signer_infos__.is_some() { + return Err(serde::de::Error::duplicate_field("signerInfos")); + } + signer_infos__ = Some(map_.next_value()?); + } + GeneratedField::Fee => { + if fee__.is_some() { + return Err(serde::de::Error::duplicate_field("fee")); + } + fee__ = map_.next_value()?; + } + GeneratedField::Tip => { + if tip__.is_some() { + return Err(serde::de::Error::duplicate_field("tip")); + } + tip__ = map_.next_value()?; + } + } + } + Ok(AuthInfo { + signer_infos: signer_infos__.unwrap_or_default(), + fee: fee__, + tip: tip__, + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.AuthInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AuxSignerData { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.sign_doc.is_some() { + len += 1; + } + if self.mode != 0 { + len += 1; + } + if !self.sig.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.AuxSignerData", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.sign_doc.as_ref() { + struct_ser.serialize_field("signDoc", v)?; + } + if self.mode != 0 { + let v = super::signing::v1beta1::SignMode::try_from(self.mode) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.mode)))?; + struct_ser.serialize_field("mode", &v)?; + } + if !self.sig.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("sig", pbjson::private::base64::encode(&self.sig).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AuxSignerData { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "sign_doc", "signDoc", "mode", "sig"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + SignDoc, + Mode, + Sig, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "signDoc" | "sign_doc" => Ok(GeneratedField::SignDoc), + "mode" => Ok(GeneratedField::Mode), + "sig" => Ok(GeneratedField::Sig), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuxSignerData; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.AuxSignerData") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut sign_doc__ = None; + let mut mode__ = None; + let mut sig__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::SignDoc => { + if sign_doc__.is_some() { + return Err(serde::de::Error::duplicate_field("signDoc")); + } + sign_doc__ = map_.next_value()?; + } + GeneratedField::Mode => { + if mode__.is_some() { + return Err(serde::de::Error::duplicate_field("mode")); + } + mode__ = Some( + map_.next_value::()? as i32 + ); + } + GeneratedField::Sig => { + if sig__.is_some() { + return Err(serde::de::Error::duplicate_field("sig")); + } + sig__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(AuxSignerData { + address: address__.unwrap_or_default(), + sign_doc: sign_doc__, + mode: mode__.unwrap_or_default(), + sig: sig__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.AuxSignerData", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BroadcastMode { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "BROADCAST_MODE_UNSPECIFIED", + Self::Block => "BROADCAST_MODE_BLOCK", + Self::Sync => "BROADCAST_MODE_SYNC", + Self::Async => "BROADCAST_MODE_ASYNC", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BroadcastMode { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "BROADCAST_MODE_UNSPECIFIED", + "BROADCAST_MODE_BLOCK", + "BROADCAST_MODE_SYNC", + "BROADCAST_MODE_ASYNC", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BroadcastMode; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "BROADCAST_MODE_UNSPECIFIED" => Ok(BroadcastMode::Unspecified), + "BROADCAST_MODE_BLOCK" => Ok(BroadcastMode::Block), + "BROADCAST_MODE_SYNC" => Ok(BroadcastMode::Sync), + "BROADCAST_MODE_ASYNC" => Ok(BroadcastMode::Async), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BroadcastTxRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.tx_bytes.is_empty() { + len += 1; + } + if self.mode != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.BroadcastTxRequest", len)?; + if !self.tx_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "txBytes", + pbjson::private::base64::encode(&self.tx_bytes).as_str(), + )?; + } + if self.mode != 0 { + let v = BroadcastMode::try_from(self.mode) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.mode)))?; + struct_ser.serialize_field("mode", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BroadcastTxRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tx_bytes", "txBytes", "mode"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TxBytes, + Mode, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "txBytes" | "tx_bytes" => Ok(GeneratedField::TxBytes), + "mode" => Ok(GeneratedField::Mode), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BroadcastTxRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.BroadcastTxRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tx_bytes__ = None; + let mut mode__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TxBytes => { + if tx_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("txBytes")); + } + tx_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Mode => { + if mode__.is_some() { + return Err(serde::de::Error::duplicate_field("mode")); + } + mode__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(BroadcastTxRequest { + tx_bytes: tx_bytes__.unwrap_or_default(), + mode: mode__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.BroadcastTxRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for BroadcastTxResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tx_response.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.BroadcastTxResponse", len)?; + if let Some(v) = self.tx_response.as_ref() { + struct_ser.serialize_field("txResponse", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BroadcastTxResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tx_response", "txResponse"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TxResponse, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "txResponse" | "tx_response" => Ok(GeneratedField::TxResponse), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BroadcastTxResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.BroadcastTxResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tx_response__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TxResponse => { + if tx_response__.is_some() { + return Err(serde::de::Error::duplicate_field("txResponse")); + } + tx_response__ = map_.next_value()?; + } + } + } + Ok(BroadcastTxResponse { + tx_response: tx_response__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.BroadcastTxResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Fee { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.amount.is_empty() { + len += 1; + } + if self.gas_limit != 0 { + len += 1; + } + if !self.payer.is_empty() { + len += 1; + } + if !self.granter.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.Fee", len)?; + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + if self.gas_limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("gasLimit", ToString::to_string(&self.gas_limit).as_str())?; + } + if !self.payer.is_empty() { + struct_ser.serialize_field("payer", &self.payer)?; + } + if !self.granter.is_empty() { + struct_ser.serialize_field("granter", &self.granter)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Fee { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount", "gas_limit", "gasLimit", "payer", "granter"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + GasLimit, + Payer, + Granter, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + "gasLimit" | "gas_limit" => Ok(GeneratedField::GasLimit), + "payer" => Ok(GeneratedField::Payer), + "granter" => Ok(GeneratedField::Granter), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Fee; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.Fee") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + let mut gas_limit__ = None; + let mut payer__ = None; + let mut granter__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + GeneratedField::GasLimit => { + if gas_limit__.is_some() { + return Err(serde::de::Error::duplicate_field("gasLimit")); + } + gas_limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Payer => { + if payer__.is_some() { + return Err(serde::de::Error::duplicate_field("payer")); + } + payer__ = Some(map_.next_value()?); + } + GeneratedField::Granter => { + if granter__.is_some() { + return Err(serde::de::Error::duplicate_field("granter")); + } + granter__ = Some(map_.next_value()?); + } + } + } + Ok(Fee { + amount: amount__.unwrap_or_default(), + gas_limit: gas_limit__.unwrap_or_default(), + payer: payer__.unwrap_or_default(), + granter: granter__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.Fee", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetBlockWithTxsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.GetBlockWithTxsRequest", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetBlockWithTxsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetBlockWithTxsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetBlockWithTxsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetBlockWithTxsRequest { + height: height__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.GetBlockWithTxsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetBlockWithTxsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.txs.is_empty() { + len += 1; + } + if self.block_id.is_some() { + len += 1; + } + if self.block.is_some() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.GetBlockWithTxsResponse", len)?; + if !self.txs.is_empty() { + struct_ser.serialize_field("txs", &self.txs)?; + } + if let Some(v) = self.block_id.as_ref() { + struct_ser.serialize_field("blockId", v)?; + } + if let Some(v) = self.block.as_ref() { + struct_ser.serialize_field("block", v)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetBlockWithTxsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["txs", "block_id", "blockId", "block", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Txs, + BlockId, + Block, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "txs" => Ok(GeneratedField::Txs), + "blockId" | "block_id" => Ok(GeneratedField::BlockId), + "block" => Ok(GeneratedField::Block), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetBlockWithTxsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetBlockWithTxsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut txs__ = None; + let mut block_id__ = None; + let mut block__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Txs => { + if txs__.is_some() { + return Err(serde::de::Error::duplicate_field("txs")); + } + txs__ = Some(map_.next_value()?); + } + GeneratedField::BlockId => { + if block_id__.is_some() { + return Err(serde::de::Error::duplicate_field("blockId")); + } + block_id__ = map_.next_value()?; + } + GeneratedField::Block => { + if block__.is_some() { + return Err(serde::de::Error::duplicate_field("block")); + } + block__ = map_.next_value()?; + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(GetBlockWithTxsResponse { + txs: txs__.unwrap_or_default(), + block_id: block_id__, + block: block__, + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.GetBlockWithTxsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.hash.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.GetTxRequest", len)?; + if !self.hash.is_empty() { + struct_ser.serialize_field("hash", &self.hash)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["hash"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Hash, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "hash" => Ok(GeneratedField::Hash), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetTxRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut hash__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Hash => { + if hash__.is_some() { + return Err(serde::de::Error::duplicate_field("hash")); + } + hash__ = Some(map_.next_value()?); + } + } + } + Ok(GetTxRequest { + hash: hash__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.GetTxRequest", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tx.is_some() { + len += 1; + } + if self.tx_response.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.GetTxResponse", len)?; + if let Some(v) = self.tx.as_ref() { + struct_ser.serialize_field("tx", v)?; + } + if let Some(v) = self.tx_response.as_ref() { + struct_ser.serialize_field("txResponse", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tx", "tx_response", "txResponse"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tx, + TxResponse, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tx" => Ok(GeneratedField::Tx), + "txResponse" | "tx_response" => Ok(GeneratedField::TxResponse), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetTxResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tx__ = None; + let mut tx_response__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tx => { + if tx__.is_some() { + return Err(serde::de::Error::duplicate_field("tx")); + } + tx__ = map_.next_value()?; + } + GeneratedField::TxResponse => { + if tx_response__.is_some() { + return Err(serde::de::Error::duplicate_field("txResponse")); + } + tx_response__ = map_.next_value()?; + } + } + } + Ok(GetTxResponse { + tx: tx__, + tx_response: tx_response__, + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.GetTxResponse", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxsEventRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.events.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + if self.order_by != 0 { + len += 1; + } + if self.page != 0 { + len += 1; + } + if self.limit != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.GetTxsEventRequest", len)?; + if !self.events.is_empty() { + struct_ser.serialize_field("events", &self.events)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + if self.order_by != 0 { + let v = OrderBy::try_from(self.order_by).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.order_by)) + })?; + struct_ser.serialize_field("orderBy", &v)?; + } + if self.page != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("page", ToString::to_string(&self.page).as_str())?; + } + if self.limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("limit", ToString::to_string(&self.limit).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxsEventRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "events", + "pagination", + "order_by", + "orderBy", + "page", + "limit", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Events, + Pagination, + OrderBy, + Page, + Limit, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "events" => Ok(GeneratedField::Events), + "pagination" => Ok(GeneratedField::Pagination), + "orderBy" | "order_by" => Ok(GeneratedField::OrderBy), + "page" => Ok(GeneratedField::Page), + "limit" => Ok(GeneratedField::Limit), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxsEventRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetTxsEventRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut events__ = None; + let mut pagination__ = None; + let mut order_by__ = None; + let mut page__ = None; + let mut limit__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Events => { + if events__.is_some() { + return Err(serde::de::Error::duplicate_field("events")); + } + events__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + GeneratedField::OrderBy => { + if order_by__.is_some() { + return Err(serde::de::Error::duplicate_field("orderBy")); + } + order_by__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Page => { + if page__.is_some() { + return Err(serde::de::Error::duplicate_field("page")); + } + page__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Limit => { + if limit__.is_some() { + return Err(serde::de::Error::duplicate_field("limit")); + } + limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(GetTxsEventRequest { + events: events__.unwrap_or_default(), + pagination: pagination__, + order_by: order_by__.unwrap_or_default(), + page: page__.unwrap_or_default(), + limit: limit__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.GetTxsEventRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GetTxsEventResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.txs.is_empty() { + len += 1; + } + if !self.tx_responses.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + if self.total != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.GetTxsEventResponse", len)?; + if !self.txs.is_empty() { + struct_ser.serialize_field("txs", &self.txs)?; + } + if !self.tx_responses.is_empty() { + struct_ser.serialize_field("txResponses", &self.tx_responses)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + if self.total != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("total", ToString::to_string(&self.total).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GetTxsEventResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["txs", "tx_responses", "txResponses", "pagination", "total"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Txs, + TxResponses, + Pagination, + Total, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "txs" => Ok(GeneratedField::Txs), + "txResponses" | "tx_responses" => Ok(GeneratedField::TxResponses), + "pagination" => Ok(GeneratedField::Pagination), + "total" => Ok(GeneratedField::Total), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GetTxsEventResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.GetTxsEventResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut txs__ = None; + let mut tx_responses__ = None; + let mut pagination__ = None; + let mut total__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Txs => { + if txs__.is_some() { + return Err(serde::de::Error::duplicate_field("txs")); + } + txs__ = Some(map_.next_value()?); + } + GeneratedField::TxResponses => { + if tx_responses__.is_some() { + return Err(serde::de::Error::duplicate_field("txResponses")); + } + tx_responses__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + GeneratedField::Total => { + if total__.is_some() { + return Err(serde::de::Error::duplicate_field("total")); + } + total__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(GetTxsEventResponse { + txs: txs__.unwrap_or_default(), + tx_responses: tx_responses__.unwrap_or_default(), + pagination: pagination__, + total: total__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.GetTxsEventResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ModeInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.sum.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.ModeInfo", len)?; + if let Some(v) = self.sum.as_ref() { + match v { + mode_info::Sum::Single(v) => { + struct_ser.serialize_field("single", v)?; + } + mode_info::Sum::Multi(v) => { + struct_ser.serialize_field("multi", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModeInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["single", "multi"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Single, + Multi, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "single" => Ok(GeneratedField::Single), + "multi" => Ok(GeneratedField::Multi), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModeInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.ModeInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sum__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Single => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("single")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(mode_info::Sum::Single); + } + GeneratedField::Multi => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("multi")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(mode_info::Sum::Multi); + } + } + } + Ok(ModeInfo { sum: sum__ }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.ModeInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for mode_info::Multi { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.bitarray.is_some() { + len += 1; + } + if !self.mode_infos.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.ModeInfo.Multi", len)?; + if let Some(v) = self.bitarray.as_ref() { + struct_ser.serialize_field("bitarray", v)?; + } + if !self.mode_infos.is_empty() { + struct_ser.serialize_field("modeInfos", &self.mode_infos)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for mode_info::Multi { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["bitarray", "mode_infos", "modeInfos"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Bitarray, + ModeInfos, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bitarray" => Ok(GeneratedField::Bitarray), + "modeInfos" | "mode_infos" => Ok(GeneratedField::ModeInfos), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = mode_info::Multi; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.ModeInfo.Multi") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut bitarray__ = None; + let mut mode_infos__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Bitarray => { + if bitarray__.is_some() { + return Err(serde::de::Error::duplicate_field("bitarray")); + } + bitarray__ = map_.next_value()?; + } + GeneratedField::ModeInfos => { + if mode_infos__.is_some() { + return Err(serde::de::Error::duplicate_field("modeInfos")); + } + mode_infos__ = Some(map_.next_value()?); + } + } + } + Ok(mode_info::Multi { + bitarray: bitarray__, + mode_infos: mode_infos__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.ModeInfo.Multi", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for mode_info::Single { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.mode != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.ModeInfo.Single", len)?; + if self.mode != 0 { + let v = super::signing::v1beta1::SignMode::try_from(self.mode) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.mode)))?; + struct_ser.serialize_field("mode", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for mode_info::Single { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["mode"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Mode, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "mode" => Ok(GeneratedField::Mode), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = mode_info::Single; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.ModeInfo.Single") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut mode__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Mode => { + if mode__.is_some() { + return Err(serde::de::Error::duplicate_field("mode")); + } + mode__ = Some( + map_.next_value::()? as i32 + ); + } + } + } + Ok(mode_info::Single { + mode: mode__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.ModeInfo.Single", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for OrderBy { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "ORDER_BY_UNSPECIFIED", + Self::Asc => "ORDER_BY_ASC", + Self::Desc => "ORDER_BY_DESC", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for OrderBy { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["ORDER_BY_UNSPECIFIED", "ORDER_BY_ASC", "ORDER_BY_DESC"]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = OrderBy; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "ORDER_BY_UNSPECIFIED" => Ok(OrderBy::Unspecified), + "ORDER_BY_ASC" => Ok(OrderBy::Asc), + "ORDER_BY_DESC" => Ok(OrderBy::Desc), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SignDoc { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.body_bytes.is_empty() { + len += 1; + } + if !self.auth_info_bytes.is_empty() { + len += 1; + } + if !self.chain_id.is_empty() { + len += 1; + } + if self.account_number != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.SignDoc", len)?; + if !self.body_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "bodyBytes", + pbjson::private::base64::encode(&self.body_bytes).as_str(), + )?; + } + if !self.auth_info_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "authInfoBytes", + pbjson::private::base64::encode(&self.auth_info_bytes).as_str(), + )?; + } + if !self.chain_id.is_empty() { + struct_ser.serialize_field("chainId", &self.chain_id)?; + } + if self.account_number != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "accountNumber", + ToString::to_string(&self.account_number).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignDoc { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "body_bytes", + "bodyBytes", + "auth_info_bytes", + "authInfoBytes", + "chain_id", + "chainId", + "account_number", + "accountNumber", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BodyBytes, + AuthInfoBytes, + ChainId, + AccountNumber, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bodyBytes" | "body_bytes" => Ok(GeneratedField::BodyBytes), + "authInfoBytes" | "auth_info_bytes" => { + Ok(GeneratedField::AuthInfoBytes) + } + "chainId" | "chain_id" => Ok(GeneratedField::ChainId), + "accountNumber" | "account_number" => Ok(GeneratedField::AccountNumber), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignDoc; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.SignDoc") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut body_bytes__ = None; + let mut auth_info_bytes__ = None; + let mut chain_id__ = None; + let mut account_number__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BodyBytes => { + if body_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("bodyBytes")); + } + body_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::AuthInfoBytes => { + if auth_info_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("authInfoBytes")); + } + auth_info_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::ChainId => { + if chain_id__.is_some() { + return Err(serde::de::Error::duplicate_field("chainId")); + } + chain_id__ = Some(map_.next_value()?); + } + GeneratedField::AccountNumber => { + if account_number__.is_some() { + return Err(serde::de::Error::duplicate_field("accountNumber")); + } + account_number__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SignDoc { + body_bytes: body_bytes__.unwrap_or_default(), + auth_info_bytes: auth_info_bytes__.unwrap_or_default(), + chain_id: chain_id__.unwrap_or_default(), + account_number: account_number__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.SignDoc", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SignDocDirectAux { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.body_bytes.is_empty() { + len += 1; + } + if self.public_key.is_some() { + len += 1; + } + if !self.chain_id.is_empty() { + len += 1; + } + if self.account_number != 0 { + len += 1; + } + if self.sequence != 0 { + len += 1; + } + if self.tip.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.SignDocDirectAux", len)?; + if !self.body_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "bodyBytes", + pbjson::private::base64::encode(&self.body_bytes).as_str(), + )?; + } + if let Some(v) = self.public_key.as_ref() { + struct_ser.serialize_field("publicKey", v)?; + } + if !self.chain_id.is_empty() { + struct_ser.serialize_field("chainId", &self.chain_id)?; + } + if self.account_number != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "accountNumber", + ToString::to_string(&self.account_number).as_str(), + )?; + } + if self.sequence != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sequence", ToString::to_string(&self.sequence).as_str())?; + } + if let Some(v) = self.tip.as_ref() { + struct_ser.serialize_field("tip", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignDocDirectAux { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "body_bytes", + "bodyBytes", + "public_key", + "publicKey", + "chain_id", + "chainId", + "account_number", + "accountNumber", + "sequence", + "tip", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BodyBytes, + PublicKey, + ChainId, + AccountNumber, + Sequence, + Tip, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bodyBytes" | "body_bytes" => Ok(GeneratedField::BodyBytes), + "publicKey" | "public_key" => Ok(GeneratedField::PublicKey), + "chainId" | "chain_id" => Ok(GeneratedField::ChainId), + "accountNumber" | "account_number" => Ok(GeneratedField::AccountNumber), + "sequence" => Ok(GeneratedField::Sequence), + "tip" => Ok(GeneratedField::Tip), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignDocDirectAux; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.SignDocDirectAux") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut body_bytes__ = None; + let mut public_key__ = None; + let mut chain_id__ = None; + let mut account_number__ = None; + let mut sequence__ = None; + let mut tip__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BodyBytes => { + if body_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("bodyBytes")); + } + body_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::PublicKey => { + if public_key__.is_some() { + return Err(serde::de::Error::duplicate_field("publicKey")); + } + public_key__ = map_.next_value()?; + } + GeneratedField::ChainId => { + if chain_id__.is_some() { + return Err(serde::de::Error::duplicate_field("chainId")); + } + chain_id__ = Some(map_.next_value()?); + } + GeneratedField::AccountNumber => { + if account_number__.is_some() { + return Err(serde::de::Error::duplicate_field("accountNumber")); + } + account_number__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Sequence => { + if sequence__.is_some() { + return Err(serde::de::Error::duplicate_field("sequence")); + } + sequence__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Tip => { + if tip__.is_some() { + return Err(serde::de::Error::duplicate_field("tip")); + } + tip__ = map_.next_value()?; + } + } + } + Ok(SignDocDirectAux { + body_bytes: body_bytes__.unwrap_or_default(), + public_key: public_key__, + chain_id: chain_id__.unwrap_or_default(), + account_number: account_number__.unwrap_or_default(), + sequence: sequence__.unwrap_or_default(), + tip: tip__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.SignDocDirectAux", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SignerInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.public_key.is_some() { + len += 1; + } + if self.mode_info.is_some() { + len += 1; + } + if self.sequence != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.SignerInfo", len)?; + if let Some(v) = self.public_key.as_ref() { + struct_ser.serialize_field("publicKey", v)?; + } + if let Some(v) = self.mode_info.as_ref() { + struct_ser.serialize_field("modeInfo", v)?; + } + if self.sequence != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sequence", ToString::to_string(&self.sequence).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SignerInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "public_key", + "publicKey", + "mode_info", + "modeInfo", + "sequence", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + PublicKey, + ModeInfo, + Sequence, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "publicKey" | "public_key" => Ok(GeneratedField::PublicKey), + "modeInfo" | "mode_info" => Ok(GeneratedField::ModeInfo), + "sequence" => Ok(GeneratedField::Sequence), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SignerInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.SignerInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut public_key__ = None; + let mut mode_info__ = None; + let mut sequence__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::PublicKey => { + if public_key__.is_some() { + return Err(serde::de::Error::duplicate_field("publicKey")); + } + public_key__ = map_.next_value()?; + } + GeneratedField::ModeInfo => { + if mode_info__.is_some() { + return Err(serde::de::Error::duplicate_field("modeInfo")); + } + mode_info__ = map_.next_value()?; + } + GeneratedField::Sequence => { + if sequence__.is_some() { + return Err(serde::de::Error::duplicate_field("sequence")); + } + sequence__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SignerInfo { + public_key: public_key__, + mode_info: mode_info__, + sequence: sequence__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.SignerInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SimulateRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.tx.is_some() { + len += 1; + } + if !self.tx_bytes.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.SimulateRequest", len)?; + if let Some(v) = self.tx.as_ref() { + struct_ser.serialize_field("tx", v)?; + } + if !self.tx_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "txBytes", + pbjson::private::base64::encode(&self.tx_bytes).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SimulateRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["tx", "tx_bytes", "txBytes"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Tx, + TxBytes, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "tx" => Ok(GeneratedField::Tx), + "txBytes" | "tx_bytes" => Ok(GeneratedField::TxBytes), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SimulateRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.SimulateRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut tx__ = None; + let mut tx_bytes__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Tx => { + if tx__.is_some() { + return Err(serde::de::Error::duplicate_field("tx")); + } + tx__ = map_.next_value()?; + } + GeneratedField::TxBytes => { + if tx_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("txBytes")); + } + tx_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SimulateRequest { + tx: tx__, + tx_bytes: tx_bytes__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.SimulateRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SimulateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.gas_info.is_some() { + len += 1; + } + if self.result.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.tx.v1beta1.SimulateResponse", len)?; + if let Some(v) = self.gas_info.as_ref() { + struct_ser.serialize_field("gasInfo", v)?; + } + if let Some(v) = self.result.as_ref() { + struct_ser.serialize_field("result", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SimulateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["gas_info", "gasInfo", "result"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + GasInfo, + Result, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "gasInfo" | "gas_info" => Ok(GeneratedField::GasInfo), + "result" => Ok(GeneratedField::Result), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SimulateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.SimulateResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut gas_info__ = None; + let mut result__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::GasInfo => { + if gas_info__.is_some() { + return Err(serde::de::Error::duplicate_field("gasInfo")); + } + gas_info__ = map_.next_value()?; + } + GeneratedField::Result => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("result")); + } + result__ = map_.next_value()?; + } + } + } + Ok(SimulateResponse { + gas_info: gas_info__, + result: result__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.tx.v1beta1.SimulateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Tip { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.amount.is_empty() { + len += 1; + } + if !self.tipper.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.Tip", len)?; + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + if !self.tipper.is_empty() { + struct_ser.serialize_field("tipper", &self.tipper)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Tip { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["amount", "tipper"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Amount, + Tipper, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "amount" => Ok(GeneratedField::Amount), + "tipper" => Ok(GeneratedField::Tipper), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Tip; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.Tip") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut amount__ = None; + let mut tipper__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + GeneratedField::Tipper => { + if tipper__.is_some() { + return Err(serde::de::Error::duplicate_field("tipper")); + } + tipper__ = Some(map_.next_value()?); + } + } + } + Ok(Tip { + amount: amount__.unwrap_or_default(), + tipper: tipper__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.Tip", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Tx { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.body.is_some() { + len += 1; + } + if self.auth_info.is_some() { + len += 1; + } + if !self.signatures.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.Tx", len)?; + if let Some(v) = self.body.as_ref() { + struct_ser.serialize_field("body", v)?; + } + if let Some(v) = self.auth_info.as_ref() { + struct_ser.serialize_field("authInfo", v)?; + } + if !self.signatures.is_empty() { + struct_ser.serialize_field( + "signatures", + &self + .signatures + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Tx { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["body", "auth_info", "authInfo", "signatures"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Body, + AuthInfo, + Signatures, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "body" => Ok(GeneratedField::Body), + "authInfo" | "auth_info" => Ok(GeneratedField::AuthInfo), + "signatures" => Ok(GeneratedField::Signatures), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Tx; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.Tx") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut body__ = None; + let mut auth_info__ = None; + let mut signatures__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Body => { + if body__.is_some() { + return Err(serde::de::Error::duplicate_field("body")); + } + body__ = map_.next_value()?; + } + GeneratedField::AuthInfo => { + if auth_info__.is_some() { + return Err(serde::de::Error::duplicate_field("authInfo")); + } + auth_info__ = map_.next_value()?; + } + GeneratedField::Signatures => { + if signatures__.is_some() { + return Err(serde::de::Error::duplicate_field("signatures")); + } + signatures__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(Tx { + body: body__, + auth_info: auth_info__, + signatures: signatures__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.Tx", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TxBody { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.messages.is_empty() { + len += 1; + } + if !self.memo.is_empty() { + len += 1; + } + if self.timeout_height != 0 { + len += 1; + } + if !self.extension_options.is_empty() { + len += 1; + } + if !self.non_critical_extension_options.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.TxBody", len)?; + if !self.messages.is_empty() { + struct_ser.serialize_field("messages", &self.messages)?; + } + if !self.memo.is_empty() { + struct_ser.serialize_field("memo", &self.memo)?; + } + if self.timeout_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "timeoutHeight", + ToString::to_string(&self.timeout_height).as_str(), + )?; + } + if !self.extension_options.is_empty() { + struct_ser.serialize_field("extensionOptions", &self.extension_options)?; + } + if !self.non_critical_extension_options.is_empty() { + struct_ser.serialize_field( + "nonCriticalExtensionOptions", + &self.non_critical_extension_options, + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TxBody { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "messages", + "memo", + "timeout_height", + "timeoutHeight", + "extension_options", + "extensionOptions", + "non_critical_extension_options", + "nonCriticalExtensionOptions", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Messages, + Memo, + TimeoutHeight, + ExtensionOptions, + NonCriticalExtensionOptions, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "messages" => Ok(GeneratedField::Messages), + "memo" => Ok(GeneratedField::Memo), + "timeoutHeight" | "timeout_height" => Ok(GeneratedField::TimeoutHeight), + "extensionOptions" | "extension_options" => { + Ok(GeneratedField::ExtensionOptions) + } + "nonCriticalExtensionOptions" | "non_critical_extension_options" => { + Ok(GeneratedField::NonCriticalExtensionOptions) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TxBody; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.TxBody") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut messages__ = None; + let mut memo__ = None; + let mut timeout_height__ = None; + let mut extension_options__ = None; + let mut non_critical_extension_options__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Messages => { + if messages__.is_some() { + return Err(serde::de::Error::duplicate_field("messages")); + } + messages__ = Some(map_.next_value()?); + } + GeneratedField::Memo => { + if memo__.is_some() { + return Err(serde::de::Error::duplicate_field("memo")); + } + memo__ = Some(map_.next_value()?); + } + GeneratedField::TimeoutHeight => { + if timeout_height__.is_some() { + return Err(serde::de::Error::duplicate_field("timeoutHeight")); + } + timeout_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::ExtensionOptions => { + if extension_options__.is_some() { + return Err(serde::de::Error::duplicate_field("extensionOptions")); + } + extension_options__ = Some(map_.next_value()?); + } + GeneratedField::NonCriticalExtensionOptions => { + if non_critical_extension_options__.is_some() { + return Err(serde::de::Error::duplicate_field( + "nonCriticalExtensionOptions", + )); + } + non_critical_extension_options__ = Some(map_.next_value()?); + } + } + } + Ok(TxBody { + messages: messages__.unwrap_or_default(), + memo: memo__.unwrap_or_default(), + timeout_height: timeout_height__.unwrap_or_default(), + extension_options: extension_options__.unwrap_or_default(), + non_critical_extension_options: non_critical_extension_options__ + .unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.TxBody", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for TxRaw { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.body_bytes.is_empty() { + len += 1; + } + if !self.auth_info_bytes.is_empty() { + len += 1; + } + if !self.signatures.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.tx.v1beta1.TxRaw", len)?; + if !self.body_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "bodyBytes", + pbjson::private::base64::encode(&self.body_bytes).as_str(), + )?; + } + if !self.auth_info_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "authInfoBytes", + pbjson::private::base64::encode(&self.auth_info_bytes).as_str(), + )?; + } + if !self.signatures.is_empty() { + struct_ser.serialize_field( + "signatures", + &self + .signatures + .iter() + .map(pbjson::private::base64::encode) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for TxRaw { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "body_bytes", + "bodyBytes", + "auth_info_bytes", + "authInfoBytes", + "signatures", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BodyBytes, + AuthInfoBytes, + Signatures, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "bodyBytes" | "body_bytes" => Ok(GeneratedField::BodyBytes), + "authInfoBytes" | "auth_info_bytes" => { + Ok(GeneratedField::AuthInfoBytes) + } + "signatures" => Ok(GeneratedField::Signatures), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = TxRaw; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.tx.v1beta1.TxRaw") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut body_bytes__ = None; + let mut auth_info_bytes__ = None; + let mut signatures__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BodyBytes => { + if body_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("bodyBytes")); + } + body_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::AuthInfoBytes => { + if auth_info_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("authInfoBytes")); + } + auth_info_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Signatures => { + if signatures__.is_some() { + return Err(serde::de::Error::duplicate_field("signatures")); + } + signatures__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(TxRaw { + body_bytes: body_bytes__.unwrap_or_default(), + auth_info_bytes: auth_info_bytes__.unwrap_or_default(), + signatures: signatures__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.tx.v1beta1.TxRaw", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.rs index 5324a869..fa4ab6f8 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.rs @@ -197,5 +197,6 @@ pub struct MsgCancelUpgrade { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCancelUpgradeResponse {} +include!("cosmos.upgrade.v1beta1.serde.rs"); include!("cosmos.upgrade.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.serde.rs new file mode 100644 index 00000000..0dd6e6aa --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.v1beta1.serde.rs @@ -0,0 +1,1945 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for CancelSoftwareUpgradeProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CancelSoftwareUpgradeProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CancelSoftwareUpgradeProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + } + } + Ok(CancelSoftwareUpgradeProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ModuleVersion { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.version != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.ModuleVersion", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if self.version != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ModuleVersion { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "version"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Version, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "version" => Ok(GeneratedField::Version), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ModuleVersion; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.ModuleVersion") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut version__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ModuleVersion { + name: name__.unwrap_or_default(), + version: version__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.ModuleVersion", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCancelUpgrade { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.authority.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.MsgCancelUpgrade", len)?; + if !self.authority.is_empty() { + struct_ser.serialize_field("authority", &self.authority)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCancelUpgrade { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["authority"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authority, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authority" => Ok(GeneratedField::Authority), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCancelUpgrade; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.MsgCancelUpgrade") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authority__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authority => { + if authority__.is_some() { + return Err(serde::de::Error::duplicate_field("authority")); + } + authority__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCancelUpgrade { + authority: authority__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.MsgCancelUpgrade", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCancelUpgradeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCancelUpgradeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCancelUpgradeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCancelUpgradeResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSoftwareUpgrade { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.authority.is_empty() { + len += 1; + } + if self.plan.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", len)?; + if !self.authority.is_empty() { + struct_ser.serialize_field("authority", &self.authority)?; + } + if let Some(v) = self.plan.as_ref() { + struct_ser.serialize_field("plan", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSoftwareUpgrade { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["authority", "plan"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Authority, + Plan, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "authority" => Ok(GeneratedField::Authority), + "plan" => Ok(GeneratedField::Plan), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSoftwareUpgrade; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.MsgSoftwareUpgrade") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut authority__ = None; + let mut plan__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Authority => { + if authority__.is_some() { + return Err(serde::de::Error::duplicate_field("authority")); + } + authority__ = Some(map_.next_value()?); + } + GeneratedField::Plan => { + if plan__.is_some() { + return Err(serde::de::Error::duplicate_field("plan")); + } + plan__ = map_.next_value()?; + } + } + } + Ok(MsgSoftwareUpgrade { + authority: authority__.unwrap_or_default(), + plan: plan__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgSoftwareUpgradeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer + .serialize_struct("cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgSoftwareUpgradeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgSoftwareUpgradeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgSoftwareUpgradeResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Plan { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if self.time.is_some() { + len += 1; + } + if self.height != 0 { + len += 1; + } + if !self.info.is_empty() { + len += 1; + } + if self.upgraded_client_state.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.upgrade.v1beta1.Plan", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if let Some(v) = self.time.as_ref() { + struct_ser.serialize_field("time", v)?; + } + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + if !self.info.is_empty() { + struct_ser.serialize_field("info", &self.info)?; + } + if let Some(v) = self.upgraded_client_state.as_ref() { + struct_ser.serialize_field("upgradedClientState", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Plan { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "name", + "time", + "height", + "info", + "upgraded_client_state", + "upgradedClientState", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Time, + Height, + Info, + UpgradedClientState, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "time" => Ok(GeneratedField::Time), + "height" => Ok(GeneratedField::Height), + "info" => Ok(GeneratedField::Info), + "upgradedClientState" | "upgraded_client_state" => { + Ok(GeneratedField::UpgradedClientState) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Plan; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.Plan") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut time__ = None; + let mut height__ = None; + let mut info__ = None; + let mut upgraded_client_state__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Time => { + if time__.is_some() { + return Err(serde::de::Error::duplicate_field("time")); + } + time__ = map_.next_value()?; + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Info => { + if info__.is_some() { + return Err(serde::de::Error::duplicate_field("info")); + } + info__ = Some(map_.next_value()?); + } + GeneratedField::UpgradedClientState => { + if upgraded_client_state__.is_some() { + return Err(serde::de::Error::duplicate_field( + "upgradedClientState", + )); + } + upgraded_client_state__ = map_.next_value()?; + } + } + } + Ok(Plan { + name: name__.unwrap_or_default(), + time: time__, + height: height__.unwrap_or_default(), + info: info__.unwrap_or_default(), + upgraded_client_state: upgraded_client_state__, + }) + } + } + deserializer.deserialize_struct("cosmos.upgrade.v1beta1.Plan", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAppliedPlanRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAppliedPlanRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAppliedPlanRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryAppliedPlanRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + } + } + Ok(QueryAppliedPlanRequest { + name: name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAppliedPlanResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.height != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", len)?; + if self.height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAppliedPlanResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["height"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Height, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "height" => Ok(GeneratedField::Height), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAppliedPlanResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryAppliedPlanResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryAppliedPlanResponse { + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAuthorityRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryAuthorityRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAuthorityRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAuthorityRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryAuthorityRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryAuthorityRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryAuthorityRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAuthorityResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryAuthorityResponse", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAuthorityResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAuthorityResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryAuthorityResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryAuthorityResponse { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryAuthorityResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCurrentPlanRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCurrentPlanRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCurrentPlanRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryCurrentPlanRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryCurrentPlanRequest {}) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCurrentPlanResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.plan.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", len)?; + if let Some(v) = self.plan.as_ref() { + struct_ser.serialize_field("plan", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCurrentPlanResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["plan"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Plan, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "plan" => Ok(GeneratedField::Plan), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCurrentPlanResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryCurrentPlanResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut plan__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Plan => { + if plan__.is_some() { + return Err(serde::de::Error::duplicate_field("plan")); + } + plan__ = map_.next_value()?; + } + } + } + Ok(QueryCurrentPlanResponse { plan: plan__ }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleVersionsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.module_name.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", len)?; + if !self.module_name.is_empty() { + struct_ser.serialize_field("moduleName", &self.module_name)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleVersionsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["module_name", "moduleName"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ModuleName, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "moduleName" | "module_name" => Ok(GeneratedField::ModuleName), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleVersionsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryModuleVersionsRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut module_name__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ModuleName => { + if module_name__.is_some() { + return Err(serde::de::Error::duplicate_field("moduleName")); + } + module_name__ = Some(map_.next_value()?); + } + } + } + Ok(QueryModuleVersionsRequest { + module_name: module_name__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryModuleVersionsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.module_versions.is_empty() { + len += 1; + } + let mut struct_ser = serializer + .serialize_struct("cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", len)?; + if !self.module_versions.is_empty() { + struct_ser.serialize_field("moduleVersions", &self.module_versions)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryModuleVersionsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["module_versions", "moduleVersions"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ModuleVersions, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "moduleVersions" | "module_versions" => { + Ok(GeneratedField::ModuleVersions) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryModuleVersionsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.QueryModuleVersionsResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut module_versions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ModuleVersions => { + if module_versions__.is_some() { + return Err(serde::de::Error::duplicate_field("moduleVersions")); + } + module_versions__ = Some(map_.next_value()?); + } + } + } + Ok(QueryModuleVersionsResponse { + module_versions: module_versions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryUpgradedConsensusStateRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.last_height != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + len, + )?; + if self.last_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "lastHeight", + ToString::to_string(&self.last_height).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryUpgradedConsensusStateRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["last_height", "lastHeight"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + LastHeight, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "lastHeight" | "last_height" => Ok(GeneratedField::LastHeight), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryUpgradedConsensusStateRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut last_height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::LastHeight => { + if last_height__.is_some() { + return Err(serde::de::Error::duplicate_field("lastHeight")); + } + last_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryUpgradedConsensusStateRequest { + last_height: last_height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryUpgradedConsensusStateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.upgraded_consensus_state.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + len, + )?; + if !self.upgraded_consensus_state.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "upgradedConsensusState", + pbjson::private::base64::encode(&self.upgraded_consensus_state).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryUpgradedConsensusStateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["upgraded_consensus_state", "upgradedConsensusState"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + UpgradedConsensusState, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "upgradedConsensusState" | "upgraded_consensus_state" => { + Ok(GeneratedField::UpgradedConsensusState) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryUpgradedConsensusStateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .write_str("struct cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut upgraded_consensus_state__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::UpgradedConsensusState => { + if upgraded_consensus_state__.is_some() { + return Err(serde::de::Error::duplicate_field( + "upgradedConsensusState", + )); + } + upgraded_consensus_state__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryUpgradedConsensusStateResponse { + upgraded_consensus_state: upgraded_consensus_state__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SoftwareUpgradeProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if self.plan.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if let Some(v) = self.plan.as_ref() { + struct_ser.serialize_field("plan", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SoftwareUpgradeProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "plan"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Plan, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "plan" => Ok(GeneratedField::Plan), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SoftwareUpgradeProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.upgrade.v1beta1.SoftwareUpgradeProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut plan__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Plan => { + if plan__.is_some() { + return Err(serde::de::Error::duplicate_field("plan")); + } + plan__ = map_.next_value()?; + } + } + } + Ok(SoftwareUpgradeProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + plan: plan__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.rs index b49219b3..41bba608 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.rs @@ -134,5 +134,6 @@ pub struct MsgCreatePeriodicVestingAccount { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreatePeriodicVestingAccountResponse {} +include!("cosmos.vesting.v1beta1.serde.rs"); include!("cosmos.vesting.v1beta1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs new file mode 100644 index 00000000..9e6e285b --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs @@ -0,0 +1,1547 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for BaseVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_account.is_some() { + len += 1; + } + if !self.original_vesting.is_empty() { + len += 1; + } + if !self.delegated_free.is_empty() { + len += 1; + } + if !self.delegated_vesting.is_empty() { + len += 1; + } + if self.end_time != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.BaseVestingAccount", len)?; + if let Some(v) = self.base_account.as_ref() { + struct_ser.serialize_field("baseAccount", v)?; + } + if !self.original_vesting.is_empty() { + struct_ser.serialize_field("originalVesting", &self.original_vesting)?; + } + if !self.delegated_free.is_empty() { + struct_ser.serialize_field("delegatedFree", &self.delegated_free)?; + } + if !self.delegated_vesting.is_empty() { + struct_ser.serialize_field("delegatedVesting", &self.delegated_vesting)?; + } + if self.end_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endTime", ToString::to_string(&self.end_time).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for BaseVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "base_account", + "baseAccount", + "original_vesting", + "originalVesting", + "delegated_free", + "delegatedFree", + "delegated_vesting", + "delegatedVesting", + "end_time", + "endTime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseAccount, + OriginalVesting, + DelegatedFree, + DelegatedVesting, + EndTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseAccount" | "base_account" => Ok(GeneratedField::BaseAccount), + "originalVesting" | "original_vesting" => { + Ok(GeneratedField::OriginalVesting) + } + "delegatedFree" | "delegated_free" => Ok(GeneratedField::DelegatedFree), + "delegatedVesting" | "delegated_vesting" => { + Ok(GeneratedField::DelegatedVesting) + } + "endTime" | "end_time" => Ok(GeneratedField::EndTime), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = BaseVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.BaseVestingAccount") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_account__ = None; + let mut original_vesting__ = None; + let mut delegated_free__ = None; + let mut delegated_vesting__ = None; + let mut end_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseAccount => { + if base_account__.is_some() { + return Err(serde::de::Error::duplicate_field("baseAccount")); + } + base_account__ = map_.next_value()?; + } + GeneratedField::OriginalVesting => { + if original_vesting__.is_some() { + return Err(serde::de::Error::duplicate_field("originalVesting")); + } + original_vesting__ = Some(map_.next_value()?); + } + GeneratedField::DelegatedFree => { + if delegated_free__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatedFree")); + } + delegated_free__ = Some(map_.next_value()?); + } + GeneratedField::DelegatedVesting => { + if delegated_vesting__.is_some() { + return Err(serde::de::Error::duplicate_field("delegatedVesting")); + } + delegated_vesting__ = Some(map_.next_value()?); + } + GeneratedField::EndTime => { + if end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("endTime")); + } + end_time__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(BaseVestingAccount { + base_account: base_account__, + original_vesting: original_vesting__.unwrap_or_default(), + delegated_free: delegated_free__.unwrap_or_default(), + delegated_vesting: delegated_vesting__.unwrap_or_default(), + end_time: end_time__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.BaseVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ContinuousVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_vesting_account.is_some() { + len += 1; + } + if self.start_time != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.ContinuousVestingAccount", len)?; + if let Some(v) = self.base_vesting_account.as_ref() { + struct_ser.serialize_field("baseVestingAccount", v)?; + } + if self.start_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("startTime", ToString::to_string(&self.start_time).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ContinuousVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "base_vesting_account", + "baseVestingAccount", + "start_time", + "startTime", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseVestingAccount, + StartTime, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseVestingAccount" | "base_vesting_account" => { + Ok(GeneratedField::BaseVestingAccount) + } + "startTime" | "start_time" => Ok(GeneratedField::StartTime), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ContinuousVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.ContinuousVestingAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_vesting_account__ = None; + let mut start_time__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseVestingAccount => { + if base_vesting_account__.is_some() { + return Err(serde::de::Error::duplicate_field( + "baseVestingAccount", + )); + } + base_vesting_account__ = map_.next_value()?; + } + GeneratedField::StartTime => { + if start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("startTime")); + } + start_time__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ContinuousVestingAccount { + base_vesting_account: base_vesting_account__, + start_time: start_time__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.ContinuousVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DelayedVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_vesting_account.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.DelayedVestingAccount", len)?; + if let Some(v) = self.base_vesting_account.as_ref() { + struct_ser.serialize_field("baseVestingAccount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DelayedVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["base_vesting_account", "baseVestingAccount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseVestingAccount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseVestingAccount" | "base_vesting_account" => { + Ok(GeneratedField::BaseVestingAccount) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DelayedVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.DelayedVestingAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_vesting_account__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseVestingAccount => { + if base_vesting_account__.is_some() { + return Err(serde::de::Error::duplicate_field( + "baseVestingAccount", + )); + } + base_vesting_account__ = map_.next_value()?; + } + } + } + Ok(DelayedVestingAccount { + base_vesting_account: base_vesting_account__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.DelayedVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreatePeriodicVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.from_address.is_empty() { + len += 1; + } + if !self.to_address.is_empty() { + len += 1; + } + if self.start_time != 0 { + len += 1; + } + if !self.vesting_periods.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + len, + )?; + if !self.from_address.is_empty() { + struct_ser.serialize_field("fromAddress", &self.from_address)?; + } + if !self.to_address.is_empty() { + struct_ser.serialize_field("toAddress", &self.to_address)?; + } + if self.start_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("startTime", ToString::to_string(&self.start_time).as_str())?; + } + if !self.vesting_periods.is_empty() { + struct_ser.serialize_field("vestingPeriods", &self.vesting_periods)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreatePeriodicVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "from_address", + "fromAddress", + "to_address", + "toAddress", + "start_time", + "startTime", + "vesting_periods", + "vestingPeriods", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + FromAddress, + ToAddress, + StartTime, + VestingPeriods, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fromAddress" | "from_address" => Ok(GeneratedField::FromAddress), + "toAddress" | "to_address" => Ok(GeneratedField::ToAddress), + "startTime" | "start_time" => Ok(GeneratedField::StartTime), + "vestingPeriods" | "vesting_periods" => { + Ok(GeneratedField::VestingPeriods) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreatePeriodicVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut from_address__ = None; + let mut to_address__ = None; + let mut start_time__ = None; + let mut vesting_periods__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::FromAddress => { + if from_address__.is_some() { + return Err(serde::de::Error::duplicate_field("fromAddress")); + } + from_address__ = Some(map_.next_value()?); + } + GeneratedField::ToAddress => { + if to_address__.is_some() { + return Err(serde::de::Error::duplicate_field("toAddress")); + } + to_address__ = Some(map_.next_value()?); + } + GeneratedField::StartTime => { + if start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("startTime")); + } + start_time__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::VestingPeriods => { + if vesting_periods__.is_some() { + return Err(serde::de::Error::duplicate_field("vestingPeriods")); + } + vesting_periods__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreatePeriodicVestingAccount { + from_address: from_address__.unwrap_or_default(), + to_address: to_address__.unwrap_or_default(), + start_time: start_time__.unwrap_or_default(), + vesting_periods: vesting_periods__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreatePeriodicVestingAccountResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreatePeriodicVestingAccountResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreatePeriodicVestingAccountResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCreatePeriodicVestingAccountResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreatePermanentLockedAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.from_address.is_empty() { + len += 1; + } + if !self.to_address.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + len, + )?; + if !self.from_address.is_empty() { + struct_ser.serialize_field("fromAddress", &self.from_address)?; + } + if !self.to_address.is_empty() { + struct_ser.serialize_field("toAddress", &self.to_address)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreatePermanentLockedAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "from_address", + "fromAddress", + "to_address", + "toAddress", + "amount", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + FromAddress, + ToAddress, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fromAddress" | "from_address" => Ok(GeneratedField::FromAddress), + "toAddress" | "to_address" => Ok(GeneratedField::ToAddress), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreatePermanentLockedAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut from_address__ = None; + let mut to_address__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::FromAddress => { + if from_address__.is_some() { + return Err(serde::de::Error::duplicate_field("fromAddress")); + } + from_address__ = Some(map_.next_value()?); + } + GeneratedField::ToAddress => { + if to_address__.is_some() { + return Err(serde::de::Error::duplicate_field("toAddress")); + } + to_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreatePermanentLockedAccount { + from_address: from_address__.unwrap_or_default(), + to_address: to_address__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreatePermanentLockedAccountResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreatePermanentLockedAccountResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreatePermanentLockedAccountResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str( + "struct cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + ) + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCreatePermanentLockedAccountResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.from_address.is_empty() { + len += 1; + } + if !self.to_address.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + if self.end_time != 0 { + len += 1; + } + if self.delayed { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.MsgCreateVestingAccount", len)?; + if !self.from_address.is_empty() { + struct_ser.serialize_field("fromAddress", &self.from_address)?; + } + if !self.to_address.is_empty() { + struct_ser.serialize_field("toAddress", &self.to_address)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + if self.end_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endTime", ToString::to_string(&self.end_time).as_str())?; + } + if self.delayed { + struct_ser.serialize_field("delayed", &self.delayed)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "from_address", + "fromAddress", + "to_address", + "toAddress", + "amount", + "end_time", + "endTime", + "delayed", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + FromAddress, + ToAddress, + Amount, + EndTime, + Delayed, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "fromAddress" | "from_address" => Ok(GeneratedField::FromAddress), + "toAddress" | "to_address" => Ok(GeneratedField::ToAddress), + "amount" => Ok(GeneratedField::Amount), + "endTime" | "end_time" => Ok(GeneratedField::EndTime), + "delayed" => Ok(GeneratedField::Delayed), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.MsgCreateVestingAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut from_address__ = None; + let mut to_address__ = None; + let mut amount__ = None; + let mut end_time__ = None; + let mut delayed__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::FromAddress => { + if from_address__.is_some() { + return Err(serde::de::Error::duplicate_field("fromAddress")); + } + from_address__ = Some(map_.next_value()?); + } + GeneratedField::ToAddress => { + if to_address__.is_some() { + return Err(serde::de::Error::duplicate_field("toAddress")); + } + to_address__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + GeneratedField::EndTime => { + if end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("endTime")); + } + end_time__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Delayed => { + if delayed__.is_some() { + return Err(serde::de::Error::duplicate_field("delayed")); + } + delayed__ = Some(map_.next_value()?); + } + } + } + Ok(MsgCreateVestingAccount { + from_address: from_address__.unwrap_or_default(), + to_address: to_address__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + end_time: end_time__.unwrap_or_default(), + delayed: delayed__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreateVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgCreateVestingAccountResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct( + "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + len, + )?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgCreateVestingAccountResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgCreateVestingAccountResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgCreateVestingAccountResponse {}) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Period { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.length != 0 { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.vesting.v1beta1.Period", len)?; + if self.length != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("length", ToString::to_string(&self.length).as_str())?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Period { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["length", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Length, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "length" => Ok(GeneratedField::Length), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Period; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.Period") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut length__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Length => { + if length__.is_some() { + return Err(serde::de::Error::duplicate_field("length")); + } + length__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(Period { + length: length__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.vesting.v1beta1.Period", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PeriodicVestingAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_vesting_account.is_some() { + len += 1; + } + if self.start_time != 0 { + len += 1; + } + if !self.vesting_periods.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.PeriodicVestingAccount", len)?; + if let Some(v) = self.base_vesting_account.as_ref() { + struct_ser.serialize_field("baseVestingAccount", v)?; + } + if self.start_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("startTime", ToString::to_string(&self.start_time).as_str())?; + } + if !self.vesting_periods.is_empty() { + struct_ser.serialize_field("vestingPeriods", &self.vesting_periods)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PeriodicVestingAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "base_vesting_account", + "baseVestingAccount", + "start_time", + "startTime", + "vesting_periods", + "vestingPeriods", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseVestingAccount, + StartTime, + VestingPeriods, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseVestingAccount" | "base_vesting_account" => { + Ok(GeneratedField::BaseVestingAccount) + } + "startTime" | "start_time" => Ok(GeneratedField::StartTime), + "vestingPeriods" | "vesting_periods" => { + Ok(GeneratedField::VestingPeriods) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PeriodicVestingAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.PeriodicVestingAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_vesting_account__ = None; + let mut start_time__ = None; + let mut vesting_periods__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseVestingAccount => { + if base_vesting_account__.is_some() { + return Err(serde::de::Error::duplicate_field( + "baseVestingAccount", + )); + } + base_vesting_account__ = map_.next_value()?; + } + GeneratedField::StartTime => { + if start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("startTime")); + } + start_time__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::VestingPeriods => { + if vesting_periods__.is_some() { + return Err(serde::de::Error::duplicate_field("vestingPeriods")); + } + vesting_periods__ = Some(map_.next_value()?); + } + } + } + Ok(PeriodicVestingAccount { + base_vesting_account: base_vesting_account__, + start_time: start_time__.unwrap_or_default(), + vesting_periods: vesting_periods__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.PeriodicVestingAccount", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PermanentLockedAccount { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.base_vesting_account.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.vesting.v1beta1.PermanentLockedAccount", len)?; + if let Some(v) = self.base_vesting_account.as_ref() { + struct_ser.serialize_field("baseVestingAccount", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PermanentLockedAccount { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["base_vesting_account", "baseVestingAccount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BaseVestingAccount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "baseVestingAccount" | "base_vesting_account" => { + Ok(GeneratedField::BaseVestingAccount) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PermanentLockedAccount; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.vesting.v1beta1.PermanentLockedAccount") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut base_vesting_account__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BaseVestingAccount => { + if base_vesting_account__.is_some() { + return Err(serde::de::Error::duplicate_field( + "baseVestingAccount", + )); + } + base_vesting_account__ = map_.next_value()?; + } + } + } + Ok(PermanentLockedAccount { + base_vesting_account: base_vesting_account__, + }) + } + } + deserializer.deserialize_struct( + "cosmos.vesting.v1beta1.PermanentLockedAccount", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.rs index 29320227..2353a154 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.rs @@ -72,4 +72,5 @@ impl ScalarType { } } } +include!("cosmos_proto.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.serde.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.serde.rs new file mode 100644 index 00000000..0ebdf0ed --- /dev/null +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos_proto.serde.rs @@ -0,0 +1,334 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for InterfaceDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos_proto.InterfaceDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InterfaceDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "description"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Description, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "description" => Ok(GeneratedField::Description), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InterfaceDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos_proto.InterfaceDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + } + } + Ok(InterfaceDescriptor { + name: name__.unwrap_or_default(), + description: description__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos_proto.InterfaceDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ScalarDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.field_type.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos_proto.ScalarDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.field_type.is_empty() { + let v = self + .field_type + .iter() + .cloned() + .map(|v| { + ScalarType::try_from(v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v))) + }) + .collect::, _>>()?; + struct_ser.serialize_field("fieldType", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ScalarDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "description", "field_type", "fieldType"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Description, + FieldType, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "description" => Ok(GeneratedField::Description), + "fieldType" | "field_type" => Ok(GeneratedField::FieldType), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ScalarDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos_proto.ScalarDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut description__ = None; + let mut field_type__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::FieldType => { + if field_type__.is_some() { + return Err(serde::de::Error::duplicate_field("fieldType")); + } + field_type__ = Some( + map_.next_value::>()? + .into_iter() + .map(|x| x as i32) + .collect(), + ); + } + } + } + Ok(ScalarDescriptor { + name: name__.unwrap_or_default(), + description: description__.unwrap_or_default(), + field_type: field_type__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos_proto.ScalarDescriptor", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ScalarType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "SCALAR_TYPE_UNSPECIFIED", + Self::String => "SCALAR_TYPE_STRING", + Self::Bytes => "SCALAR_TYPE_BYTES", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ScalarType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "SCALAR_TYPE_UNSPECIFIED", + "SCALAR_TYPE_STRING", + "SCALAR_TYPE_BYTES", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ScalarType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "SCALAR_TYPE_UNSPECIFIED" => Ok(ScalarType::Unspecified), + "SCALAR_TYPE_STRING" => Ok(ScalarType::String), + "SCALAR_TYPE_BYTES" => Ok(ScalarType::Bytes), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.rs index 86f391b5..9e79d078 100644 --- a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.rs @@ -55,4 +55,5 @@ pub struct PageResponse { #[prost(uint64, tag = "2")] pub total: u64, } +include!("cosmos.base.query.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.serde.rs new file mode 100644 index 00000000..27639f3d --- /dev/null +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.query.v1beta1.serde.rs @@ -0,0 +1,312 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for PageRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if self.offset != 0 { + len += 1; + } + if self.limit != 0 { + len += 1; + } + if self.count_total { + len += 1; + } + if self.reverse { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.query.v1beta1.PageRequest", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if self.offset != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("offset", ToString::to_string(&self.offset).as_str())?; + } + if self.limit != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("limit", ToString::to_string(&self.limit).as_str())?; + } + if self.count_total { + struct_ser.serialize_field("countTotal", &self.count_total)?; + } + if self.reverse { + struct_ser.serialize_field("reverse", &self.reverse)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PageRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "key", + "offset", + "limit", + "count_total", + "countTotal", + "reverse", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Offset, + Limit, + CountTotal, + Reverse, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "offset" => Ok(GeneratedField::Offset), + "limit" => Ok(GeneratedField::Limit), + "countTotal" | "count_total" => Ok(GeneratedField::CountTotal), + "reverse" => Ok(GeneratedField::Reverse), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PageRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.query.v1beta1.PageRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut offset__ = None; + let mut limit__ = None; + let mut count_total__ = None; + let mut reverse__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Offset => { + if offset__.is_some() { + return Err(serde::de::Error::duplicate_field("offset")); + } + offset__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Limit => { + if limit__.is_some() { + return Err(serde::de::Error::duplicate_field("limit")); + } + limit__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CountTotal => { + if count_total__.is_some() { + return Err(serde::de::Error::duplicate_field("countTotal")); + } + count_total__ = Some(map_.next_value()?); + } + GeneratedField::Reverse => { + if reverse__.is_some() { + return Err(serde::de::Error::duplicate_field("reverse")); + } + reverse__ = Some(map_.next_value()?); + } + } + } + Ok(PageRequest { + key: key__.unwrap_or_default(), + offset: offset__.unwrap_or_default(), + limit: limit__.unwrap_or_default(), + count_total: count_total__.unwrap_or_default(), + reverse: reverse__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.query.v1beta1.PageRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PageResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.next_key.is_empty() { + len += 1; + } + if self.total != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos.base.query.v1beta1.PageResponse", len)?; + if !self.next_key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "nextKey", + pbjson::private::base64::encode(&self.next_key).as_str(), + )?; + } + if self.total != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("total", ToString::to_string(&self.total).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PageResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["next_key", "nextKey", "total"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + NextKey, + Total, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "nextKey" | "next_key" => Ok(GeneratedField::NextKey), + "total" => Ok(GeneratedField::Total), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PageResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.query.v1beta1.PageResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut next_key__ = None; + let mut total__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::NextKey => { + if next_key__.is_some() { + return Err(serde::de::Error::duplicate_field("nextKey")); + } + next_key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Total => { + if total__.is_some() { + return Err(serde::de::Error::duplicate_field("total")); + } + total__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(PageResponse { + next_key: next_key__.unwrap_or_default(), + total: total__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos.base.query.v1beta1.PageResponse", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.rs index 3701a1a8..8a02bbd7 100644 --- a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.rs @@ -37,4 +37,5 @@ pub struct DecProto { #[prost(string, tag = "1")] pub dec: ::prost::alloc::string::String, } +include!("cosmos.base.v1beta1.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.serde.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.serde.rs new file mode 100644 index 00000000..92880130 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos.base.v1beta1.serde.rs @@ -0,0 +1,413 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for Coin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.Coin", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Coin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Coin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.Coin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(Coin { + denom: denom__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.Coin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DecCoin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.denom.is_empty() { + len += 1; + } + if !self.amount.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.DecCoin", len)?; + if !self.denom.is_empty() { + struct_ser.serialize_field("denom", &self.denom)?; + } + if !self.amount.is_empty() { + struct_ser.serialize_field("amount", &self.amount)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DecCoin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["denom", "amount"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Denom, + Amount, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "denom" => Ok(GeneratedField::Denom), + "amount" => Ok(GeneratedField::Amount), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DecCoin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.DecCoin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut denom__ = None; + let mut amount__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Denom => { + if denom__.is_some() { + return Err(serde::de::Error::duplicate_field("denom")); + } + denom__ = Some(map_.next_value()?); + } + GeneratedField::Amount => { + if amount__.is_some() { + return Err(serde::de::Error::duplicate_field("amount")); + } + amount__ = Some(map_.next_value()?); + } + } + } + Ok(DecCoin { + denom: denom__.unwrap_or_default(), + amount: amount__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.DecCoin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for DecProto { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.dec.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.DecProto", len)?; + if !self.dec.is_empty() { + struct_ser.serialize_field("dec", &self.dec)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for DecProto { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["dec"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Dec, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "dec" => Ok(GeneratedField::Dec), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DecProto; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.DecProto") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut dec__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Dec => { + if dec__.is_some() { + return Err(serde::de::Error::duplicate_field("dec")); + } + dec__ = Some(map_.next_value()?); + } + } + } + Ok(DecProto { + dec: dec__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.DecProto", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for IntProto { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.int.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos.base.v1beta1.IntProto", len)?; + if !self.int.is_empty() { + struct_ser.serialize_field("int", &self.int)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for IntProto { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["int"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Int, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "int" => Ok(GeneratedField::Int), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = IntProto; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos.base.v1beta1.IntProto") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut int__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Int => { + if int__.is_some() { + return Err(serde::de::Error::duplicate_field("int")); + } + int__ = Some(map_.next_value()?); + } + } + } + Ok(IntProto { + int: int__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos.base.v1beta1.IntProto", FIELDS, GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.rs index 29320227..2353a154 100644 --- a/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.rs +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.rs @@ -72,4 +72,5 @@ impl ScalarType { } } } +include!("cosmos_proto.serde.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.serde.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.serde.rs new file mode 100644 index 00000000..0ebdf0ed --- /dev/null +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmos_proto.serde.rs @@ -0,0 +1,334 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for InterfaceDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmos_proto.InterfaceDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InterfaceDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "description"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Description, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "description" => Ok(GeneratedField::Description), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InterfaceDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos_proto.InterfaceDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + } + } + Ok(InterfaceDescriptor { + name: name__.unwrap_or_default(), + description: description__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmos_proto.InterfaceDescriptor", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ScalarDescriptor { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.name.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.field_type.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmos_proto.ScalarDescriptor", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.field_type.is_empty() { + let v = self + .field_type + .iter() + .cloned() + .map(|v| { + ScalarType::try_from(v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v))) + }) + .collect::, _>>()?; + struct_ser.serialize_field("fieldType", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ScalarDescriptor { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["name", "description", "field_type", "fieldType"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Name, + Description, + FieldType, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "name" => Ok(GeneratedField::Name), + "description" => Ok(GeneratedField::Description), + "fieldType" | "field_type" => Ok(GeneratedField::FieldType), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ScalarDescriptor; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmos_proto.ScalarDescriptor") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut name__ = None; + let mut description__ = None; + let mut field_type__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::FieldType => { + if field_type__.is_some() { + return Err(serde::de::Error::duplicate_field("fieldType")); + } + field_type__ = Some( + map_.next_value::>()? + .into_iter() + .map(|x| x as i32) + .collect(), + ); + } + } + } + Ok(ScalarDescriptor { + name: name__.unwrap_or_default(), + description: description__.unwrap_or_default(), + field_type: field_type__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmos_proto.ScalarDescriptor", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ScalarType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "SCALAR_TYPE_UNSPECIFIED", + Self::String => "SCALAR_TYPE_STRING", + Self::Bytes => "SCALAR_TYPE_BYTES", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ScalarType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "SCALAR_TYPE_UNSPECIFIED", + "SCALAR_TYPE_STRING", + "SCALAR_TYPE_BYTES", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ScalarType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "SCALAR_TYPE_UNSPECIFIED" => Ok(ScalarType::Unspecified), + "SCALAR_TYPE_STRING" => Ok(ScalarType::String), + "SCALAR_TYPE_BYTES" => Ok(ScalarType::Bytes), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.rs index 6ba3d723..b7655700 100644 --- a/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.rs +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.rs @@ -913,5 +913,6 @@ pub struct QueryParamsResponse { #[prost(message, optional, tag = "1")] pub params: ::core::option::Option, } +include!("cosmwasm.wasm.v1.serde.rs"); include!("cosmwasm.wasm.v1.tonic.rs"); // @@protoc_insertion_point(module) diff --git a/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.serde.rs b/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.serde.rs new file mode 100644 index 00000000..1820e4e7 --- /dev/null +++ b/cosmos-sdk-proto/src/prost/wasmd/cosmwasm.wasm.v1.serde.rs @@ -0,0 +1,8416 @@ +// @generated +#[cfg(feature = "serde")] +impl serde::Serialize for AbsoluteTxPosition { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.block_height != 0 { + len += 1; + } + if self.tx_index != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.AbsoluteTxPosition", len)?; + if self.block_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "blockHeight", + ToString::to_string(&self.block_height).as_str(), + )?; + } + if self.tx_index != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("txIndex", ToString::to_string(&self.tx_index).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AbsoluteTxPosition { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["block_height", "blockHeight", "tx_index", "txIndex"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + BlockHeight, + TxIndex, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "blockHeight" | "block_height" => Ok(GeneratedField::BlockHeight), + "txIndex" | "tx_index" => Ok(GeneratedField::TxIndex), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AbsoluteTxPosition; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.AbsoluteTxPosition") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut block_height__ = None; + let mut tx_index__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::BlockHeight => { + if block_height__.is_some() { + return Err(serde::de::Error::duplicate_field("blockHeight")); + } + block_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::TxIndex => { + if tx_index__.is_some() { + return Err(serde::de::Error::duplicate_field("txIndex")); + } + tx_index__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(AbsoluteTxPosition { + block_height: block_height__.unwrap_or_default(), + tx_index: tx_index__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.AbsoluteTxPosition", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AccessConfig { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.permission != 0 { + len += 1; + } + if !self.address.is_empty() { + len += 1; + } + if !self.addresses.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.AccessConfig", len)?; + if self.permission != 0 { + let v = AccessType::try_from(self.permission).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.permission)) + })?; + struct_ser.serialize_field("permission", &v)?; + } + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.addresses.is_empty() { + struct_ser.serialize_field("addresses", &self.addresses)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AccessConfig { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["permission", "address", "addresses"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Permission, + Address, + Addresses, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "permission" => Ok(GeneratedField::Permission), + "address" => Ok(GeneratedField::Address), + "addresses" => Ok(GeneratedField::Addresses), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AccessConfig; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.AccessConfig") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut permission__ = None; + let mut address__ = None; + let mut addresses__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Permission => { + if permission__.is_some() { + return Err(serde::de::Error::duplicate_field("permission")); + } + permission__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Addresses => { + if addresses__.is_some() { + return Err(serde::de::Error::duplicate_field("addresses")); + } + addresses__ = Some(map_.next_value()?); + } + } + } + Ok(AccessConfig { + permission: permission__.unwrap_or_default(), + address: address__.unwrap_or_default(), + addresses: addresses__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.AccessConfig", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AccessConfigUpdate { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if self.instantiate_permission.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.AccessConfigUpdate", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if let Some(v) = self.instantiate_permission.as_ref() { + struct_ser.serialize_field("instantiatePermission", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AccessConfigUpdate { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_id", + "codeId", + "instantiate_permission", + "instantiatePermission", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + InstantiatePermission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "instantiatePermission" | "instantiate_permission" => { + Ok(GeneratedField::InstantiatePermission) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AccessConfigUpdate; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.AccessConfigUpdate") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut instantiate_permission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::InstantiatePermission => { + if instantiate_permission__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiatePermission", + )); + } + instantiate_permission__ = map_.next_value()?; + } + } + } + Ok(AccessConfigUpdate { + code_id: code_id__.unwrap_or_default(), + instantiate_permission: instantiate_permission__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.AccessConfigUpdate", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AccessType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "ACCESS_TYPE_UNSPECIFIED", + Self::Nobody => "ACCESS_TYPE_NOBODY", + Self::OnlyAddress => "ACCESS_TYPE_ONLY_ADDRESS", + Self::Everybody => "ACCESS_TYPE_EVERYBODY", + Self::AnyOfAddresses => "ACCESS_TYPE_ANY_OF_ADDRESSES", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AccessType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "ACCESS_TYPE_UNSPECIFIED", + "ACCESS_TYPE_NOBODY", + "ACCESS_TYPE_ONLY_ADDRESS", + "ACCESS_TYPE_EVERYBODY", + "ACCESS_TYPE_ANY_OF_ADDRESSES", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AccessType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "ACCESS_TYPE_UNSPECIFIED" => Ok(AccessType::Unspecified), + "ACCESS_TYPE_NOBODY" => Ok(AccessType::Nobody), + "ACCESS_TYPE_ONLY_ADDRESS" => Ok(AccessType::OnlyAddress), + "ACCESS_TYPE_EVERYBODY" => Ok(AccessType::Everybody), + "ACCESS_TYPE_ANY_OF_ADDRESSES" => Ok(AccessType::AnyOfAddresses), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for AccessTypeParam { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.value != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.AccessTypeParam", len)?; + if self.value != 0 { + let v = AccessType::try_from(self.value).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.value)) + })?; + struct_ser.serialize_field("value", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for AccessTypeParam { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AccessTypeParam; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.AccessTypeParam") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some(map_.next_value::()? as i32); + } + } + } + Ok(AccessTypeParam { + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.AccessTypeParam", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ClearAdminProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.ClearAdminProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ClearAdminProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "contract"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Contract, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "contract" => Ok(GeneratedField::Contract), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ClearAdminProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.ClearAdminProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut contract__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + } + } + Ok(ClearAdminProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.ClearAdminProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Code { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if self.code_info.is_some() { + len += 1; + } + if !self.code_bytes.is_empty() { + len += 1; + } + if self.pinned { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.Code", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if let Some(v) = self.code_info.as_ref() { + struct_ser.serialize_field("codeInfo", v)?; + } + if !self.code_bytes.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "codeBytes", + pbjson::private::base64::encode(&self.code_bytes).as_str(), + )?; + } + if self.pinned { + struct_ser.serialize_field("pinned", &self.pinned)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Code { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_id", + "codeId", + "code_info", + "codeInfo", + "code_bytes", + "codeBytes", + "pinned", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + CodeInfo, + CodeBytes, + Pinned, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "codeInfo" | "code_info" => Ok(GeneratedField::CodeInfo), + "codeBytes" | "code_bytes" => Ok(GeneratedField::CodeBytes), + "pinned" => Ok(GeneratedField::Pinned), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Code; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.Code") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut code_info__ = None; + let mut code_bytes__ = None; + let mut pinned__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::CodeInfo => { + if code_info__.is_some() { + return Err(serde::de::Error::duplicate_field("codeInfo")); + } + code_info__ = map_.next_value()?; + } + GeneratedField::CodeBytes => { + if code_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("codeBytes")); + } + code_bytes__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pinned => { + if pinned__.is_some() { + return Err(serde::de::Error::duplicate_field("pinned")); + } + pinned__ = Some(map_.next_value()?); + } + } + } + Ok(Code { + code_id: code_id__.unwrap_or_default(), + code_info: code_info__, + code_bytes: code_bytes__.unwrap_or_default(), + pinned: pinned__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.Code", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CodeInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.code_hash.is_empty() { + len += 1; + } + if !self.creator.is_empty() { + len += 1; + } + if self.instantiate_config.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.CodeInfo", len)?; + if !self.code_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "codeHash", + pbjson::private::base64::encode(&self.code_hash).as_str(), + )?; + } + if !self.creator.is_empty() { + struct_ser.serialize_field("creator", &self.creator)?; + } + if let Some(v) = self.instantiate_config.as_ref() { + struct_ser.serialize_field("instantiateConfig", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CodeInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_hash", + "codeHash", + "creator", + "instantiate_config", + "instantiateConfig", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeHash, + Creator, + InstantiateConfig, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeHash" | "code_hash" => Ok(GeneratedField::CodeHash), + "creator" => Ok(GeneratedField::Creator), + "instantiateConfig" | "instantiate_config" => { + Ok(GeneratedField::InstantiateConfig) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CodeInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.CodeInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_hash__ = None; + let mut creator__ = None; + let mut instantiate_config__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeHash => { + if code_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("codeHash")); + } + code_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Creator => { + if creator__.is_some() { + return Err(serde::de::Error::duplicate_field("creator")); + } + creator__ = Some(map_.next_value()?); + } + GeneratedField::InstantiateConfig => { + if instantiate_config__.is_some() { + return Err(serde::de::Error::duplicate_field("instantiateConfig")); + } + instantiate_config__ = map_.next_value()?; + } + } + } + Ok(CodeInfo { + code_hash: code_hash__.unwrap_or_default(), + creator: creator__.unwrap_or_default(), + instantiate_config: instantiate_config__, + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.CodeInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for CodeInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if !self.creator.is_empty() { + len += 1; + } + if !self.data_hash.is_empty() { + len += 1; + } + if self.instantiate_permission.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.CodeInfoResponse", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.creator.is_empty() { + struct_ser.serialize_field("creator", &self.creator)?; + } + if !self.data_hash.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "dataHash", + pbjson::private::base64::encode(&self.data_hash).as_str(), + )?; + } + if let Some(v) = self.instantiate_permission.as_ref() { + struct_ser.serialize_field("instantiatePermission", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for CodeInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_id", + "codeId", + "creator", + "data_hash", + "dataHash", + "instantiate_permission", + "instantiatePermission", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + Creator, + DataHash, + InstantiatePermission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "creator" => Ok(GeneratedField::Creator), + "dataHash" | "data_hash" => Ok(GeneratedField::DataHash), + "instantiatePermission" | "instantiate_permission" => { + Ok(GeneratedField::InstantiatePermission) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = CodeInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.CodeInfoResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut creator__ = None; + let mut data_hash__ = None; + let mut instantiate_permission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Creator => { + if creator__.is_some() { + return Err(serde::de::Error::duplicate_field("creator")); + } + creator__ = Some(map_.next_value()?); + } + GeneratedField::DataHash => { + if data_hash__.is_some() { + return Err(serde::de::Error::duplicate_field("dataHash")); + } + data_hash__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::InstantiatePermission => { + if instantiate_permission__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiatePermission", + )); + } + instantiate_permission__ = map_.next_value()?; + } + } + } + Ok(CodeInfoResponse { + code_id: code_id__.unwrap_or_default(), + creator: creator__.unwrap_or_default(), + data_hash: data_hash__.unwrap_or_default(), + instantiate_permission: instantiate_permission__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.CodeInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Contract { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.contract_address.is_empty() { + len += 1; + } + if self.contract_info.is_some() { + len += 1; + } + if !self.contract_state.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.Contract", len)?; + if !self.contract_address.is_empty() { + struct_ser.serialize_field("contractAddress", &self.contract_address)?; + } + if let Some(v) = self.contract_info.as_ref() { + struct_ser.serialize_field("contractInfo", v)?; + } + if !self.contract_state.is_empty() { + struct_ser.serialize_field("contractState", &self.contract_state)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Contract { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "contract_address", + "contractAddress", + "contract_info", + "contractInfo", + "contract_state", + "contractState", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ContractAddress, + ContractInfo, + ContractState, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "contractAddress" | "contract_address" => { + Ok(GeneratedField::ContractAddress) + } + "contractInfo" | "contract_info" => Ok(GeneratedField::ContractInfo), + "contractState" | "contract_state" => Ok(GeneratedField::ContractState), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Contract; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.Contract") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut contract_address__ = None; + let mut contract_info__ = None; + let mut contract_state__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ContractAddress => { + if contract_address__.is_some() { + return Err(serde::de::Error::duplicate_field("contractAddress")); + } + contract_address__ = Some(map_.next_value()?); + } + GeneratedField::ContractInfo => { + if contract_info__.is_some() { + return Err(serde::de::Error::duplicate_field("contractInfo")); + } + contract_info__ = map_.next_value()?; + } + GeneratedField::ContractState => { + if contract_state__.is_some() { + return Err(serde::de::Error::duplicate_field("contractState")); + } + contract_state__ = Some(map_.next_value()?); + } + } + } + Ok(Contract { + contract_address: contract_address__.unwrap_or_default(), + contract_info: contract_info__, + contract_state: contract_state__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.Contract", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ContractCodeHistoryEntry { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.operation != 0 { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if self.updated.is_some() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.ContractCodeHistoryEntry", len)?; + if self.operation != 0 { + let v = ContractCodeHistoryOperationType::try_from(self.operation).map_err(|_| { + serde::ser::Error::custom(format!("Invalid variant {}", self.operation)) + })?; + struct_ser.serialize_field("operation", &v)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if let Some(v) = self.updated.as_ref() { + struct_ser.serialize_field("updated", v)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ContractCodeHistoryEntry { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["operation", "code_id", "codeId", "updated", "msg"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Operation, + CodeId, + Updated, + Msg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "operation" => Ok(GeneratedField::Operation), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "updated" => Ok(GeneratedField::Updated), + "msg" => Ok(GeneratedField::Msg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ContractCodeHistoryEntry; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.ContractCodeHistoryEntry") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut operation__ = None; + let mut code_id__ = None; + let mut updated__ = None; + let mut msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Operation => { + if operation__.is_some() { + return Err(serde::de::Error::duplicate_field("operation")); + } + operation__ = + Some(map_.next_value::()? as i32); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Updated => { + if updated__.is_some() { + return Err(serde::de::Error::duplicate_field("updated")); + } + updated__ = map_.next_value()?; + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(ContractCodeHistoryEntry { + operation: operation__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + updated: updated__, + msg: msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.ContractCodeHistoryEntry", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ContractCodeHistoryOperationType { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED", + Self::Init => "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", + Self::Migrate => "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE", + Self::Genesis => "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS", + }; + serializer.serialize_str(variant) + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ContractCodeHistoryOperationType { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED", + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE", + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ContractCodeHistoryOperationType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED" => { + Ok(ContractCodeHistoryOperationType::Unspecified) + } + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT" => { + Ok(ContractCodeHistoryOperationType::Init) + } + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE" => { + Ok(ContractCodeHistoryOperationType::Migrate) + } + "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS" => { + Ok(ContractCodeHistoryOperationType::Genesis) + } + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ContractInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if !self.creator.is_empty() { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if !self.label.is_empty() { + len += 1; + } + if self.created.is_some() { + len += 1; + } + if !self.ibc_port_id.is_empty() { + len += 1; + } + if self.extension.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.ContractInfo", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.creator.is_empty() { + struct_ser.serialize_field("creator", &self.creator)?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if !self.label.is_empty() { + struct_ser.serialize_field("label", &self.label)?; + } + if let Some(v) = self.created.as_ref() { + struct_ser.serialize_field("created", v)?; + } + if !self.ibc_port_id.is_empty() { + struct_ser.serialize_field("ibcPortId", &self.ibc_port_id)?; + } + if let Some(v) = self.extension.as_ref() { + struct_ser.serialize_field("extension", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ContractInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_id", + "codeId", + "creator", + "admin", + "label", + "created", + "ibc_port_id", + "ibcPortId", + "extension", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + Creator, + Admin, + Label, + Created, + IbcPortId, + Extension, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "creator" => Ok(GeneratedField::Creator), + "admin" => Ok(GeneratedField::Admin), + "label" => Ok(GeneratedField::Label), + "created" => Ok(GeneratedField::Created), + "ibcPortId" | "ibc_port_id" => Ok(GeneratedField::IbcPortId), + "extension" => Ok(GeneratedField::Extension), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ContractInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.ContractInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut creator__ = None; + let mut admin__ = None; + let mut label__ = None; + let mut created__ = None; + let mut ibc_port_id__ = None; + let mut extension__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Creator => { + if creator__.is_some() { + return Err(serde::de::Error::duplicate_field("creator")); + } + creator__ = Some(map_.next_value()?); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::Label => { + if label__.is_some() { + return Err(serde::de::Error::duplicate_field("label")); + } + label__ = Some(map_.next_value()?); + } + GeneratedField::Created => { + if created__.is_some() { + return Err(serde::de::Error::duplicate_field("created")); + } + created__ = map_.next_value()?; + } + GeneratedField::IbcPortId => { + if ibc_port_id__.is_some() { + return Err(serde::de::Error::duplicate_field("ibcPortId")); + } + ibc_port_id__ = Some(map_.next_value()?); + } + GeneratedField::Extension => { + if extension__.is_some() { + return Err(serde::de::Error::duplicate_field("extension")); + } + extension__ = map_.next_value()?; + } + } + } + Ok(ContractInfo { + code_id: code_id__.unwrap_or_default(), + creator: creator__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + label: label__.unwrap_or_default(), + created: created__, + ibc_port_id: ibc_port_id__.unwrap_or_default(), + extension: extension__, + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.ContractInfo", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for ExecuteContractProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.run_as.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + if !self.funds.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.ExecuteContractProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.run_as.is_empty() { + struct_ser.serialize_field("runAs", &self.run_as)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + if !self.funds.is_empty() { + struct_ser.serialize_field("funds", &self.funds)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for ExecuteContractProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "title", + "description", + "run_as", + "runAs", + "contract", + "msg", + "funds", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + RunAs, + Contract, + Msg, + Funds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "runAs" | "run_as" => Ok(GeneratedField::RunAs), + "contract" => Ok(GeneratedField::Contract), + "msg" => Ok(GeneratedField::Msg), + "funds" => Ok(GeneratedField::Funds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ExecuteContractProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.ExecuteContractProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut run_as__ = None; + let mut contract__ = None; + let mut msg__ = None; + let mut funds__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::RunAs => { + if run_as__.is_some() { + return Err(serde::de::Error::duplicate_field("runAs")); + } + run_as__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Funds => { + if funds__.is_some() { + return Err(serde::de::Error::duplicate_field("funds")); + } + funds__ = Some(map_.next_value()?); + } + } + } + Ok(ExecuteContractProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + run_as: run_as__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + funds: funds__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.ExecuteContractProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for GenesisState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + if !self.codes.is_empty() { + len += 1; + } + if !self.contracts.is_empty() { + len += 1; + } + if !self.sequences.is_empty() { + len += 1; + } + if !self.gen_msgs.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.GenesisState", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + if !self.codes.is_empty() { + struct_ser.serialize_field("codes", &self.codes)?; + } + if !self.contracts.is_empty() { + struct_ser.serialize_field("contracts", &self.contracts)?; + } + if !self.sequences.is_empty() { + struct_ser.serialize_field("sequences", &self.sequences)?; + } + if !self.gen_msgs.is_empty() { + struct_ser.serialize_field("genMsgs", &self.gen_msgs)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for GenesisState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + "codes", + "contracts", + "sequences", + "gen_msgs", + "genMsgs", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + Codes, + Contracts, + Sequences, + GenMsgs, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + "codes" => Ok(GeneratedField::Codes), + "contracts" => Ok(GeneratedField::Contracts), + "sequences" => Ok(GeneratedField::Sequences), + "genMsgs" | "gen_msgs" => Ok(GeneratedField::GenMsgs), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.GenesisState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + let mut codes__ = None; + let mut contracts__ = None; + let mut sequences__ = None; + let mut gen_msgs__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::Codes => { + if codes__.is_some() { + return Err(serde::de::Error::duplicate_field("codes")); + } + codes__ = Some(map_.next_value()?); + } + GeneratedField::Contracts => { + if contracts__.is_some() { + return Err(serde::de::Error::duplicate_field("contracts")); + } + contracts__ = Some(map_.next_value()?); + } + GeneratedField::Sequences => { + if sequences__.is_some() { + return Err(serde::de::Error::duplicate_field("sequences")); + } + sequences__ = Some(map_.next_value()?); + } + GeneratedField::GenMsgs => { + if gen_msgs__.is_some() { + return Err(serde::de::Error::duplicate_field("genMsgs")); + } + gen_msgs__ = Some(map_.next_value()?); + } + } + } + Ok(GenesisState { + params: params__, + codes: codes__.unwrap_or_default(), + contracts: contracts__.unwrap_or_default(), + sequences: sequences__.unwrap_or_default(), + gen_msgs: gen_msgs__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.GenesisState", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for genesis_state::GenMsgs { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.sum.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.GenesisState.GenMsgs", len)?; + if let Some(v) = self.sum.as_ref() { + match v { + genesis_state::gen_msgs::Sum::StoreCode(v) => { + struct_ser.serialize_field("storeCode", v)?; + } + genesis_state::gen_msgs::Sum::InstantiateContract(v) => { + struct_ser.serialize_field("instantiateContract", v)?; + } + genesis_state::gen_msgs::Sum::ExecuteContract(v) => { + struct_ser.serialize_field("executeContract", v)?; + } + } + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for genesis_state::GenMsgs { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "store_code", + "storeCode", + "instantiate_contract", + "instantiateContract", + "execute_contract", + "executeContract", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StoreCode, + InstantiateContract, + ExecuteContract, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "storeCode" | "store_code" => Ok(GeneratedField::StoreCode), + "instantiateContract" | "instantiate_contract" => { + Ok(GeneratedField::InstantiateContract) + } + "executeContract" | "execute_contract" => { + Ok(GeneratedField::ExecuteContract) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = genesis_state::GenMsgs; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.GenesisState.GenMsgs") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sum__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StoreCode => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("storeCode")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(genesis_state::gen_msgs::Sum::StoreCode); + } + GeneratedField::InstantiateContract => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiateContract", + )); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(genesis_state::gen_msgs::Sum::InstantiateContract); + } + GeneratedField::ExecuteContract => { + if sum__.is_some() { + return Err(serde::de::Error::duplicate_field("executeContract")); + } + sum__ = map_ + .next_value::<::std::option::Option<_>>()? + .map(genesis_state::gen_msgs::Sum::ExecuteContract); + } + } + } + Ok(genesis_state::GenMsgs { sum: sum__ }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.GenesisState.GenMsgs", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for InstantiateContractProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.run_as.is_empty() { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if !self.label.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + if !self.funds.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.InstantiateContractProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.run_as.is_empty() { + struct_ser.serialize_field("runAs", &self.run_as)?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.label.is_empty() { + struct_ser.serialize_field("label", &self.label)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + if !self.funds.is_empty() { + struct_ser.serialize_field("funds", &self.funds)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for InstantiateContractProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "title", + "description", + "run_as", + "runAs", + "admin", + "code_id", + "codeId", + "label", + "msg", + "funds", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + RunAs, + Admin, + CodeId, + Label, + Msg, + Funds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "runAs" | "run_as" => Ok(GeneratedField::RunAs), + "admin" => Ok(GeneratedField::Admin), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "label" => Ok(GeneratedField::Label), + "msg" => Ok(GeneratedField::Msg), + "funds" => Ok(GeneratedField::Funds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = InstantiateContractProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.InstantiateContractProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut run_as__ = None; + let mut admin__ = None; + let mut code_id__ = None; + let mut label__ = None; + let mut msg__ = None; + let mut funds__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::RunAs => { + if run_as__.is_some() { + return Err(serde::de::Error::duplicate_field("runAs")); + } + run_as__ = Some(map_.next_value()?); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Label => { + if label__.is_some() { + return Err(serde::de::Error::duplicate_field("label")); + } + label__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Funds => { + if funds__.is_some() { + return Err(serde::de::Error::duplicate_field("funds")); + } + funds__ = Some(map_.next_value()?); + } + } + } + Ok(InstantiateContractProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + run_as: run_as__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + label: label__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + funds: funds__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.InstantiateContractProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MigrateContractProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MigrateContractProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MigrateContractProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "title", + "description", + "contract", + "code_id", + "codeId", + "msg", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Contract, + CodeId, + Msg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "contract" => Ok(GeneratedField::Contract), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "msg" => Ok(GeneratedField::Msg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MigrateContractProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MigrateContractProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut contract__ = None; + let mut code_id__ = None; + let mut msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MigrateContractProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MigrateContractProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Model { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.key.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.Model", len)?; + if !self.key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?; + } + if !self.value.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "value", + pbjson::private::base64::encode(&self.value).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Model { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["key", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Key, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "key" => Ok(GeneratedField::Key), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Model; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.Model") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Key => { + if key__.is_some() { + return Err(serde::de::Error::duplicate_field("key")); + } + key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Model { + key: key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.Model", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgClearAdmin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.MsgClearAdmin", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgClearAdmin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["sender", "contract"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + Contract, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "contract" => Ok(GeneratedField::Contract), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgClearAdmin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgClearAdmin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut contract__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + } + } + Ok(MsgClearAdmin { + sender: sender__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.MsgClearAdmin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgClearAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgClearAdminResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgClearAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgClearAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgClearAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgClearAdminResponse {}) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgClearAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecuteContract { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + if !self.funds.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgExecuteContract", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + if !self.funds.is_empty() { + struct_ser.serialize_field("funds", &self.funds)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecuteContract { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["sender", "contract", "msg", "funds"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + Contract, + Msg, + Funds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "contract" => Ok(GeneratedField::Contract), + "msg" => Ok(GeneratedField::Msg), + "funds" => Ok(GeneratedField::Funds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecuteContract; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgExecuteContract") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut contract__ = None; + let mut msg__ = None; + let mut funds__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Funds => { + if funds__.is_some() { + return Err(serde::de::Error::duplicate_field("funds")); + } + funds__ = Some(map_.next_value()?); + } + } + } + Ok(MsgExecuteContract { + sender: sender__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + funds: funds__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgExecuteContract", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgExecuteContractResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgExecuteContractResponse", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgExecuteContractResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgExecuteContractResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgExecuteContractResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgExecuteContractResponse { + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgExecuteContractResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgIbcCloseChannel { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.channel.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgIBCCloseChannel", len)?; + if !self.channel.is_empty() { + struct_ser.serialize_field("channel", &self.channel)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgIbcCloseChannel { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["channel"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Channel, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "channel" => Ok(GeneratedField::Channel), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgIbcCloseChannel; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgIBCCloseChannel") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut channel__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Channel => { + if channel__.is_some() { + return Err(serde::de::Error::duplicate_field("channel")); + } + channel__ = Some(map_.next_value()?); + } + } + } + Ok(MsgIbcCloseChannel { + channel: channel__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgIBCCloseChannel", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgIbcSend { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.channel.is_empty() { + len += 1; + } + if self.timeout_height != 0 { + len += 1; + } + if self.timeout_timestamp != 0 { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.MsgIBCSend", len)?; + if !self.channel.is_empty() { + struct_ser.serialize_field("channel", &self.channel)?; + } + if self.timeout_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "timeoutHeight", + ToString::to_string(&self.timeout_height).as_str(), + )?; + } + if self.timeout_timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "timeoutTimestamp", + ToString::to_string(&self.timeout_timestamp).as_str(), + )?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgIbcSend { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "channel", + "timeout_height", + "timeoutHeight", + "timeout_timestamp", + "timeoutTimestamp", + "data", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Channel, + TimeoutHeight, + TimeoutTimestamp, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "channel" => Ok(GeneratedField::Channel), + "timeoutHeight" | "timeout_height" => Ok(GeneratedField::TimeoutHeight), + "timeoutTimestamp" | "timeout_timestamp" => { + Ok(GeneratedField::TimeoutTimestamp) + } + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgIbcSend; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgIBCSend") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut channel__ = None; + let mut timeout_height__ = None; + let mut timeout_timestamp__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Channel => { + if channel__.is_some() { + return Err(serde::de::Error::duplicate_field("channel")); + } + channel__ = Some(map_.next_value()?); + } + GeneratedField::TimeoutHeight => { + if timeout_height__.is_some() { + return Err(serde::de::Error::duplicate_field("timeoutHeight")); + } + timeout_height__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::TimeoutTimestamp => { + if timeout_timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("timeoutTimestamp")); + } + timeout_timestamp__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgIbcSend { + channel: channel__.unwrap_or_default(), + timeout_height: timeout_height__.unwrap_or_default(), + timeout_timestamp: timeout_timestamp__.unwrap_or_default(), + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.MsgIBCSend", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgInstantiateContract { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if !self.label.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + if !self.funds.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgInstantiateContract", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.label.is_empty() { + struct_ser.serialize_field("label", &self.label)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + if !self.funds.is_empty() { + struct_ser.serialize_field("funds", &self.funds)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgInstantiateContract { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sender", "admin", "code_id", "codeId", "label", "msg", "funds", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + Admin, + CodeId, + Label, + Msg, + Funds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "admin" => Ok(GeneratedField::Admin), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "label" => Ok(GeneratedField::Label), + "msg" => Ok(GeneratedField::Msg), + "funds" => Ok(GeneratedField::Funds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgInstantiateContract; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgInstantiateContract") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut admin__ = None; + let mut code_id__ = None; + let mut label__ = None; + let mut msg__ = None; + let mut funds__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Label => { + if label__.is_some() { + return Err(serde::de::Error::duplicate_field("label")); + } + label__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Funds => { + if funds__.is_some() { + return Err(serde::de::Error::duplicate_field("funds")); + } + funds__ = Some(map_.next_value()?); + } + } + } + Ok(MsgInstantiateContract { + sender: sender__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + label: label__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + funds: funds__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgInstantiateContract", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgInstantiateContract2 { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.admin.is_empty() { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if !self.label.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + if !self.funds.is_empty() { + len += 1; + } + if !self.salt.is_empty() { + len += 1; + } + if self.fix_msg { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgInstantiateContract2", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.admin.is_empty() { + struct_ser.serialize_field("admin", &self.admin)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.label.is_empty() { + struct_ser.serialize_field("label", &self.label)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + if !self.funds.is_empty() { + struct_ser.serialize_field("funds", &self.funds)?; + } + if !self.salt.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("salt", pbjson::private::base64::encode(&self.salt).as_str())?; + } + if self.fix_msg { + struct_ser.serialize_field("fixMsg", &self.fix_msg)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgInstantiateContract2 { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sender", "admin", "code_id", "codeId", "label", "msg", "funds", "salt", "fix_msg", + "fixMsg", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + Admin, + CodeId, + Label, + Msg, + Funds, + Salt, + FixMsg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "admin" => Ok(GeneratedField::Admin), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "label" => Ok(GeneratedField::Label), + "msg" => Ok(GeneratedField::Msg), + "funds" => Ok(GeneratedField::Funds), + "salt" => Ok(GeneratedField::Salt), + "fixMsg" | "fix_msg" => Ok(GeneratedField::FixMsg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgInstantiateContract2; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgInstantiateContract2") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut admin__ = None; + let mut code_id__ = None; + let mut label__ = None; + let mut msg__ = None; + let mut funds__ = None; + let mut salt__ = None; + let mut fix_msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Admin => { + if admin__.is_some() { + return Err(serde::de::Error::duplicate_field("admin")); + } + admin__ = Some(map_.next_value()?); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Label => { + if label__.is_some() { + return Err(serde::de::Error::duplicate_field("label")); + } + label__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Funds => { + if funds__.is_some() { + return Err(serde::de::Error::duplicate_field("funds")); + } + funds__ = Some(map_.next_value()?); + } + GeneratedField::Salt => { + if salt__.is_some() { + return Err(serde::de::Error::duplicate_field("salt")); + } + salt__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::FixMsg => { + if fix_msg__.is_some() { + return Err(serde::de::Error::duplicate_field("fixMsg")); + } + fix_msg__ = Some(map_.next_value()?); + } + } + } + Ok(MsgInstantiateContract2 { + sender: sender__.unwrap_or_default(), + admin: admin__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + label: label__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + funds: funds__.unwrap_or_default(), + salt: salt__.unwrap_or_default(), + fix_msg: fix_msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgInstantiateContract2", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgInstantiateContract2Response { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgInstantiateContract2Response", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgInstantiateContract2Response { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgInstantiateContract2Response; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgInstantiateContract2Response") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgInstantiateContract2Response { + address: address__.unwrap_or_default(), + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgInstantiateContract2Response", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgInstantiateContractResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgInstantiateContractResponse", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgInstantiateContractResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgInstantiateContractResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgInstantiateContractResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgInstantiateContractResponse { + address: address__.unwrap_or_default(), + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgInstantiateContractResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgMigrateContract { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + if self.code_id != 0 { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgMigrateContract", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgMigrateContract { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["sender", "contract", "code_id", "codeId", "msg"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + Contract, + CodeId, + Msg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "contract" => Ok(GeneratedField::Contract), + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "msg" => Ok(GeneratedField::Msg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgMigrateContract; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgMigrateContract") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut contract__ = None; + let mut code_id__ = None; + let mut msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgMigrateContract { + sender: sender__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + code_id: code_id__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgMigrateContract", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgMigrateContractResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgMigrateContractResponse", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgMigrateContractResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgMigrateContractResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgMigrateContractResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgMigrateContractResponse { + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgMigrateContractResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgStoreCode { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.wasm_byte_code.is_empty() { + len += 1; + } + if self.instantiate_permission.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.MsgStoreCode", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.wasm_byte_code.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "wasmByteCode", + pbjson::private::base64::encode(&self.wasm_byte_code).as_str(), + )?; + } + if let Some(v) = self.instantiate_permission.as_ref() { + struct_ser.serialize_field("instantiatePermission", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgStoreCode { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sender", + "wasm_byte_code", + "wasmByteCode", + "instantiate_permission", + "instantiatePermission", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + WasmByteCode, + InstantiatePermission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "wasmByteCode" | "wasm_byte_code" => Ok(GeneratedField::WasmByteCode), + "instantiatePermission" | "instantiate_permission" => { + Ok(GeneratedField::InstantiatePermission) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgStoreCode; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgStoreCode") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut wasm_byte_code__ = None; + let mut instantiate_permission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::WasmByteCode => { + if wasm_byte_code__.is_some() { + return Err(serde::de::Error::duplicate_field("wasmByteCode")); + } + wasm_byte_code__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::InstantiatePermission => { + if instantiate_permission__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiatePermission", + )); + } + instantiate_permission__ = map_.next_value()?; + } + } + } + Ok(MsgStoreCode { + sender: sender__.unwrap_or_default(), + wasm_byte_code: wasm_byte_code__.unwrap_or_default(), + instantiate_permission: instantiate_permission__, + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.MsgStoreCode", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgStoreCodeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if !self.checksum.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgStoreCodeResponse", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if !self.checksum.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "checksum", + pbjson::private::base64::encode(&self.checksum).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgStoreCodeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_id", "codeId", "checksum"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + Checksum, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "checksum" => Ok(GeneratedField::Checksum), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgStoreCodeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgStoreCodeResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut checksum__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Checksum => { + if checksum__.is_some() { + return Err(serde::de::Error::duplicate_field("checksum")); + } + checksum__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(MsgStoreCodeResponse { + code_id: code_id__.unwrap_or_default(), + checksum: checksum__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgStoreCodeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateAdmin { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sender.is_empty() { + len += 1; + } + if !self.new_admin.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.MsgUpdateAdmin", len)?; + if !self.sender.is_empty() { + struct_ser.serialize_field("sender", &self.sender)?; + } + if !self.new_admin.is_empty() { + struct_ser.serialize_field("newAdmin", &self.new_admin)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateAdmin { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["sender", "new_admin", "newAdmin", "contract"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sender, + NewAdmin, + Contract, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sender" => Ok(GeneratedField::Sender), + "newAdmin" | "new_admin" => Ok(GeneratedField::NewAdmin), + "contract" => Ok(GeneratedField::Contract), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateAdmin; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgUpdateAdmin") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sender__ = None; + let mut new_admin__ = None; + let mut contract__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sender => { + if sender__.is_some() { + return Err(serde::de::Error::duplicate_field("sender")); + } + sender__ = Some(map_.next_value()?); + } + GeneratedField::NewAdmin => { + if new_admin__.is_some() { + return Err(serde::de::Error::duplicate_field("newAdmin")); + } + new_admin__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + } + } + Ok(MsgUpdateAdmin { + sender: sender__.unwrap_or_default(), + new_admin: new_admin__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.MsgUpdateAdmin", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for MsgUpdateAdminResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.MsgUpdateAdminResponse", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for MsgUpdateAdminResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = MsgUpdateAdminResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.MsgUpdateAdminResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(MsgUpdateAdminResponse {}) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.MsgUpdateAdminResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Params { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_upload_access.is_some() { + len += 1; + } + if self.instantiate_default_permission != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.Params", len)?; + if let Some(v) = self.code_upload_access.as_ref() { + struct_ser.serialize_field("codeUploadAccess", v)?; + } + if self.instantiate_default_permission != 0 { + let v = AccessType::try_from(self.instantiate_default_permission).map_err(|_| { + serde::ser::Error::custom(format!( + "Invalid variant {}", + self.instantiate_default_permission + )) + })?; + struct_ser.serialize_field("instantiateDefaultPermission", &v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Params { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code_upload_access", + "codeUploadAccess", + "instantiate_default_permission", + "instantiateDefaultPermission", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeUploadAccess, + InstantiateDefaultPermission, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeUploadAccess" | "code_upload_access" => { + Ok(GeneratedField::CodeUploadAccess) + } + "instantiateDefaultPermission" | "instantiate_default_permission" => { + Ok(GeneratedField::InstantiateDefaultPermission) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Params; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.Params") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_upload_access__ = None; + let mut instantiate_default_permission__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeUploadAccess => { + if code_upload_access__.is_some() { + return Err(serde::de::Error::duplicate_field("codeUploadAccess")); + } + code_upload_access__ = map_.next_value()?; + } + GeneratedField::InstantiateDefaultPermission => { + if instantiate_default_permission__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiateDefaultPermission", + )); + } + instantiate_default_permission__ = + Some(map_.next_value::()? as i32); + } + } + } + Ok(Params { + code_upload_access: code_upload_access__, + instantiate_default_permission: instantiate_default_permission__ + .unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.Params", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for PinCodesProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.code_ids.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.PinCodesProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.code_ids.is_empty() { + struct_ser.serialize_field( + "codeIds", + &self + .code_ids + .iter() + .map(ToString::to_string) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for PinCodesProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "code_ids", "codeIds"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + CodeIds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "codeIds" | "code_ids" => Ok(GeneratedField::CodeIds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PinCodesProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.PinCodesProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut code_ids__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::CodeIds => { + if code_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("codeIds")); + } + code_ids__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(PinCodesProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + code_ids: code_ids__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.PinCodesProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllContractStateRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryAllContractStateRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllContractStateRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllContractStateRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryAllContractStateRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllContractStateRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryAllContractStateRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryAllContractStateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.models.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryAllContractStateResponse", len)?; + if !self.models.is_empty() { + struct_ser.serialize_field("models", &self.models)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryAllContractStateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["models", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Models, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "models" => Ok(GeneratedField::Models), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryAllContractStateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryAllContractStateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut models__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Models => { + if models__.is_some() { + return Err(serde::de::Error::duplicate_field("models")); + } + models__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryAllContractStateResponse { + models: models__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryAllContractStateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCodeRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryCodeRequest", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCodeRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_id", "codeId"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCodeRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryCodeRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryCodeRequest { + code_id: code_id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryCodeRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCodeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_info.is_some() { + len += 1; + } + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryCodeResponse", len)?; + if let Some(v) = self.code_info.as_ref() { + struct_ser.serialize_field("codeInfo", v)?; + } + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCodeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_info", "codeInfo", "data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeInfo, + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeInfo" | "code_info" => Ok(GeneratedField::CodeInfo), + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCodeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryCodeResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_info__ = None; + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeInfo => { + if code_info__.is_some() { + return Err(serde::de::Error::duplicate_field("codeInfo")); + } + code_info__ = map_.next_value()?; + } + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryCodeResponse { + code_info: code_info__, + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryCodeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCodesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryCodesRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCodesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCodesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryCodesRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryCodesRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryCodesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryCodesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.code_infos.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryCodesResponse", len)?; + if !self.code_infos.is_empty() { + struct_ser.serialize_field("codeInfos", &self.code_infos)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryCodesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_infos", "codeInfos", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeInfos, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeInfos" | "code_infos" => Ok(GeneratedField::CodeInfos), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryCodesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryCodesResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_infos__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeInfos => { + if code_infos__.is_some() { + return Err(serde::de::Error::duplicate_field("codeInfos")); + } + code_infos__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryCodesResponse { + code_infos: code_infos__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryCodesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractHistoryRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractHistoryRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractHistoryRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractHistoryRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractHistoryRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryContractHistoryRequest { + address: address__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractHistoryRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractHistoryResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.entries.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractHistoryResponse", len)?; + if !self.entries.is_empty() { + struct_ser.serialize_field("entries", &self.entries)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractHistoryResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["entries", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Entries, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "entries" => Ok(GeneratedField::Entries), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractHistoryResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractHistoryResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut entries__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Entries => { + if entries__.is_some() { + return Err(serde::de::Error::duplicate_field("entries")); + } + entries__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryContractHistoryResponse { + entries: entries__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractHistoryResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractInfoRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractInfoRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractInfoRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractInfoRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractInfoRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + } + } + Ok(QueryContractInfoRequest { + address: address__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractInfoRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractInfoResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if self.contract_info.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractInfoResponse", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if let Some(v) = self.contract_info.as_ref() { + struct_ser.serialize_field("contractInfo", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractInfoResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "contract_info", "contractInfo"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + ContractInfo, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "contractInfo" | "contract_info" => Ok(GeneratedField::ContractInfo), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractInfoResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractInfoResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut contract_info__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::ContractInfo => { + if contract_info__.is_some() { + return Err(serde::de::Error::duplicate_field("contractInfo")); + } + contract_info__ = map_.next_value()?; + } + } + } + Ok(QueryContractInfoResponse { + address: address__.unwrap_or_default(), + contract_info: contract_info__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractInfoResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractsByCodeRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code_id != 0 { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractsByCodeRequest", len)?; + if self.code_id != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("codeId", ToString::to_string(&self.code_id).as_str())?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractsByCodeRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_id", "codeId", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeId, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeId" | "code_id" => Ok(GeneratedField::CodeId), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractsByCodeRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractsByCodeRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_id__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeId => { + if code_id__.is_some() { + return Err(serde::de::Error::duplicate_field("codeId")); + } + code_id__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryContractsByCodeRequest { + code_id: code_id__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractsByCodeRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryContractsByCodeResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.contracts.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryContractsByCodeResponse", len)?; + if !self.contracts.is_empty() { + struct_ser.serialize_field("contracts", &self.contracts)?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryContractsByCodeResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["contracts", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Contracts, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "contracts" => Ok(GeneratedField::Contracts), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryContractsByCodeResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryContractsByCodeResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut contracts__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Contracts => { + if contracts__.is_some() { + return Err(serde::de::Error::duplicate_field("contracts")); + } + contracts__ = Some(map_.next_value()?); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryContractsByCodeResponse { + contracts: contracts__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryContractsByCodeResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.QueryParamsRequest", len)?; + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField {} + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Err(serde::de::Error::unknown_field(value, FIELDS)) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryParamsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(QueryParamsRequest {}) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryParamsRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryParamsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryParamsResponse", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryParamsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["params"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryParamsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryParamsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + } + } + Ok(QueryParamsResponse { params: params__ }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryParamsResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryPinnedCodesRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryPinnedCodesRequest", len)?; + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryPinnedCodesRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryPinnedCodesRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryPinnedCodesRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryPinnedCodesRequest { + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryPinnedCodesRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryPinnedCodesResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.code_ids.is_empty() { + len += 1; + } + if self.pagination.is_some() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryPinnedCodesResponse", len)?; + if !self.code_ids.is_empty() { + struct_ser.serialize_field( + "codeIds", + &self + .code_ids + .iter() + .map(ToString::to_string) + .collect::>(), + )?; + } + if let Some(v) = self.pagination.as_ref() { + struct_ser.serialize_field("pagination", v)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryPinnedCodesResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["code_ids", "codeIds", "pagination"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CodeIds, + Pagination, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codeIds" | "code_ids" => Ok(GeneratedField::CodeIds), + "pagination" => Ok(GeneratedField::Pagination), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryPinnedCodesResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryPinnedCodesResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut code_ids__ = None; + let mut pagination__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CodeIds => { + if code_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("codeIds")); + } + code_ids__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + GeneratedField::Pagination => { + if pagination__.is_some() { + return Err(serde::de::Error::duplicate_field("pagination")); + } + pagination__ = map_.next_value()?; + } + } + } + Ok(QueryPinnedCodesResponse { + code_ids: code_ids__.unwrap_or_default(), + pagination: pagination__, + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryPinnedCodesResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryRawContractStateRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.query_data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryRawContractStateRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.query_data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "queryData", + pbjson::private::base64::encode(&self.query_data).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryRawContractStateRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "query_data", "queryData"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + QueryData, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "queryData" | "query_data" => Ok(GeneratedField::QueryData), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryRawContractStateRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryRawContractStateRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut query_data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::QueryData => { + if query_data__.is_some() { + return Err(serde::de::Error::duplicate_field("queryData")); + } + query_data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryRawContractStateRequest { + address: address__.unwrap_or_default(), + query_data: query_data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryRawContractStateRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QueryRawContractStateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QueryRawContractStateResponse", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QueryRawContractStateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QueryRawContractStateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QueryRawContractStateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QueryRawContractStateResponse { + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QueryRawContractStateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySmartContractStateRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.address.is_empty() { + len += 1; + } + if !self.query_data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QuerySmartContractStateRequest", len)?; + if !self.address.is_empty() { + struct_ser.serialize_field("address", &self.address)?; + } + if !self.query_data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "queryData", + pbjson::private::base64::encode(&self.query_data).as_str(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySmartContractStateRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["address", "query_data", "queryData"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Address, + QueryData, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "address" => Ok(GeneratedField::Address), + "queryData" | "query_data" => Ok(GeneratedField::QueryData), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySmartContractStateRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QuerySmartContractStateRequest") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut address__ = None; + let mut query_data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Address => { + if address__.is_some() { + return Err(serde::de::Error::duplicate_field("address")); + } + address__ = Some(map_.next_value()?); + } + GeneratedField::QueryData => { + if query_data__.is_some() { + return Err(serde::de::Error::duplicate_field("queryData")); + } + query_data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QuerySmartContractStateRequest { + address: address__.unwrap_or_default(), + query_data: query_data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QuerySmartContractStateRequest", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for QuerySmartContractStateResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.data.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.QuerySmartContractStateResponse", len)?; + if !self.data.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for QuerySmartContractStateResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["data"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Data, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "data" => Ok(GeneratedField::Data), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = QuerySmartContractStateResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.QuerySmartContractStateResponse") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut data__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Data => { + if data__.is_some() { + return Err(serde::de::Error::duplicate_field("data")); + } + data__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(QuerySmartContractStateResponse { + data: data__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.QuerySmartContractStateResponse", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for Sequence { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.id_key.is_empty() { + len += 1; + } + if self.value != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("cosmwasm.wasm.v1.Sequence", len)?; + if !self.id_key.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "idKey", + pbjson::private::base64::encode(&self.id_key).as_str(), + )?; + } + if self.value != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("value", ToString::to_string(&self.value).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Sequence { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["id_key", "idKey", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + IdKey, + Value, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "idKey" | "id_key" => Ok(GeneratedField::IdKey), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Sequence; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.Sequence") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id_key__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::IdKey => { + if id_key__.is_some() { + return Err(serde::de::Error::duplicate_field("idKey")); + } + id_key__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + value__ = Some( + map_.next_value::<::pbjson::private::NumberDeserialize<_>>()? + .0, + ); + } + } + } + Ok(Sequence { + id_key: id_key__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("cosmwasm.wasm.v1.Sequence", FIELDS, GeneratedVisitor) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for StoreCodeProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.run_as.is_empty() { + len += 1; + } + if !self.wasm_byte_code.is_empty() { + len += 1; + } + if self.instantiate_permission.is_some() { + len += 1; + } + if self.unpin_code { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.StoreCodeProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.run_as.is_empty() { + struct_ser.serialize_field("runAs", &self.run_as)?; + } + if !self.wasm_byte_code.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field( + "wasmByteCode", + pbjson::private::base64::encode(&self.wasm_byte_code).as_str(), + )?; + } + if let Some(v) = self.instantiate_permission.as_ref() { + struct_ser.serialize_field("instantiatePermission", v)?; + } + if self.unpin_code { + struct_ser.serialize_field("unpinCode", &self.unpin_code)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for StoreCodeProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "title", + "description", + "run_as", + "runAs", + "wasm_byte_code", + "wasmByteCode", + "instantiate_permission", + "instantiatePermission", + "unpin_code", + "unpinCode", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + RunAs, + WasmByteCode, + InstantiatePermission, + UnpinCode, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "runAs" | "run_as" => Ok(GeneratedField::RunAs), + "wasmByteCode" | "wasm_byte_code" => Ok(GeneratedField::WasmByteCode), + "instantiatePermission" | "instantiate_permission" => { + Ok(GeneratedField::InstantiatePermission) + } + "unpinCode" | "unpin_code" => Ok(GeneratedField::UnpinCode), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = StoreCodeProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.StoreCodeProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut run_as__ = None; + let mut wasm_byte_code__ = None; + let mut instantiate_permission__ = None; + let mut unpin_code__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::RunAs => { + if run_as__.is_some() { + return Err(serde::de::Error::duplicate_field("runAs")); + } + run_as__ = Some(map_.next_value()?); + } + GeneratedField::WasmByteCode => { + if wasm_byte_code__.is_some() { + return Err(serde::de::Error::duplicate_field("wasmByteCode")); + } + wasm_byte_code__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + GeneratedField::InstantiatePermission => { + if instantiate_permission__.is_some() { + return Err(serde::de::Error::duplicate_field( + "instantiatePermission", + )); + } + instantiate_permission__ = map_.next_value()?; + } + GeneratedField::UnpinCode => { + if unpin_code__.is_some() { + return Err(serde::de::Error::duplicate_field("unpinCode")); + } + unpin_code__ = Some(map_.next_value()?); + } + } + } + Ok(StoreCodeProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + run_as: run_as__.unwrap_or_default(), + wasm_byte_code: wasm_byte_code__.unwrap_or_default(), + instantiate_permission: instantiate_permission__, + unpin_code: unpin_code__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.StoreCodeProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for SudoContractProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + if !self.msg.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.SudoContractProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + if !self.msg.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser + .serialize_field("msg", pbjson::private::base64::encode(&self.msg).as_str())?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for SudoContractProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "contract", "msg"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + Contract, + Msg, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "contract" => Ok(GeneratedField::Contract), + "msg" => Ok(GeneratedField::Msg), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SudoContractProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.SudoContractProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut contract__ = None; + let mut msg__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + GeneratedField::Msg => { + if msg__.is_some() { + return Err(serde::de::Error::duplicate_field("msg")); + } + msg__ = Some( + map_.next_value::<::pbjson::private::BytesDeserialize<_>>()? + .0, + ); + } + } + } + Ok(SudoContractProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + msg: msg__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.SudoContractProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for UnpinCodesProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.code_ids.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.UnpinCodesProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.code_ids.is_empty() { + struct_ser.serialize_field( + "codeIds", + &self + .code_ids + .iter() + .map(ToString::to_string) + .collect::>(), + )?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for UnpinCodesProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "code_ids", "codeIds"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + CodeIds, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "codeIds" | "code_ids" => Ok(GeneratedField::CodeIds), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UnpinCodesProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.UnpinCodesProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut code_ids__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::CodeIds => { + if code_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("codeIds")); + } + code_ids__ = Some( + map_.next_value::>>()? + .into_iter() + .map(|x| x.0) + .collect(), + ); + } + } + } + Ok(UnpinCodesProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + code_ids: code_ids__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.UnpinCodesProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for UpdateAdminProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.new_admin.is_empty() { + len += 1; + } + if !self.contract.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.UpdateAdminProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.new_admin.is_empty() { + struct_ser.serialize_field("newAdmin", &self.new_admin)?; + } + if !self.contract.is_empty() { + struct_ser.serialize_field("contract", &self.contract)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for UpdateAdminProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["title", "description", "new_admin", "newAdmin", "contract"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + NewAdmin, + Contract, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "newAdmin" | "new_admin" => Ok(GeneratedField::NewAdmin), + "contract" => Ok(GeneratedField::Contract), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UpdateAdminProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.UpdateAdminProposal") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut new_admin__ = None; + let mut contract__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::NewAdmin => { + if new_admin__.is_some() { + return Err(serde::de::Error::duplicate_field("newAdmin")); + } + new_admin__ = Some(map_.next_value()?); + } + GeneratedField::Contract => { + if contract__.is_some() { + return Err(serde::de::Error::duplicate_field("contract")); + } + contract__ = Some(map_.next_value()?); + } + } + } + Ok(UpdateAdminProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + new_admin: new_admin__.unwrap_or_default(), + contract: contract__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.UpdateAdminProposal", + FIELDS, + GeneratedVisitor, + ) + } +} +#[cfg(feature = "serde")] +impl serde::Serialize for UpdateInstantiateConfigProposal { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.title.is_empty() { + len += 1; + } + if !self.description.is_empty() { + len += 1; + } + if !self.access_config_updates.is_empty() { + len += 1; + } + let mut struct_ser = + serializer.serialize_struct("cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", len)?; + if !self.title.is_empty() { + struct_ser.serialize_field("title", &self.title)?; + } + if !self.description.is_empty() { + struct_ser.serialize_field("description", &self.description)?; + } + if !self.access_config_updates.is_empty() { + struct_ser.serialize_field("accessConfigUpdates", &self.access_config_updates)?; + } + struct_ser.end() + } +} +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for UpdateInstantiateConfigProposal { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "title", + "description", + "access_config_updates", + "accessConfigUpdates", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Title, + Description, + AccessConfigUpdates, + } + #[cfg(feature = "serde")] + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut std::fmt::Formatter<'_>, + ) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "title" => Ok(GeneratedField::Title), + "description" => Ok(GeneratedField::Description), + "accessConfigUpdates" | "access_config_updates" => { + Ok(GeneratedField::AccessConfigUpdates) + } + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UpdateInstantiateConfigProposal; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct cosmwasm.wasm.v1.UpdateInstantiateConfigProposal") + } + + fn visit_map( + self, + mut map_: V, + ) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut title__ = None; + let mut description__ = None; + let mut access_config_updates__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Title => { + if title__.is_some() { + return Err(serde::de::Error::duplicate_field("title")); + } + title__ = Some(map_.next_value()?); + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = Some(map_.next_value()?); + } + GeneratedField::AccessConfigUpdates => { + if access_config_updates__.is_some() { + return Err(serde::de::Error::duplicate_field( + "accessConfigUpdates", + )); + } + access_config_updates__ = Some(map_.next_value()?); + } + } + } + Ok(UpdateInstantiateConfigProposal { + title: title__.unwrap_or_default(), + description: description__.unwrap_or_default(), + access_config_updates: access_config_updates__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct( + "cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + FIELDS, + GeneratedVisitor, + ) + } +} diff --git a/cosmos-sdk-proto/src/type_names.rs b/cosmos-sdk-proto/src/type_names.rs index e555f162..7871dced 100644 --- a/cosmos-sdk-proto/src/type_names.rs +++ b/cosmos-sdk-proto/src/type_names.rs @@ -300,6 +300,11 @@ impl_name!( "cosmos.staking.v1beta1", "Validator" ); +impl_name!( + cosmos::staking::v1beta1::StakeAuthorization, + "cosmos.staking.v1beta1", + "StakeAuthorization" +); impl_name!( cosmos::base::abci::v1beta1::MsgData, @@ -333,6 +338,21 @@ impl_name!( "cosmos.authz.v1beta1", "MsgExec" ); +impl_name!( + cosmos::authz::v1beta1::GenericAuthorization, + "cosmos.authz.v1beta1", + "GenericAuthorization" +); +impl_name!( + cosmos::authz::v1beta1::GrantAuthorization, + "cosmos.authz.v1beta1", + "GrantAuthorization" +); +impl_name!( + cosmos::authz::v1beta1::Grant, + "cosmos.authz.v1beta1", + "Grant" +); impl_name!(cosmos::tx::v1beta1::Tx, "cosmos.tx.v1beta1", "Tx"); impl_name!( diff --git a/proto-build/buf.sdk.gen.yaml b/proto-build/buf.sdk.gen.yaml index 3ee8e4d2..12f7ef23 100644 --- a/proto-build/buf.sdk.gen.yaml +++ b/proto-build/buf.sdk.gen.yaml @@ -3,7 +3,11 @@ plugins: - plugin: buf.build/community/neoeinstein-prost:v0.3.1 out: . opt: + - compile_well_known_types + - extern_path=.google.protobuf=::tendermint_proto::google::protobuf - extern_path=.tendermint=::tendermint_proto::v0_34 + - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0 + out: . - plugin: buf.build/community/neoeinstein-tonic:v0.3.0 out: . opt: diff --git a/proto-build/buf.wasmd.gen.yaml b/proto-build/buf.wasmd.gen.yaml index b49ebab5..1618dd1e 100644 --- a/proto-build/buf.wasmd.gen.yaml +++ b/proto-build/buf.wasmd.gen.yaml @@ -2,6 +2,12 @@ version: v1 plugins: - plugin: buf.build/community/neoeinstein-prost:v0.3.1 out: . + opt: + - compile_well_known_types + - extern_path=.google.protobuf=::tendermint_proto::google::protobuf + - extern_path=.tendermint=::tendermint_proto::v0_34 + - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0 + out: . - plugin: buf.build/community/neoeinstein-tonic:v0.3.0 out: . opt: diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index 82f965f6..17d457b6 100644 --- a/proto-build/src/main.rs +++ b/proto-build/src/main.rs @@ -379,6 +379,17 @@ fn copy_and_patch(src: impl AsRef, dest: impl AsRef) -> io::Result<( // Use `tendermint_proto` as source of `google.protobuf` types // TODO(tarcieri): figure out what's wrong with our `buf` config and do it there ("::prost_types::", "::tendermint_proto::google::protobuf::"), + // add the feature flag to the serde definitions + ( + "impl serde::Serialize for", + "#[cfg(feature = \"serde\")]\n\ + impl serde::Serialize for", + ), + ( + "impl<'de> serde::Deserialize<'de> for", + "#[cfg(feature = \"serde\")]\n\ + impl<'de> serde::Deserialize<'de> for", + ), ]; // Skip proto files belonging to `EXCLUDED_PROTO_PACKAGES` @@ -424,4 +435,22 @@ fn apply_patches(proto_dir: &Path) { ) .expect("error patching cosmos.staking.v1beta1.rs"); } + + for (pattern, replacement) in [ + ( + "stake_authorization::Validators::AllowList", + "stake_authorization::Policy::AllowList", + ), + ( + "stake_authorization::Validators::DenyList", + "stake_authorization::Policy::DenyList", + ), + ] { + patch_file( + &proto_dir.join("cosmos-sdk/cosmos.staking.v1beta1.serde.rs"), + &Regex::new(pattern).unwrap(), + replacement, + ) + .expect("error patching cosmos.staking.v1beta1.serde.rs"); + } }