mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +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
35 lines
1 KiB
Dart
35 lines
1 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:cw_core/hardware/hardware_account_data.dart';
|
|
import 'package:ledger_ethereum/ledger_ethereum.dart';
|
|
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
|
|
|
|
class EVMChainHardwareWalletService {
|
|
EVMChainHardwareWalletService(this.ledgerConnection);
|
|
|
|
final LedgerConnection ledgerConnection;
|
|
|
|
Future<List<HardwareAccountData>> getAvailableAccounts(
|
|
{int index = 0, int limit = 5}) async {
|
|
final ethereumLedgerApp = EthereumLedgerApp(ledgerConnection);
|
|
|
|
await ethereumLedgerApp.getVersion();
|
|
|
|
final accounts = <HardwareAccountData>[];
|
|
final indexRange = List.generate(limit, (i) => i + index);
|
|
|
|
for (final i in indexRange) {
|
|
final derivationPath = "m/44'/60'/$i'/0/0";
|
|
final address = await ethereumLedgerApp.getAccounts(
|
|
accountsDerivationPath: derivationPath);
|
|
|
|
accounts.add(HardwareAccountData(
|
|
address: address.first,
|
|
accountIndex: i,
|
|
derivationPath: derivationPath,
|
|
));
|
|
}
|
|
|
|
return accounts;
|
|
}
|
|
}
|