Skip to content

Commit

Permalink
Added GenerateSaveCoinKeyFromPath method
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM committed Jul 19, 2021
1 parent 5ff1063 commit 4fc0f4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func GenerateCoinKey(algo keyring.SignatureAlgo) (sdk.AccAddress, string, error)
// GenerateSaveCoinKey returns the address of a public key, along with the secret
// phrase to recover the private key.
func GenerateSaveCoinKey(keybase keyring.Keyring, keyName string, overwrite bool, algo keyring.SignatureAlgo) (sdk.AccAddress, string, error) {
return GenerateSaveCoinKeyFromPath(keybase, keyName, overwrite, algo, sdk.FullFundraiserPath)
}

// GenerateSaveCoinKeyFromPath returns the address of a public key, along with the secret
// phrase to recover the private key.
func GenerateSaveCoinKeyFromPath(keybase keyring.Keyring, keyName string, overwrite bool, algo keyring.SignatureAlgo, path string) (sdk.AccAddress, string, error) {
exists := false
_, err := keybase.Key(keyName)
if err == nil {
Expand All @@ -43,7 +49,7 @@ func GenerateSaveCoinKey(keybase keyring.Keyring, keyName string, overwrite bool
}
}

info, secret, err := keybase.NewMnemonic(keyName, keyring.English, sdk.FullFundraiserPath, algo)
info, secret, err := keybase.NewMnemonic(keyName, keyring.English, path, algo)
if err != nil {
return sdk.AccAddress([]byte{}), "", err
}
Expand Down

0 comments on commit 4fc0f4e

Please sign in to comment.