mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
* feat: add support for Trezor hardware wallet integration Restore Wallets * feat: add Trezor hardware wallet support, implement RLP decoding utility, and update transaction signing logic * feat: add bitcoin trezor signing * chore: update Trezor Connect dependency to specific commit hash in pubspec_base.yaml * feat: add trezor support for litecoin * feat: add colorFilter for device manufacturer icons to align with theme styles * refactor: optimize Trezor callback handling * feat: add BitBox and Trezor support for Bitcoin and Litecoin, update transaction signing logic, and improve modularity in hardware wallet services * refactor: simplify constructor assertions in `BaseBottomSheetWidget` and cleanup Trezor chainId handling logic * feat: conditionally render device manufacturers based on platform and hide SeedSigner for now
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:cw_core/hardware/hardware_account_data.dart';
|
|
import 'package:cw_core/hardware/hardware_wallet_service.dart';
|
|
import 'package:trezor_connect/trezor_connect.dart';
|
|
|
|
class EVMChainTrezorService extends HardwareWalletService {
|
|
EVMChainTrezorService(this.connect, {this.chainId = 1});
|
|
|
|
final TrezorConnect connect;
|
|
final int chainId;
|
|
|
|
@override
|
|
Future<List<HardwareAccountData>> getAvailableAccounts({int index = 0, int limit = 5}) async {
|
|
final indexRange = List.generate(limit, (i) => i + index);
|
|
|
|
final requestParams = <TrezorGetAddressParams>[];
|
|
for (final i in indexRange) {
|
|
final derivationPath = "m/44'/60'/$i'/0/0";
|
|
requestParams.add(TrezorGetAddressParams(path: derivationPath));
|
|
}
|
|
final accounts = await connect.ethereumGetAddressBundle(requestParams);
|
|
|
|
return accounts
|
|
?.map((account) => HardwareAccountData(
|
|
address: account.address,
|
|
accountIndex: account.path[2] - 0x80000000, // unharden the path to get the index
|
|
derivationPath: account.serializedPath,
|
|
))
|
|
.toList() ??
|
|
[];
|
|
}
|
|
}
|