Skip to content

Commit 14f80d9

Browse files
committed
Slightly better ux
1 parent dab99f9 commit 14f80d9

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ from the channels.
88

99
```bash
1010
cargo install mutiny-data-recovery
11-
mutiny-data-recovery --seed "your seed here"
11+
mutiny-data-recovery
1212
```

src/config.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
use bip39::Mnemonic;
21
use clap::Parser;
32

43
#[derive(Parser, Debug, Clone)]
54
#[command(version, author, about)]
65
/// A tool for recovering a mutiny wallet from a corrupted state.
76
pub struct Config {
8-
/// Your mnemonic seed
9-
#[clap(short, long)]
10-
pub seed: Mnemonic,
117
/// URL for mutiny authentication
128
#[clap(default_value = "https://auth.mutinywallet.com", short, long)]
139
pub auth_url: String,

src/main.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use mutiny_core::bitcoin::Network;
66
use mutiny_core::lnurlauth::AuthManager;
77
use mutiny_core::logging::MutinyLogger;
88
use mutiny_core::vss::MutinyVssClient;
9+
use std::io::Write;
10+
use std::str::FromStr;
911
use std::sync::Arc;
1012

1113
mod config;
@@ -14,8 +16,23 @@ mod config;
1416
async fn main() -> anyhow::Result<()> {
1517
let logger = Arc::new(MutinyLogger::default());
1618
let config: Config = Config::parse();
17-
let seed = config.seed.to_seed("");
18-
let xprivkey = ExtendedPrivKey::new_master(Network::Bitcoin, &seed).unwrap();
19+
20+
// Create a mutable string to store the user input
21+
let mut input = String::new();
22+
23+
// Prompt the user for input
24+
print!("Enter your mnemonic seed: ");
25+
// Flush stdout to ensure the prompt is displayed before input is read
26+
std::io::stdout().flush()?;
27+
28+
// Read the input from stdin and handle potential errors
29+
std::io::stdin()
30+
.read_line(&mut input)
31+
.expect("Failed to read line");
32+
33+
let seed = bip39::Mnemonic::from_str(input.trim())?;
34+
35+
let xprivkey = ExtendedPrivKey::new_master(Network::Bitcoin, &seed.to_seed("")).unwrap();
1936

2037
let auth_manager = AuthManager::new(xprivkey).unwrap();
2138

@@ -67,7 +84,7 @@ async fn main() -> anyhow::Result<()> {
6784
// put the new objects back
6885
vss.put_objects(new_objects).await?;
6986

70-
println!("Done! Open Mutiny Wallet and your channels should force close.");
87+
println!("\nDone! Open Mutiny Wallet and your channels should force close and be recoverable on-chain in 3-14 days.");
7188

7289
Ok(())
7390
}

0 commit comments

Comments
 (0)