Wallet Interactive-mode, Part 1 (#295)

* cli addition to yml

* first experiments with CLI mode

* rustfmt

* modify owner_single_use to take optional instantiated API

* refactor command functions to take owner api instance

* modify commands to use single owner api instance

* add ability to pass customised message handler to API

* prevent update wallet attempt if wallet hasn't been opened

* fix output when internal updater is running

* add termion, use cli for status updates, remove logging output from CLI

* some attempts to clean up the command prompt and accomodate scanning intervals

* rework listener slightly to allow for cli mode, add close command

* remove termion dependency
This commit is contained in:
Yeastplume
2020-02-06 09:08:24 +00:00
committed by GitHub
parent 0ae921461c
commit 2d264db91a
28 changed files with 929 additions and 314 deletions
+16 -6
View File
@@ -122,13 +122,23 @@ where
) -> Result<(), Error> {
self.is_running.store(true, Ordering::Relaxed);
loop {
let wallet_opened = {
let mut w_lock = self.wallet_inst.lock();
let w_provider = w_lock.lc_provider()?;
match w_provider.wallet_inst() {
Ok(_) => true,
Err(_) => false,
}
};
// Business goes here
owner::update_wallet_state(
self.wallet_inst.clone(),
(&keychain_mask).as_ref(),
status_send_channel,
false,
)?;
if wallet_opened {
owner::update_wallet_state(
self.wallet_inst.clone(),
(&keychain_mask).as_ref(),
status_send_channel,
false,
)?;
}
if !self.is_running.load(Ordering::Relaxed) {
break;
}