This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to get rid off as much annotations asap
* Might consume slight more memory than pure conditional compilation flags
- Loading branch information
Showing
8 changed files
with
73 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! Dummy module for platforms that does not provide support for hardware wallets (libusb) | ||
|
||
use super::{fmt, Address}; | ||
|
||
pub struct WalletInfo { | ||
pub address: Address, | ||
pub name: String, | ||
pub manufacturer: String, | ||
} | ||
|
||
#[derive(Debug)] | ||
/// `ErrorType` for devices with no `hardware wallet` | ||
pub enum HardwareError { | ||
NoWallet, | ||
} | ||
|
||
/// `HardwareWalletManager` for devices with no `hardware wallet` | ||
pub struct HardwareWalletManager; | ||
|
||
impl HardwareWalletManager { | ||
pub fn wallet_info(&self, _: &Address) -> Option<WalletInfo> { | ||
None | ||
} | ||
|
||
pub fn list_wallets(&self) -> Vec<WalletInfo> { | ||
Vec::with_capacity(0) | ||
} | ||
|
||
pub fn list_locked_wallets(&self) -> Result<Vec<String>, HardwareError> { | ||
Err(HardwareError::NoWallet) | ||
} | ||
|
||
pub fn pin_matrix_ack(&self, _: &str, _: &str) -> Result<bool, HardwareError> { | ||
Err(HardwareError::NoWallet) | ||
} | ||
} | ||
|
||
impl fmt::Display for HardwareError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.