-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add a new command to list supported algos #14655
Changes from 4 commits
479c13f
3eff023
8423fae
62fe4e1
42a35da
7719c92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import ( | |
|
||
"github.com/cosmos/go-bip39" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
|
@@ -77,7 +78,16 @@ Example: | |
f.Uint32(flagCoinType, sdk.GetConfig().GetCoinType(), "coin type number for HD derivation") | ||
f.Uint32(flagAccount, 0, "Account number for HD derivation (less than equal 2147483647)") | ||
f.Uint32(flagIndex, 0, "Address index number for HD derivation (less than equal 2147483647)") | ||
f.String(flags.FlagKeyAlgorithm, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") | ||
f.String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") | ||
|
||
// support old flags name for backwards compatibility | ||
cmd.PersistentFlags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if name == "algo" { | ||
name = flags.FlagKeyType | ||
} | ||
|
||
return pflag.NormalizedName(name) | ||
}) | ||
|
||
return cmd | ||
} | ||
|
@@ -113,7 +123,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf | |
outputFormat := ctx.OutputFormat | ||
|
||
keyringAlgos, _ := kb.SupportedAlgorithms() | ||
algoStr, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm) | ||
algoStr, _ := cmd.Flags().GetString(flags.FlagKeyType) | ||
Check warning Code scanning / gosec Returned error is not propagated up the stack.
Returned error is not propagated up the stack.
|
||
algo, err := keyring.NewSigningAlgoFromString(algoStr, keyringAlgos) | ||
if err != nil { | ||
return err | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.PersistentFlags()
should have beencmd.Flags()
and my fat fingers merged from my phone.I can fix in on some unrelated incoming PR.