mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
68926c0a33
Some checks are pending
Cache Dependencies / test (push) Waiting to run
* Add Litecoin Hardware Wallet Creation * Add Litecoin Hardware Wallet Creation * Fix Bitcoin not sending on Ledger * Fixes to sending LTC using Ledger * CW-679 Fix merge conflicts * CW-679 Fix merge conflicts * CW-679 Minor fixes * CW-679 Add derivation Path of change address * ledger flutter plus refactoring * ledger flutter plus refactoring * ledger flutter plus refactoring * Ups :| * Ups :| I forgot USB * Handle BT Off * Fix Issue with A14 and USB * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Pls work * Pls work * Pls work * Pls work * Fix overpopulation * Fix ble device detection and support for Stax and Flex * clean up pubspec * clean up * MWeb merge fix * MWeb merge fix * Fix Merge conflicts * Fix Requested changes
65 lines
1.8 KiB
Dart
65 lines
1.8 KiB
Dart
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
|
|
|
|
class HardwareWalletDevice {
|
|
final String name;
|
|
final HardwareWalletDeviceType type;
|
|
final HardwareWalletConnectionType connectionType;
|
|
|
|
const HardwareWalletDevice({
|
|
required this.name,
|
|
required this.type,
|
|
required this.connectionType,
|
|
});
|
|
|
|
factory HardwareWalletDevice.fromLedgerDevice(ledger.LedgerDevice device) =>
|
|
HardwareWalletDevice(
|
|
name: device.name,
|
|
type: device.deviceInfo.toGeneric(),
|
|
connectionType: device.connectionType.toGeneric(),
|
|
);
|
|
}
|
|
|
|
enum HardwareWalletDeviceType {
|
|
ledgerBlue,
|
|
ledgerNanoS,
|
|
ledgerNanoX,
|
|
ledgerNanoSPlus,
|
|
ledgerStax,
|
|
ledgerFlex;
|
|
}
|
|
|
|
enum HardwareWalletConnectionType {
|
|
usb,
|
|
ble,
|
|
nfc;
|
|
}
|
|
|
|
extension ToGenericHardwareWalletDeviceType on ledger.LedgerDeviceType {
|
|
HardwareWalletDeviceType toGeneric() {
|
|
switch (this) {
|
|
case ledger.LedgerDeviceType.blue:
|
|
return HardwareWalletDeviceType.ledgerBlue;
|
|
case ledger.LedgerDeviceType.nanoS:
|
|
return HardwareWalletDeviceType.ledgerNanoS;
|
|
case ledger.LedgerDeviceType.nanoSP:
|
|
return HardwareWalletDeviceType.ledgerNanoSPlus;
|
|
case ledger.LedgerDeviceType.nanoX:
|
|
return HardwareWalletDeviceType.ledgerNanoX;
|
|
case ledger.LedgerDeviceType.stax:
|
|
return HardwareWalletDeviceType.ledgerStax;
|
|
case ledger.LedgerDeviceType.flex:
|
|
return HardwareWalletDeviceType.ledgerFlex;
|
|
}
|
|
}
|
|
}
|
|
|
|
extension ToGenericHardwareWalletConnectionType on ledger.ConnectionType {
|
|
HardwareWalletConnectionType toGeneric() {
|
|
switch (this) {
|
|
case ledger.ConnectionType.usb:
|
|
return HardwareWalletConnectionType.usb;
|
|
case ledger.ConnectionType.ble:
|
|
return HardwareWalletConnectionType.ble;
|
|
}
|
|
}
|
|
}
|