diff --git a/integration_tests/src/test_suite_map.rs b/integration_tests/src/test_suite_map.rs index 2fa8e1d..648e8a5 100644 --- a/integration_tests/src/test_suite_map.rs +++ b/integration_tests/src/test_suite_map.rs @@ -1169,8 +1169,8 @@ pub fn prepare_function_map() -> HashMap { // #[nssa_integration_test] // pub async fn test_success_private_transfer_to_another_owned_account_cont_run_path() { // info!( - // "########## test_success_private_transfer_to_another_owned_account_cont_run_path ##########" - // ); + // "########## test_success_private_transfer_to_another_owned_account_cont_run_path + // ##########" ); // let continious_run_handle = tokio::spawn(wallet::execute_continious_run()); // let from: AccountId = ACC_SENDER_PRIVATE.parse().unwrap(); diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index b04d67e..74eb5bc 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -19,6 +19,7 @@ borsh.workspace = true base58.workspace = true hex = "0.4.3" rand.workspace = true +itertools = "0.14.0" [dependencies.key_protocol] path = "../key_protocol" diff --git a/wallet/src/cli/account.rs b/wallet/src/cli/account.rs index 79371c8..d1e361a 100644 --- a/wallet/src/cli/account.rs +++ b/wallet/src/cli/account.rs @@ -1,6 +1,7 @@ use anyhow::Result; use base58::ToBase58; use clap::Subcommand; +use itertools::Itertools as _; use nssa::{Account, AccountId, program::Program}; use serde::Serialize; @@ -83,6 +84,9 @@ pub enum AccountSubcommand { New(NewSubcommand), /// Sync private accounts SyncPrivate {}, + /// List all accounts owned by the wallet + #[command(visible_alias = "ls")] + List {}, } /// Represents generic register CLI subcommand @@ -294,6 +298,23 @@ impl WalletSubcommand for AccountSubcommand { Ok(SubcommandReturnValue::SyncedToBlock(curr_last_block)) } + AccountSubcommand::List {} => { + let user_data = &wallet_core.storage.user_data; + let accounts = user_data + .pub_account_signing_keys + .keys() + .map(|id| format!("Public/{id}")) + .chain( + user_data + .user_private_accounts + .keys() + .map(|id| format!("Private/{id}")), + ) + .format(",\n"); + + println!("{accounts}"); + Ok(SubcommandReturnValue::Empty) + } } } }