Trait hardware_wallet::Wallet [−][src]
pub trait Wallet<'a> { type Error; type Transaction; fn sign_transaction(
&self,
address: &Address,
transaction: Self::Transaction
) -> Result<Signature, Self::Error>; fn set_key_path(&self, key_path: KeyPath); fn update_devices(
&self,
device_direction: DeviceDirection
) -> Result<usize, Self::Error>; fn read_device(
&self,
usb: &HidApi,
dev_info: &HidDeviceInfo
) -> Result<Device, Self::Error>; fn list_devices(&self) -> Vec<WalletInfo>; fn list_locked_devices(&self) -> Vec<String>; fn get_wallet(&self, address: &Address) -> Option<WalletInfo>; fn get_address(
&self,
device: &HidDevice
) -> Result<Option<Address>, Self::Error>; fn open_path<R, F>(&self, f: F) -> Result<R, Self::Error>
where
F: Fn() -> Result<R, &'static str>; }
Wallet
trait
Associated Types
Required Methods
fn sign_transaction(
&self,
address: &Address,
transaction: Self::Transaction
) -> Result<Signature, Self::Error>
&self,
address: &Address,
transaction: Self::Transaction
) -> Result<Signature, Self::Error>
Sign transaction data with wallet managing address
.
fn set_key_path(&self, key_path: KeyPath)
Set key derivation path for a chain.
fn update_devices(
&self,
device_direction: DeviceDirection
) -> Result<usize, Self::Error>
&self,
device_direction: DeviceDirection
) -> Result<usize, Self::Error>
Re-populate device list Note, this assumes all devices are iterated over and updated
fn read_device(
&self,
usb: &HidApi,
dev_info: &HidDeviceInfo
) -> Result<Device, Self::Error>
&self,
usb: &HidApi,
dev_info: &HidDeviceInfo
) -> Result<Device, Self::Error>
Read device info
fn list_devices(&self) -> Vec<WalletInfo>
List connected and acknowledged wallets
fn list_locked_devices(&self) -> Vec<String>
List locked wallets This may be moved if it is the wrong assumption, for example this is not supported by Ledger Then this method return a empty vector
fn get_wallet(&self, address: &Address) -> Option<WalletInfo>
Get wallet info.
fn get_address(
&self,
device: &HidDevice
) -> Result<Option<Address>, Self::Error>
&self,
device: &HidDevice
) -> Result<Option<Address>, Self::Error>
Generate ethereum address for a Wallet
fn open_path<R, F>(&self, f: F) -> Result<R, Self::Error> where
F: Fn() -> Result<R, &'static str>,
F: Fn() -> Result<R, &'static str>,
Open a device using device path
Note, f - is a closure that borrows HidResultc_void function pointer
For further information see:
* https://github.com/paritytech/hidapi-rs
* https://github.com/rust-lang/libc