From b8821693a86893e0d29154608a84b23ff9eab219 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 16 Jan 2026 11:12:57 +1100 Subject: [PATCH] Return keys for uninitialized accounts too --- wallet/src/cli/account.rs | 46 ++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/wallet/src/cli/account.rs b/wallet/src/cli/account.rs index 8d040aa5..608ddc85 100644 --- a/wallet/src/cli/account.rs +++ b/wallet/src/cli/account.rs @@ -231,24 +231,8 @@ impl WalletSubcommand for AccountSubcommand { .ok_or(anyhow::anyhow!("Private account not found in storage"))?, }; - if account == Account::default() { - println!("Account is Uninitialized"); - - return Ok(SubcommandReturnValue::Empty); - } - - if raw { - let account_hr: HumanReadableAccount = account.clone().into(); - println!("{}", serde_json::to_string(&account_hr).unwrap()); - - return Ok(SubcommandReturnValue::Empty); - } - - let (description, json_view) = format_account_details(&account); - println!("{description}"); - println!("{json_view}"); - - if keys { + // Helper closure to display keys for the account + let display_keys = |wallet_core: &WalletCore| -> Result<()> { match addr_kind { AccountPrivacyKind::Public => { let private_key = wallet_core @@ -274,6 +258,32 @@ impl WalletSubcommand for AccountSubcommand { ); } } + Ok(()) + }; + + if account == Account::default() { + println!("Account is Uninitialized"); + + if keys { + display_keys(wallet_core)?; + } + + return Ok(SubcommandReturnValue::Empty); + } + + if raw { + let account_hr: HumanReadableAccount = account.clone().into(); + println!("{}", serde_json::to_string(&account_hr).unwrap()); + + return Ok(SubcommandReturnValue::Empty); + } + + let (description, json_view) = format_account_details(&account); + println!("{description}"); + println!("{json_view}"); + + if keys { + display_keys(wallet_core)?; } Ok(SubcommandReturnValue::Empty)