Skip to content

Commit

Permalink
feat: List HRP prefixes in Bech32 addresses (#13064)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy authored Sep 5, 2022
1 parent de436c2 commit 8579bdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions client/debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func Cmd() *cobra.Command {
cmd.AddCommand(PubkeyRawCmd())
cmd.AddCommand(AddrCmd())
cmd.AddCommand(RawBytesCmd())
cmd.AddCommand(PrefixesCmd())

return cmd
}
Expand Down Expand Up @@ -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
},
}
}

0 comments on commit 8579bdd

Please sign in to comment.