Accounts balances (#815)

Co-authored-by: wiesche <wiesche89@googlemail.com>
This commit is contained in:
ardocrat
2026-09-28 11:20:01 +03:00
committed by GitHub
co-authored by wiesche
parent 452a3ec51b
commit 2d87b8c894
23 changed files with 525 additions and 153 deletions
+8
View File
@@ -540,13 +540,20 @@ pub fn accounts(acct_mappings: Vec<AcctPathMapping>) {
mMG->"Name",
bMG->"Parent Output Key",
bMG->"Slatepack Address (Index 0)",
bMG->"Spendable balance",
]);
for m in acct_mappings {
let slatepack_path = address::address_derivation_path(&m.path, 0).to_bip_32_string();
let spendable = if let Some(info) = m.info {
amount_to_hr_string(info.amount_currently_spendable, true)
} else {
"-".to_string()
};
table.add_row(row![
bFC->m.label,
bGC->m.path.to_bip_32_string(),
bGC->slatepack_path,
bGC->spendable,
]);
}
table.set_format(
@@ -562,6 +569,7 @@ pub fn accounts(acct_mappings: Vec<AcctPathMapping>) {
let width = table.to_string().find('\n').unwrap_or(0);
println!("{:^1$}", "BIP-32 Derivation Path", width);
table.printstd();
println!("Balances use local data and may be out of date.");
println!();
}