From 8579bdd17ea8d46db5b09124b55ed46279c7d2a5 Mon Sep 17 00:00:00 2001 From: Rano | Ranadeep Date: Mon, 5 Sep 2022 16:02:43 +0200 Subject: [PATCH] feat: List HRP prefixes in Bech32 addresses (#13064) --- CHANGELOG.md | 1 + client/debug/main.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ef913933..3105c7fcc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (testutil) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Add generic `testutil.RandSliceElem` function which selects a random element from the list. * (client) [#12936](https://github.com/cosmos/cosmos-sdk/pull/12936) Add capability to preprocess transactions before broadcasting from a higher level chain. * (x/authz) [#13047](https://github.com/cosmos/cosmos-sdk/pull/13047) Add a GetAuthorization function to the keeper. +* (cli) [#13064](https://github.com/cosmos/cosmos-sdk/pull/13064) Add `debug prefixes` to list supported HRP prefixes via . * (cli) [#12742](https://github.com/cosmos/cosmos-sdk/pull/12742) Add the `prune` CLI cmd to manually prune app store history versions based on the pruning options. ### Improvements diff --git a/client/debug/main.go b/client/debug/main.go index df21d31c82..645e6fe36e 100644 --- a/client/debug/main.go +++ b/client/debug/main.go @@ -37,6 +37,7 @@ func Cmd() *cobra.Command { cmd.AddCommand(PubkeyRawCmd()) cmd.AddCommand(AddrCmd()) cmd.AddCommand(RawBytesCmd()) + cmd.AddCommand(PrefixesCmd()) return cmd } @@ -257,3 +258,18 @@ $ %s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 11 }, } } + +func PrefixesCmd() *cobra.Command { + return &cobra.Command{ + Use: "prefixes", + Short: "List prefixes used for Human-Readable Part (HRP) in Bech32", + Long: "List prefixes used in Bech32 addresses.", + Example: fmt.Sprintf("$ %s debug prefixes", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + cmd.Printf("Bech32 Acc: %s\n", sdk.GetConfig().GetBech32AccountAddrPrefix()) + cmd.Printf("Bech32 Val: %s\n", sdk.GetConfig().GetBech32ValidatorAddrPrefix()) + cmd.Printf("Bech32 Con: %s\n", sdk.GetConfig().GetBech32ConsensusAddrPrefix()) + return nil + }, + } +}