Cli: Add resolve-signer subcommand (#8859)

* Expose remote-wallet device pretty path

* Add resolve-signer helpers

* Add cli resolve-signer subcommand

* Print pretty-path in waiting msg
This commit is contained in:
Tyera Eulberg
2020-03-14 20:48:41 -07:00
committed by GitHub
parent c3c4c9326b
commit 3c2aff2b5b
6 changed files with 179 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ mod commands {
/// Ledger Wallet device
pub struct LedgerWallet {
pub device: hidapi::HidDevice,
pub pretty_path: String,
}
impl fmt::Debug for LedgerWallet {
@@ -65,7 +66,10 @@ impl fmt::Debug for LedgerWallet {
impl LedgerWallet {
pub fn new(device: hidapi::HidDevice) -> Self {
Self { device }
Self {
device,
pretty_path: String::default(),
}
}
// Transport Protocol:
@@ -231,7 +235,10 @@ impl LedgerWallet {
) -> Result<Vec<u8>, RemoteWalletError> {
self.write(command, p1, p2, data)?;
if p1 == P1_CONFIRM && is_last_part(p2) {
println!("Waiting for remote wallet to approve...");
println!(
"Waiting for approval from remote wallet {}",
self.pretty_path
);
let result = self.read()?;
println!("{}Approved", CHECK_MARK);
Ok(result)