1use cli_core::eval::escape_str;
5use forms::FormValues;
6
7use super::App;
8use super::lookup::Goal;
9use crate::command::{BALANCE_ACCOUNT, BALANCE_ARGS};
10use crate::view::ViewId;
11use crate::window::Origin;
12
13impl App {
14 pub fn show_account_balance(&mut self, input: &str) {
16 let mut values = FormValues::default();
17 values.set(BALANCE_ACCOUNT, input);
18 let origin = self.window_or_open(ViewId::Console);
19 self.start_lookup(Goal::Balance(origin), &BALANCE_ARGS, values);
20 }
21
22 pub(super) fn print_resolved_balance(&mut self, origin: Origin, resolved: &FormValues) {
23 let Some(console) = self.origin_window(origin) else {
24 return;
25 };
26 let id = resolved.text(BALANCE_ACCOUNT).unwrap_or_default();
27 self.submit_console_form(console, format!("(get-balances {})", escape_str(id)));
28 self.show_window_if_free(console);
29 }
30}