Skip to content

Commit 2a018fc

Browse files
committed
feat: add coin-type and key-type when generate key
1 parent f9dd081 commit 2a018fc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cosmosutils/keys.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ func UnmarshalKeyInfo(rawJson string) (KeyInfo, error) {
3636
// AddOrReplace adds or replaces a key using `initiad keys add <keyname> --keyring-backend test` with 'y' confirmation
3737
func AddOrReplace(appName, keyname string) (string, error) {
3838
// Command to add the key: echo 'y' | initiad keys add <keyname> --keyring-backend test
39-
cmd := exec.Command(appName, "keys", "add", keyname, "--keyring-backend", "test", "--output", "json")
40-
39+
cmd := exec.Command(appName, "keys", "add", keyname, "--coin-type", "118", "--key-type", "secp256k1", "--keyring-backend", "test", "--output", "json")
4140
// Simulate pressing 'y' for confirmation
4241
cmd.Stdin = bytes.NewBufferString("y\n")
4342

@@ -79,7 +78,7 @@ func RecoverKeyFromMnemonic(appName, keyname, mnemonic string) (string, error) {
7978
inputBuffer.WriteString(mnemonic + "\n")
8079

8180
// Command to recover (or replace) the key: initiad keys add <keyname> --recover --keyring-backend test
82-
cmd := exec.Command(appName, "keys", "add", keyname, "--recover", "--keyring-backend", "test", "--output", "json")
81+
cmd := exec.Command(appName, "keys", "add", keyname, "--coin-type", "118", "--key-type", "secp256k1", "--recover", "--keyring-backend", "test", "--output", "json")
8382

8483
// Pass the combined confirmation and mnemonic as input to the command
8584
cmd.Stdin = &inputBuffer

0 commit comments

Comments
 (0)