fedimint_cli/
visualize.rs1use fedimint_client::Client;
7use fedimint_client::visualize::{OperationsVisOutput, TransactionsVisOutput};
8use fedimint_core::core::OperationId;
9use fedimint_mint_client::visualize::get_notes_vis;
10
11use crate::{CliError, CliResultExt};
12
13pub async fn cmd_notes(client: &Client, limit: Option<usize>) -> Result<(), CliError> {
14 eprintln!("E-cash notes with creation and spending provenance.");
15 eprintln!("Each note shows nonce, blind_nonce, and amount (in msats).");
16 eprintln!(" created: timestamp, operation id, and tx output that issued the note");
17 eprintln!(" spent: timestamp, operation id, and tx input that consumed the note");
18 eprintln!("Notes without a 'spent' line are still in the wallet.");
19 eprintln!();
20
21 let output = get_notes_vis(client, limit).await;
22 print!("{output}");
23
24 Ok(())
25}
26
27pub async fn cmd_transactions(
28 client: &Client,
29 operation_id: Option<OperationId>,
30 limit: Option<usize>,
31) -> Result<(), CliError> {
32 eprintln!("Transactions with their inputs and outputs, grouped by operation.");
33 eprintln!("Each tx shows its status (accepted/rejected/pending) and timestamp.");
34 eprintln!("Inputs and outputs show module id, module kind, and Display of the item.");
35 eprintln!();
36
37 let data = client
38 .get_transactions_vis(operation_id, limit)
39 .await
40 .map_err_cli()?;
41 print!("{}", TransactionsVisOutput(data));
42
43 Ok(())
44}
45
46pub async fn cmd_operations(
47 client: &Client,
48 operation_id: Option<OperationId>,
49 limit: Option<usize>,
50) -> Result<(), CliError> {
51 eprintln!("Operations with their state machines, sorted by creation time.");
52 eprintln!("Each operation shows timestamp, op id, module type, and outcome status.");
53 eprintln!("Each state shows [done/active], timestamp, duration, module kind, and details.");
54 eprintln!();
55
56 let data = client
57 .get_operations_vis(operation_id, limit)
58 .await
59 .map_err_cli()?;
60 print!("{}", OperationsVisOutput(data));
61
62 Ok(())
63}