Skip to content

Commit f197fab

Browse files
committed
feat(hwi): add address subcommand for hwi
fix clippy issues
1 parent b925e6a commit f197fab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/commands.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ pub enum HwiSubCommand {
537537
Devices,
538538
/// Register hardware wallet
539539
Register,
540+
/// Generate address
541+
Address,
540542
}
541543

542544
/// Subcommands available in REPL mode.

src/handlers.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,10 @@ pub async fn handle_offline_wallet_subcommand(
638638
//TODO: return status of wallet registration
639639
Ok(json!({ "hmac": hmac }))
640640
}
641+
HwiSubCommand::Address => {
642+
let address = wallet.next_unused_address(KeychainKind::External);
643+
Ok(json!({ "address": address.address }))
644+
}
641645
},
642646
}
643647
}
@@ -1540,6 +1544,7 @@ async fn respond(
15401544
ReplSubCommand::Exit => None,
15411545
};
15421546
if let Some(value) = response {
1547+
let value = serde_json::to_string_pretty(&value).map_err(|e| e.to_string())?;
15431548
writeln!(std::io::stdout(), "{value}").map_err(|e| e.to_string())?;
15441549
std::io::stdout().flush().map_err(|e| e.to_string())?;
15451550
Ok(false)

0 commit comments

Comments
 (0)