aboutsummaryrefslogtreecommitdiff
path: root/src/cmd.rs
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2023-10-22 17:56:01 +0000
committerNicholas Rodrigues Lordello <[email protected]>2023-10-22 17:56:01 +0000
commit1388ce8c4c2215ed029414d71833eab4b9bc8dc2 (patch)
tree93bbd822db9f7ddcf548f65e23fdbdf39db4d136 /src/cmd.rs
parentca758736f76d9c32d7e5df44e270bf2879a1b86c (diff)
Add Support for Genereting Mnemonic for Vanity Address
Diffstat (limited to 'src/cmd.rs')
-rw-r--r--src/cmd.rs13
1 files changed, 7 insertions, 6 deletions
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<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)
}
}