From 3c04c6aac548b910124701ce6c3dca362f29031e Mon Sep 17 00:00:00 2001
From: Christoph Otter <chris@confio.gmbh>
Date: Wed, 26 Jul 2023 11:25:49 +0200
Subject: [PATCH 1/3] Export missing query responses

---
 packages/std/src/lib.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/std/src/lib.rs b/packages/std/src/lib.rs
index 13eeee2874..a120f14ff5 100644
--- a/packages/std/src/lib.rs
+++ b/packages/std/src/lib.rs
@@ -71,6 +71,11 @@ pub use crate::query::{
     AllDelegationsResponse, AllValidatorsResponse, BondedDenomResponse, Delegation,
     DelegationResponse, FullDelegation, StakingQuery, Validator, ValidatorResponse,
 };
+#[cfg(feature = "cosmwasm_1_3")]
+pub use crate::query::{
+    AllDenomMetadataResponse, DelegatorWithdrawAddressResponse, DenomMetadataResponse,
+    DistributionQuery,
+};
 #[cfg(feature = "stargate")]
 pub use crate::query::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
 #[allow(deprecated)]

From 1c844817609ead448141ecaf358286d66329bb91 Mon Sep 17 00:00:00 2001
From: Christoph Otter <chris@confio.gmbh>
Date: Wed, 26 Jul 2023 13:05:32 +0200
Subject: [PATCH 2/3] Export all types in query module

---
 packages/std/src/query/mod.rs | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/packages/std/src/query/mod.rs b/packages/std/src/query/mod.rs
index f1694805e6..90bac6f38e 100644
--- a/packages/std/src/query/mod.rs
+++ b/packages/std/src/query/mod.rs
@@ -31,23 +31,13 @@ mod query_response;
 mod staking;
 mod wasm;
 
-#[cfg(feature = "cosmwasm_1_1")]
-pub use bank::SupplyResponse;
-pub use bank::{AllBalanceResponse, BalanceResponse, BankQuery};
-#[cfg(feature = "cosmwasm_1_3")]
-pub use bank::{AllDenomMetadataResponse, DenomMetadataResponse};
-#[cfg(feature = "cosmwasm_1_3")]
-pub use distribution::{DelegatorWithdrawAddressResponse, DistributionQuery};
+pub use bank::*;
+pub use distribution::*;
 #[cfg(feature = "stargate")]
-pub use ibc::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
+pub use ibc::*;
 #[cfg(feature = "staking")]
-pub use staking::{
-    AllDelegationsResponse, AllValidatorsResponse, BondedDenomResponse, Delegation,
-    DelegationResponse, FullDelegation, StakingQuery, Validator, ValidatorResponse,
-};
-#[cfg(feature = "cosmwasm_1_2")]
-pub use wasm::CodeInfoResponse;
-pub use wasm::{ContractInfoResponse, WasmQuery};
+pub use staking::*;
+pub use wasm::*;
 
 #[non_exhaustive]
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]

From 9c94a882d53de282d5a5b2e79030b68ad0fd1fe3 Mon Sep 17 00:00:00 2001
From: Christoph Otter <chris@confio.gmbh>
Date: Wed, 26 Jul 2023 13:56:15 +0200
Subject: [PATCH 3/3] Reduce feature gates for queries

---
 packages/std/src/ibc.rs           |  1 -
 packages/std/src/lib.rs           | 25 ++++++-------------------
 packages/std/src/query/bank.rs    | 12 ++----------
 packages/std/src/query/ibc.rs     |  2 --
 packages/std/src/query/mod.rs     |  2 --
 packages/std/src/query/staking.rs |  2 --
 packages/std/src/query/wasm.rs    |  7 +------
 7 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/packages/std/src/ibc.rs b/packages/std/src/ibc.rs
index 1ce06432a6..85e982c4c4 100644
--- a/packages/std/src/ibc.rs
+++ b/packages/std/src/ibc.rs
@@ -1,4 +1,3 @@
-#![cfg(feature = "stargate")]
 // The CosmosMsg variants are defined in results/cosmos_msg.rs
 // The rest of the IBC related functionality is defined here
 
