diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2023-10-22 17:56:01 +0000 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2023-10-22 17:56:01 +0000 |
| commit | 1388ce8c4c2215ed029414d71833eab4b9bc8dc2 (patch) | |
| tree | 93bbd822db9f7ddcf548f65e23fdbdf39db4d136 /src/cmd.rs | |
| parent | ca758736f76d9c32d7e5df44e270bf2879a1b86c (diff) | |
Add Support for Genereting Mnemonic for Vanity Address
Diffstat (limited to 'src/cmd.rs')
| -rw-r--r-- | src/cmd.rs | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -29,8 +29,8 @@ struct AccountOptions { #[clap(long, env, hide_env_values = true, default_value_t)] password: String, - /// The BIP-44 account index for deriving a private from the mnemonic seed - /// phrase. The derived key will use the path "m/44'/60'/0'/0/{index}". + /// The BIP-44 account index for deriving a private key from the mnemonic + /// seed phrase. The derived key will use the path "m/44'/60'/0'/0/{index}". #[clap(long, env, default_value_t = 0)] account_index: usize, @@ -44,10 +44,11 @@ impl AccountOptions { /// Returns the private key for the specified account options. pub fn private_key(&self) -> Result<PrivateKey> { let seed = self.mnemonic.seed(&self.password); - match &self.hd_path { - None => hdk::derive_index(seed, self.account_index), - Some(hd_path) => hdk::derive(seed, &hd_path.parse()?), - } + let path = match &self.hd_path { + None => hdk::Path::for_index(self.account_index), + Some(hd_path) => hd_path.parse()?, + }; + hdk::derive(seed, &path) } } |
