tensor_eigen/formatting/
wallet.rs

1use console::Style;
2use solana_sdk::native_token::lamports_to_sol;
3
4use crate::{formatting::pad_label, Shard};
5
6use super::{AccountEntry, CustomFormat};
7
8const LABEL_LENGTH: usize = 15;
9
10impl CustomFormat for Shard {
11    fn custom_format(&self) -> String {
12        // Use the default text color but set this up for future use.
13        let color = Style::new();
14
15        format!(
16            "{}
17{}: {}
18{}: {}
19{}: {}",
20            color.apply_to("Tensor Fee Shard"),
21            pad_label("address", LABEL_LENGTH),
22            color.apply_to(self.address.to_string()),
23            pad_label("lamports", LABEL_LENGTH),
24            color.apply_to(self.account.lamports),
25            pad_label("SOL", LABEL_LENGTH),
26            color.apply_to(lamports_to_sol(self.account.lamports)),
27        )
28    }
29}
30
31impl CustomFormat for AccountEntry {
32    fn custom_format(&self) -> String {
33        // Use the default text color but set this up for future use.
34        let color = Style::new();
35
36        format!(
37            "{}
38{}: {}
39{}: {}
40{}: {}",
41            color.apply_to("Wallet---------"),
42            pad_label("lamports", LABEL_LENGTH),
43            color.apply_to(self.account.lamports),
44            pad_label("SOL", LABEL_LENGTH),
45            color.apply_to(lamports_to_sol(self.account.lamports)),
46            pad_label("pda", LABEL_LENGTH),
47            color.apply_to((!self.address.is_on_curve()).to_string()),
48        )
49    }
50}