diff --git a/packages/std/src/lib.rs b/packages/std/src/lib.rs
index a120f14ff5..a71ed491e7 100644
--- a/packages/std/src/lib.rs
+++ b/packages/std/src/lib.rs
@@ -42,7 +42,6 @@ pub use crate::errors::{
     RecoverPubkeyError, StdError, StdResult, SystemError, VerificationError,
 };
 pub use crate::hex_binary::HexBinary;
-#[cfg(feature = "stargate")]
 pub use crate::ibc::{
     Ibc3ChannelOpenResponse, IbcAcknowledgement, IbcBasicResponse, IbcChannel, IbcChannelCloseMsg,
     IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcEndpoint, IbcMsg, IbcOrder,
@@ -58,26 +57,14 @@ pub use crate::math::{
 pub use crate::metadata::{DenomMetadata, DenomUnit};
 pub use crate::never::Never;
 pub use crate::pagination::PageRequest;
-#[cfg(feature = "cosmwasm_1_2")]
-pub use crate::query::CodeInfoResponse;
-#[cfg(feature = "cosmwasm_1_1")]
-pub use crate::query::SupplyResponse;
-pub use crate::query::{
-    AllBalanceResponse, BalanceResponse, BankQuery, ContractInfoResponse, CustomQuery,
-    QueryRequest, WasmQuery,
-};
-#[cfg(feature = "staking")]
 pub use crate::query::{
-    AllDelegationsResponse, AllValidatorsResponse, BondedDenomResponse, Delegation,
-    DelegationResponse, FullDelegation, StakingQuery, Validator, ValidatorResponse,
+    AllBalanceResponse, AllDelegationsResponse, AllDenomMetadataResponse, AllValidatorsResponse,
+    BalanceResponse, BankQuery, BondedDenomResponse, ChannelResponse, CodeInfoResponse,
+    ContractInfoResponse, CustomQuery, Delegation, DelegationResponse,
+    DelegatorWithdrawAddressResponse, DenomMetadataResponse, DistributionQuery, FullDelegation,
+    IbcQuery, ListChannelsResponse, PortIdResponse, QueryRequest, StakingQuery, SupplyResponse,
+    Validator, ValidatorResponse, WasmQuery,
 };
-#[cfg(feature = "cosmwasm_1_3")]
-pub use crate::query::{
-    AllDenomMetadataResponse, DelegatorWithdrawAddressResponse, DenomMetadataResponse,
-    DistributionQuery,
-};
-#[cfg(feature = "stargate")]
-pub use crate::query::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
 #[allow(deprecated)]
 pub use crate::results::SubMsgExecutionResponse;
 #[cfg(all(feature = "stargate", feature = "cosmwasm_1_2"))]
diff --git a/packages/std/src/query/bank.rs b/packages/std/src/query/bank.rs
index a1ea2670f7..95cf616e2a 100644
--- a/packages/std/src/query/bank.rs
+++ b/packages/std/src/query/bank.rs
@@ -4,7 +4,8 @@ use serde::{Deserialize, Serialize};
 use crate::Coin;
 
 #[cfg(feature = "cosmwasm_1_3")]
-use crate::{Binary, DenomMetadata, PageRequest};
+use crate::PageRequest;
+use crate::{Binary, DenomMetadata};
 
 use super::query_response::QueryResponseType;
 
@@ -34,7 +35,6 @@ pub enum BankQuery {
     AllDenomMetadata { pagination: Option<PageRequest> },
 }
 
-#[cfg(feature = "cosmwasm_1_1")]
 #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
 #[non_exhaustive]
@@ -44,10 +44,8 @@ pub struct SupplyResponse {
     pub amount: Coin,
 }
 
-#[cfg(feature = "cosmwasm_1_1")]
 impl_response_constructor!(SupplyResponse, amount: Coin);
 
-#[cfg(feature = "cosmwasm_1_1")]
 impl QueryResponseType for SupplyResponse {}
 
 #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, JsonSchema)]
@@ -73,7 +71,6 @@ impl_response_constructor!(AllBalanceResponse, amount: Vec<Coin>);
 
 impl QueryResponseType for AllBalanceResponse {}
 
-#[cfg(feature = "cosmwasm_1_3")]
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
 #[non_exhaustive]
@@ -82,13 +79,10 @@ pub struct DenomMetadataResponse {
     pub metadata: DenomMetadata,
 }
 
-#[cfg(feature = "cosmwasm_1_3")]
 impl_response_constructor!(DenomMetadataResponse, metadata: DenomMetadata);
 
-#[cfg(feature = "cosmwasm_1_3")]
 impl QueryResponseType for DenomMetadataResponse {}
 
-#[cfg(feature = "cosmwasm_1_3")]
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
 #[non_exhaustive]
@@ -98,14 +92,12 @@ pub struct AllDenomMetadataResponse {
     pub next_key: Option<Binary>,
 }
 
-#[cfg(feature = "cosmwasm_1_3")]
 impl_response_constructor!(
     AllDenomMetadataResponse,
     metadata: Vec<DenomMetadata>,
     next_key: Option<Binary>
 );
 
-#[cfg(feature = "cosmwasm_1_3")]
 impl QueryResponseType for AllDenomMetadataResponse {}
 
 #[cfg(test)]
diff --git a/packages/std/src/query/ibc.rs b/packages/std/src/query/ibc.rs
index 4cff9e43b4..e8d6ff81e7 100644
--- a/packages/std/src/query/ibc.rs
+++ b/packages/std/src/query/ibc.rs
@@ -1,5 +1,3 @@
-#![cfg(feature = "stargate")]
-
 use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
diff --git a/packages/std/src/query/mod.rs b/packages/std/src/query/mod.rs
index 90bac6f38e..a957574a89 100644
--- a/packages/std/src/query/mod.rs
+++ b/packages/std/src/query/mod.rs
@@ -33,9 +33,7 @@ mod wasm;
 
 pub use bank::*;
 pub use distribution::*;
-#[cfg(feature = "stargate")]
 pub use ibc::*;
-#[cfg(feature = "staking")]
 pub use staking::*;
 pub use wasm::*;
 
diff --git a/packages/std/src/query/staking.rs b/packages/std/src/query/staking.rs
index 6f7b55513f..889144b122 100644
--- a/packages/std/src/query/staking.rs
+++ b/packages/std/src/query/staking.rs
@@ -1,5 +1,3 @@
-#![cfg(feature = "staking")]
-
 use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
diff --git a/packages/std/src/query/wasm.rs b/packages/std/src/query/wasm.rs
index e8f72ad737..9487ff592d 100644
--- a/packages/std/src/query/wasm.rs
+++ b/packages/std/src/query/wasm.rs
@@ -1,9 +1,7 @@
 use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
-use crate::Binary;
-#[cfg(feature = "cosmwasm_1_2")]
-use crate::HexBinary;
+use crate::{Binary, HexBinary};
 
 use super::query_response::QueryResponseType;
 
@@ -76,7 +74,6 @@ impl ContractInfoResponse {
 /// [CodeInfoResponse]: https://github.com/CosmWasm/wasmd/blob/v0.30.0/proto/cosmwasm/wasm/v1/query.proto#L184-L199
 #[non_exhaustive]
 #[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, JsonSchema)]
-#[cfg(feature = "cosmwasm_1_2")]
 pub struct CodeInfoResponse {
     pub code_id: u64,
     /// The address that initially stored the code
@@ -85,7 +82,6 @@ pub struct CodeInfoResponse {
     pub checksum: HexBinary,
 }
 
-#[cfg(feature = "cosmwasm_1_2")]
 impl_response_constructor!(
     CodeInfoResponse,
     code_id: u64,
@@ -93,7 +89,6 @@ impl_response_constructor!(
     checksum: HexBinary
 );
 
-#[cfg(feature = "cosmwasm_1_2")]
 impl QueryResponseType for CodeInfoResponse {}
 
 #[cfg(test)]