feat: List HRP prefixes in Bech32 addresses (#13064)

This commit is contained in:
Rano | Ranadeep
2022-09-05 14:02:43 +00:00
committed by GitHub
parent de436c231d
commit 8579bdd17e
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -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
},
}
}