From 1388ce8c4c2215ed029414d71833eab4b9bc8dc2 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Sun, 22 Oct 2023 17:56:01 +0000 Subject: Add Support for Genereting Mnemonic for Vanity Address --- src/cmd.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/cmd.rs') diff --git a/src/cmd.rs b/src/cmd.rs index def1ec2..31add32 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -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 { 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) } } -- cgit v1.2.3