kaspa_cli_lib/modules/
list.rs

1use crate::imports::*;
2
3#[derive(Default, Handler)]
4#[help("List wallet accounts and their balances")]
5pub struct List;
6
7impl List {
8    async fn main(self: Arc<Self>, ctx: &Arc<dyn Context>, _argv: Vec<String>, _cmd: &str) -> Result<()> {
9        let ctx = ctx.clone().downcast_arc::<KaspaCli>()?;
10
11        ctx.list().await?;
12
13        if !ctx.wallet().is_connected() {
14            tprintln!(ctx, "{}", style("Wallet is not connected to the network").magenta());
15            tprintln!(ctx);
16        } else if !ctx.wallet().is_synced() {
17            tprintln!(ctx, "{}", style("Kaspa node is currently syncing").magenta());
18            tprintln!(ctx);
19        }
20
21        Ok(())
22    }
23}