Skip to content

Commit

Permalink
add prompt for seed
Browse files Browse the repository at this point in the history
  • Loading branch information
mj10021 committed Feb 15, 2024
1 parent 981765f commit 2c978c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/subcommand/wallet/restore.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::*;
use std::io;

#[derive(Debug, Parser)]
#[clap(group(
Expand Down Expand Up @@ -34,6 +35,17 @@ impl Restore {
unreachable!();
}

let seed = {
if self.mnemonic.is_none() {
let mut input = String::new();
println!("Please input your seed below:");
io::stdin().read_line(&mut input).expect("failed to read mnemonic");
let input = input.into_bytes();
assert_eq!(input.len(), 64);
input.try_into().unwrap()
} else {self.mnemonic.unwrap().to_seed(self.passphrase)}
};
wallet::initialize(seed)?;
Ok(None)
}
}
Expand Down

0 comments on commit 2c978c4

Please sign in to comment.