mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
* refactor: migrate hardware wallet resources to `new-ui`, add Trezor model support, and streamline hardware wallet handling across services * refactor: migrate hardware wallet resources to `new-ui`, add Trezor model support, and streamline hardware wallet handling across services * fix: correctly check for Ledger hardware wallet type in `isHardwareWallet` logic * refactor: unify `isConnected` method for hardware wallets, add Trezor-specific support, and update Monero sync logic * refactor: add Trezor transaction signing support, streamline hardware wallet handling, and update Monero dependency * refactor: improve Trezor transaction handling, adjust hardware wallet state logic, and update Monero dependency references * fix: non-hww tx commit() in xmr fix: prod monero_c fix: keyImage import workaround for Trezor/Cupcake chore: add kotlin's .salive to .gitignore * fix: universal_ble builds on iOS chore: remove prints fix: proper CI prebuilt for linux * new trezor connection ui * fix page title * typo * fix page title anim * refactor: enhance Trezor pairing flow, update state management, and simplify UI logic in hardware wallet integration * fix: correct widget indentation in Trezor pairing failure state UI * fix: extract Trezor pairing failure state UI to `_errorBox` widget and update Trezor dependency reference * refactor: simplify hardware wallet pairing error UI, optimize `_errorBox` layout, and streamline widget logic * Update cw_monero/lib/pending_monero_transaction.dart Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * Update lib/buy/robinhood/robinhood_buy_provider.dart Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * feat: add USB intent filters, device filter for hardware wallets, and update Trezor dependency reference * Update cw_monero/pubspec.yaml [skip ci] * Update cw_wownero/pubspec.yaml [skip ci] * Update cw_zano/pubspec.yaml [skip ci] * fix: use CryptoCurrency.title instead of amount-refactor-only .symbol getter new_wallet_type_page used curr.symbol, which only exists on the amount-refactor branch (String get symbol => title). On dev the equivalent is curr.title. Adapts the Trezor feature to dev's API without pulling in amount-refactor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Fix wallet list screen not scrollable minor fixes --------- Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com> Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net> Co-authored-by: Robert Malikowski <malikowskirobert@gmail.com> Co-authored-by: Konstantin Ullrich <konstantin@cakewallet.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
143 lines
3.9 KiB
Dart
143 lines
3.9 KiB
Dart
import 'package:bitbox_flutter/usb/bitbox_device.dart' as bitbox;
|
|
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
|
|
import 'package:trezor_flutter/trezor_flutter.dart' as trezor;
|
|
|
|
abstract class HardwareWalletDevice {
|
|
String get name;
|
|
|
|
HardwareWalletDeviceType get type;
|
|
|
|
HardwareWalletConnectionType get connectionType;
|
|
}
|
|
|
|
class LedgerHardwareWalletDevice extends HardwareWalletDevice {
|
|
final ledger.LedgerDevice device;
|
|
|
|
LedgerHardwareWalletDevice(this.device);
|
|
|
|
@override
|
|
String get name => device.name;
|
|
|
|
@override
|
|
HardwareWalletDeviceType get type => device.deviceInfo.toGeneric();
|
|
|
|
@override
|
|
HardwareWalletConnectionType get connectionType => device.connectionType.toGeneric();
|
|
}
|
|
|
|
class BitboxHardwareWalletDevice extends HardwareWalletDevice {
|
|
final bitbox.BitboxDevice device;
|
|
|
|
BitboxHardwareWalletDevice(this.device);
|
|
|
|
@override
|
|
String get name => device.productName;
|
|
|
|
@override
|
|
HardwareWalletDeviceType get type => name.contains("BitBox02 Nova")
|
|
? HardwareWalletDeviceType.BitBox02Nova
|
|
: HardwareWalletDeviceType.BitBox02;
|
|
|
|
@override
|
|
HardwareWalletConnectionType get connectionType => HardwareWalletConnectionType.usb;
|
|
}
|
|
|
|
class TrezorHardwareWalletDevice extends HardwareWalletDevice {
|
|
final trezor.TrezorDevice device;
|
|
|
|
TrezorHardwareWalletDevice(this.device);
|
|
|
|
@override
|
|
String get name => device.name;
|
|
|
|
@override
|
|
HardwareWalletDeviceType get type => device.deviceInfo.toGeneric();
|
|
|
|
@override
|
|
HardwareWalletConnectionType get connectionType => device.connectionType.toGeneric();
|
|
}
|
|
|
|
enum HardwareWalletDeviceType {
|
|
ledgerBlue,
|
|
ledgerNanoS,
|
|
ledgerNanoX,
|
|
ledgerNanoSPlus,
|
|
ledgerNanoGen5,
|
|
ledgerStax,
|
|
ledgerFlex,
|
|
BitBox02,
|
|
BitBox02Nova,
|
|
trezorModelOne,
|
|
trezorModelT,
|
|
trezorSafe3,
|
|
trezorSafe5,
|
|
trezorSafe7;
|
|
}
|
|
|
|
enum HardwareWalletConnectionType {
|
|
usb,
|
|
ble,
|
|
nfc,
|
|
qr;
|
|
}
|
|
|
|
extension LedgerToGenericHardwareWalletDeviceType 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.nanoGen5:
|
|
return HardwareWalletDeviceType.ledgerNanoGen5;
|
|
case ledger.LedgerDeviceType.stax:
|
|
return HardwareWalletDeviceType.ledgerStax;
|
|
case ledger.LedgerDeviceType.flex:
|
|
return HardwareWalletDeviceType.ledgerFlex;
|
|
}
|
|
}
|
|
}
|
|
|
|
extension TrezorToGenericHardwareWalletDeviceType on trezor.TrezorDeviceType {
|
|
HardwareWalletDeviceType toGeneric() {
|
|
switch (this) {
|
|
case trezor.TrezorDeviceType.modelOne:
|
|
return HardwareWalletDeviceType.trezorModelOne;
|
|
case trezor.TrezorDeviceType.modelT:
|
|
return HardwareWalletDeviceType.trezorModelT;
|
|
case trezor.TrezorDeviceType.safe3:
|
|
return HardwareWalletDeviceType.trezorSafe3;
|
|
case trezor.TrezorDeviceType.safe5:
|
|
return HardwareWalletDeviceType.trezorSafe5;
|
|
case trezor.TrezorDeviceType.safe7:
|
|
return HardwareWalletDeviceType.trezorSafe7;
|
|
}
|
|
}
|
|
}
|
|
|
|
extension LedgerToGenericHardwareWalletConnectionType on ledger.ConnectionType {
|
|
HardwareWalletConnectionType toGeneric() {
|
|
switch (this) {
|
|
case ledger.ConnectionType.usb:
|
|
return HardwareWalletConnectionType.usb;
|
|
case ledger.ConnectionType.ble:
|
|
return HardwareWalletConnectionType.ble;
|
|
}
|
|
}
|
|
}
|
|
|
|
extension TrezorToGenericHardwareWalletConnectionType on trezor.ConnectionType {
|
|
HardwareWalletConnectionType toGeneric() {
|
|
switch (this) {
|
|
case trezor.ConnectionType.usb:
|
|
return HardwareWalletConnectionType.usb;
|
|
case trezor.ConnectionType.ble:
|
|
return HardwareWalletConnectionType.ble;
|
|
}
|
|
}
|
|
}
|