From 2c978c4b3f9b2fe26ed6ce240a7001e8bcdaa6d0 Mon Sep 17 00:00:00 2001 From: James Dietz Date: Mon, 15 Jan 2024 21:05:09 -0500 Subject: [PATCH] add prompt for seed --- src/subcommand/wallet/restore.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/subcommand/wallet/restore.rs b/src/subcommand/wallet/restore.rs index 76b61beb80..d961d525ed 100644 --- a/src/subcommand/wallet/restore.rs +++ b/src/subcommand/wallet/restore.rs @@ -1,4 +1,5 @@ use super::*; +use std::io; #[derive(Debug, Parser)] #[clap(group( @@ -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) } }