Option to print only unspent notes and utxos

This commit is contained in:
Aditya Kulkarni
2019-09-12 20:47:23 -07:00
parent d71e37152b
commit 4febeda516
2 changed files with 40 additions and 16 deletions

View File

@@ -176,7 +176,6 @@ impl Command for TransactionsCommand {
let txns = lightclient.do_list_transactions();
println!("{}", txns.pretty(2));
}
}
@@ -190,11 +189,27 @@ impl Command for NotesCommand {
"List all sapling notes in the wallet".to_string()
}
fn exec(&self, _args: &[&str], lightclient: &mut LightClient) {
let txns = lightclient.do_list_notes();
fn exec(&self, args: &[&str], lightclient: &mut LightClient) {
// Parse the args.
if args.len() > 1 {
self.help();
return;
}
// Make sure we can parse the amount
let all_notes = if args.len() == 1 {
match args[0] {
"all" => true,
_ => { println!("Invalid argument. Specify 'all' to include unspent notes");
return; }
}
} else {
false
};
let txns = lightclient.do_list_notes(all_notes);
println!("{}", txns.pretty(2));
}
}