From dc89d944d292d0fa77b00c16a1f2651f1fb2a6dc Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 24 Oct 2024 15:54:15 -0600 Subject: [PATCH] Fix: Add node flag to WASM queries (build-address) (#2199) --- .../bug-fixes/2199-fix-wasm-build-addr.md | 1 + cmd/provenanced/cmd/root.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/2199-fix-wasm-build-addr.md diff --git a/.changelog/unreleased/bug-fixes/2199-fix-wasm-build-addr.md b/.changelog/unreleased/bug-fixes/2199-fix-wasm-build-addr.md new file mode 100644 index 000000000..d366ec534 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/2199-fix-wasm-build-addr.md @@ -0,0 +1 @@ +* Add the query flags to the query wasm build-addr command [PR 2199](https://github.com/provenance-io/provenance/pull/2199). diff --git a/cmd/provenanced/cmd/root.go b/cmd/provenanced/cmd/root.go index d151d4d01..8bb24890f 100644 --- a/cmd/provenanced/cmd/root.go +++ b/cmd/provenanced/cmd/root.go @@ -132,6 +132,7 @@ func NewRootCmd(sealConfig bool) (*cobra.Command, params.EncodingConfig) { } fixTxWasmInstantiate2Aliases(rootCmd) + fixQueryWasmBuildAddressFlags(rootCmd) return rootCmd, encodingConfig } @@ -535,3 +536,16 @@ func getTelemetryGlobalLabels(logger log.Logger, appOpts servertypes.AppOptions) logger.Debug("Extracted telemetry setup from app options.", telEnabledKey, enabled, telGlobalLabelsKey, globalLabels) return globalLabels, enabled } + +// fixQueryWasmBuildAddressFlags resolves an issue where the Wasm build-address query failed to recognize the node flag. +func fixQueryWasmBuildAddressFlags(rootCmd *cobra.Command) { + // Find the "build-address" command. + cmd, _, err := rootCmd.Find([]string{"query", "wasm", "build-address"}) + if err != nil || cmd == nil { + // If the command doesn't exist, there's nothing to do. + return + } + + // Apply query flags to the command. + flags.AddQueryFlagsToCmd(cmd) +}