Add Bitcoin Cash Ledger wallet support (#3847)
What changed, and why it matters
This commit adds support for using Ledger hardware wallets with Bitcoin Cash in Cake Wallet, and also enables message signing for Litecoin and Bitcoin Cash on Ledger devices. It is a feature addition, not a security fix. There is no indication in the commit or supplied references that this change addresses a vulnerability or security incident.
No security action required; review as normal feature code. If auditing, verify that hardware-derived xpubs are validated, derivation paths are constrained, and Ledger transaction signing correctly enforces user confirmation on device.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces Bitcoin Cash Ledger hardware wallet integration: new service classes (BitcoinCashLedgerService, BitcoinCashHardwareWalletService), updates wallet creation/restoration paths to accept hardware credentials and xpub, wires the wallet type into Ledger view models, and adds Ledger message signing for Litecoin and Bitcoin Cash. It also updates git dependency refs for ledger-flutter-plus-plugins and removes pinned refs in package pubspecs in favor of pubspec_overrides. No vulnerability remediation is described.
Changed components
cw_bitcoin_cash Bitcoin Cash walletcw_bitcoin Litecoin Ledger serviceLedger hardware wallet integration layerpubspec dependency references for ledger-flutter-plus-pluginsInspect captured patch +313 / −61
### cw_bitcoin/lib/electrum_wallet.dart
@@ -150,6 +150,10 @@ abstract class ElectrumWalletBase
/// For LEGACY addresses, returns the wallet's legacy derivation base (derivationInfo.derivationPath)
/// which is already the account path used historically (e.g. m/0' or m/84'/0'/0').
String _accountDerivationPathForRecord(BaseBitcoinAddressRecord record) {
+ if (isHardwareWallet && (derivationInfo.derivationPath?.isNotEmpty ?? false)) {
+ return derivationInfo.derivationPath!;
+ }
+
if (derivationInfo.derivationType == DerivationType.electrum) {
return derivationInfo.derivationPath ?? electrum_path; // m/0'
}
@@ -5326,4 +5330,4 @@ class AddressHistoryResult {
final List<Map<String, dynamic>> missingHistoryItems;
final bool hasHistory;
final bool hadFailures;
-}
\ No newline at end of file
+}
### cw_bitcoin/lib/hardware/litecoin_ledger_service.dart
@@ -96,4 +96,8 @@ class LitecoinLedgerService extends HardwareWalletService
useTrustedInputForSegwit: true,
);
}
+
+ @override
+ Future<Uint8List> signMessage({required Uint8List message, String? derivationPath}) =>
+ litecoinLedgerApp.signMessage(message: message, signDerivationPath: derivationPath);
}
### cw_bitcoin/lib/litecoin_wallet.dart
@@ -1433,11 +1433,25 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
@override
- Future<String> signMessage(String message, {String? address = null}) async {
- final index = address != null
- ? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
+ Future<String> signMessage(String message, {String? address}) async {
+ final addressEntry = address != null
+ ? walletAddresses.allAddresses.firstWhere((element) => element.address == address)
: null;
- final HD = index == null ? mainHd : mainHd.childKey(Bip32KeyIndex(index));
+
+ if (walletInfo.isHardwareWallet) {
+ final index = addressEntry?.index ?? 0;
+ final isChange = addressEntry?.isHidden == true ? 1 : 0;
+ final derivationInfo = await walletInfo.getDerivationInfo();
+ final accountPath = derivationInfo.derivationPath;
+ final derivationPath = accountPath != null ? "$accountPath/$isChange/$index" : null;
+
+ final signature = await hardwareWalletService!
+ .signMessage(message: ascii.encode(message), derivationPath: derivationPath);
+
+ return base64Encode(signature);
+ }
+
+ final HD = addressEntry == null ? mainHd : mainHd.childKey(Bip32KeyIndex(addressEntry.index));
final priv = ECPrivate.fromHex(HD.privateKey.privKey.toHex());
final privateKey = ECDSAPrivateKey.fromBytes(
### cw_bitcoin/pubspec.yaml
@@ -40,7 +40,6 @@ dependencies:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
path: packages/ledger-bitcoin
- ref: 75bba8632c529debf30ee2b1858530009fa6440b
ledger_litecoin:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
### cw_bitcoin_cash/lib/src/bitcoin_cash_base.dart
@@ -4,3 +4,5 @@ export 'bitcoin_cash_wallet_creation_credentials.dart';
export 'bitcoin_cash_wallet_service.dart';
export 'exceptions/exceptions.dart';
export 'bitcoin_cash_address_utils.dart';
+export 'hardware/bitcoin_cash_hardware_wallet_service.dart';
+export 'hardware/bitcoin_cash_ledger_service.dart';
### cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart
@@ -1,56 +1,64 @@
-import 'package:bitbox/bitbox.dart' as bitbox;
-import 'package:bitcoin_base/bitcoin_base.dart';
-import 'package:blockchain_utils/blockchain_utils.dart';
-import 'package:cw_bitcoin/bitcoin_address_record.dart';
-import 'package:cw_bitcoin/bitcoin_mnemonics_bip39.dart';
-import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
-import 'package:cw_bitcoin/electrum_balance.dart';
-import 'package:cw_bitcoin/electrum_wallet.dart';
-import 'package:cw_bitcoin/electrum_wallet_snapshot.dart';
-import 'package:cw_core/crypto_currency.dart';
-import 'package:cw_core/encryption_file_utils.dart';
-import 'package:cw_core/transaction_priority.dart';
-import 'package:cw_core/unspent_coins_info.dart';
-import 'package:cw_core/wallet_info.dart';
-import 'package:cw_core/wallet_keys_file.dart';
-import 'package:flutter/foundation.dart';
-import 'package:hive/hive.dart';
-import 'package:mobx/mobx.dart';
-
-import 'bitcoin_cash_base.dart';
-
-part 'bitcoin_cash_wallet.g.dart';
+import "dart:convert";
+
+import "package:bitbox/bitbox.dart" as bitbox;
+import "package:bitcoin_base/bitcoin_base.dart";
+import "package:blockchain_utils/blockchain_utils.dart";
+import "package:cw_bitcoin/bitcoin_address_record.dart";
+import "package:cw_bitcoin/bitcoin_mnemonics_bip39.dart";
+import "package:cw_bitcoin/bitcoin_transaction_priority.dart";
+import "package:cw_bitcoin/electrum_balance.dart";
+import "package:cw_bitcoin/electrum_wallet.dart";
+import "package:cw_bitcoin/electrum_wallet_snapshot.dart";
+import "package:cw_bitcoin/hardware/bitcoin_hardware_wallet_service.dart";
+import "package:cw_bitcoin/output_ordering.dart";
+import "package:cw_bitcoin/psbt/transaction_builder.dart";
+import "package:cw_bitcoin_cash/src/bitcoin_cash_base.dart";
+import "package:cw_core/crypto_currency.dart";
+import "package:cw_core/encryption_file_utils.dart";
+import "package:cw_core/output_info.dart";
+import "package:cw_core/transaction_priority.dart";
+import "package:cw_core/unspent_coins_info.dart";
+import "package:cw_core/wallet_info.dart";
+import "package:cw_core/wallet_keys_file.dart";
+import "package:flutter/foundation.dart";
+import "package:hive/hive.dart";
+import "package:mobx/mobx.dart";
+
+part "bitcoin_cash_wallet.g.dart";
class BitcoinCashWallet = BitcoinCashWalletBase with _$BitcoinCashWallet;
abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
BitcoinCashWalletBase({
- required String mnemonic,
required String password,
required WalletInfo walletInfo,
required DerivationInfo derivationInfo,
required Box<UnspentCoinsInfo> unspentCoinsInfo,
- required Uint8List seedBytes,
required EncryptionFileUtils encryptionFileUtils,
+ String? mnemonic,
+ Uint8List? seedBytes,
+ String? xpub,
String? passphrase,
BitcoinAddressType? addressPageType,
List<BitcoinAddressRecord>? initialAddresses,
ElectrumBalance? initialBalance,
Map<String, int>? initialRegularAddressIndex,
Map<String, int>? initialChangeAddressIndex,
}) : super(
- mnemonic: mnemonic,
- password: password,
- walletInfo: walletInfo,
- derivationInfo: derivationInfo,
- unspentCoinsInfo: unspentCoinsInfo,
- network: BitcoinCashNetwork.mainnet,
- initialAddresses: initialAddresses,
- initialBalance: initialBalance,
- seedBytes: seedBytes,
- currency: CryptoCurrency.bch,
- encryptionFileUtils: encryptionFileUtils,
- passphrase: passphrase) {
+ mnemonic: mnemonic,
+ xpub: xpub,
+ password: password,
+ walletInfo: walletInfo,
+ derivationInfo: derivationInfo,
+ unspentCoinsInfo: unspentCoinsInfo,
+ network: BitcoinCashNetwork.mainnet,
+ initialAddresses: initialAddresses,
+ initialBalance: initialBalance,
+ seedBytes: seedBytes,
+ currency: CryptoCurrency.bch,
+ encryptionFileUtils: encryptionFileUtils,
+ passphrase: passphrase,
+ ) {
walletAddresses = BitcoinCashWalletAddresses(
walletInfo,
initialAddresses: initialAddresses,
@@ -67,7 +75,7 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
isHardwareWallet: walletInfo.isHardwareWallet,
);
autorun((_) {
- this.walletAddresses.isEnabledAutoGenerateSubaddress = this.isEnabledAutoGenerateSubaddress;
+ walletAddresses.isEnabledAutoGenerateSubaddress = isEnabledAutoGenerateSubaddress;
});
}
@@ -138,7 +146,8 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
}
return BitcoinCashWallet(
- mnemonic: keysData.mnemonic!,
+ mnemonic: keysData.mnemonic,
+ xpub: keysData.xPub,
password: password,
walletInfo: walletInfo,
derivationInfo: await walletInfo.getDerivationInfo(),
@@ -168,7 +177,9 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
}
}).toList(),
initialBalance: snp?.balance,
- seedBytes: await MnemonicBip39.toSeed(keysData.mnemonic!, passphrase: keysData.passphrase),
+ seedBytes: keysData.mnemonic == null
+ ? null
+ : MnemonicBip39.toSeed(keysData.mnemonic!, passphrase: keysData.passphrase),
encryptionFileUtils: encryptionFileUtils,
initialRegularAddressIndex: snp?.regularAddressIndex,
initialChangeAddressIndex: snp?.changeAddressIndex,
@@ -182,6 +193,7 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
Uint8List.fromList(hd.childKey(Bip32KeyIndex(index)).privateKey.raw),
);
+ @override
int calculateEstimatedFeeWithFeeRate(int feeRate, int? amount, {int? outputsCount, int? size}) {
int inputsCount = 0;
int totalValue = 0;
@@ -220,18 +232,88 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
}
@override
- Future<String> signMessage(String message, {String? address = null}) async {
- int? index;
- try {
- index = address != null
- ? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
- : null;
- } catch (_) {}
- final HD = index == null ? mainHd : mainHd.childKey(Bip32KeyIndex(index));
+ Future<String> signMessage(String message, {String? address}) async {
+ final addressEntry = address != null
+ ? walletAddresses.allAddresses.firstWhere((element) => element.address == address, orElse: () => null)
+ : null;
+
+ if (walletInfo.isHardwareWallet) {
+ final index = addressEntry?.index ?? 0;
+ final isChange = addressEntry?.isHidden == true ? 1 : 0;
+ final derivationInfo = await walletInfo.getDerivationInfo();
+ final accountPath = derivationInfo.derivationPath;
+ final derivationPath = accountPath != null ? "$accountPath/$isChange/$index" : null;
+
+ final signature = await hardwareWalletService!
+ .signMessage(message: ascii.encode(message), derivationPath: derivationPath);
+
+ return base64Encode(signature);
+ }
+
+ final HD = addressEntry == null ? mainHd : mainHd.childKey(Bip32KeyIndex(addressEntry.index));
final priv = ECPrivate.fromWif(
WifEncoder.encode(HD.privateKey.raw, netVer: network.wifNetVer),
netVersion: network.wifNetVer,
);
return priv.signMessage(StringUtils.encode(message));
}
+
+ @override
+ Future<BtcTransaction> buildHardwareWalletTransaction({
+ required List<BitcoinOutput> outputs,
+ required BigInt fee,
+ required BasedUtxoNetwork network,
+ required List<UtxoWithAddress> utxos,
+ required List<OutputInfo> cwOutputs,
+ required Map<String, PublicKeyWithDerivationPath> publicKeys,
+ String? memo,
+ bool enableRBF = false,
+ BitcoinOrdering inputOrdering = BitcoinOrdering.bip69,
+ BitcoinOrdering outputOrdering = BitcoinOrdering.bip69,
+ }) async {
+ final masterFingerprint =
+ await (hardwareWalletService! as BitcoinHardwareWalletService).getMasterFingerprint();
+
+ final readyInputs = <PSBTReadyUtxoWithAddress>[];
+ for (final utxo in utxos) {
+ final rawTx = await electrumClient.getTransactionHex(hash: utxo.utxo.txHash);
+ final publicKeyAndDerivationPath = publicKeys[utxo.ownerDetails.address.pubKeyHash()]!;
+
+ readyInputs.add(
+ PSBTReadyUtxoWithAddress(
+ utxo: utxo.utxo,
+ rawTx: rawTx,
+ ownerDetails: utxo.ownerDetails,
+ ownerDerivationPath: publicKeyAndDerivationPath.derivationPath,
+ ownerMasterFingerprint: masterFingerprint,
+ ownerPublicKey: publicKeyAndDerivationPath.publicKey,
+ ),
+ );
+ }
+
+ final orderedOutputs = orderOutputs(outputs, outputOrdering).map((o) {
+ if (o.isChange && publicKeys.containsKey(o.address.pubKeyHash())) {
+ final changeKey = publicKeys[o.address.pubKeyHash()]!;
+ return PSBTReadyBitcoinOutput(
+ address: o.address,
+ value: o.value,
+ isSilentPayment: o.isSilentPayment,
+ isChange: o.isChange,
+ changeMasterFingerprint: masterFingerprint,
+ changeDerivationPath: changeKey.derivationPath,
+ changePublicKey: changeKey.publicKey,
+ );
+ }
+ return PSBTReadyBitcoinOutput.fromOutput(o);
+ });
+
+ final rawHex = await (hardwareWalletService! as BitcoinCashHardwareWalletService)
+ .signBitcoinCashTransaction(
+ outputs: orderedOutputs.toList(),
+ inputs: readyInputs,
+ publicKeys: publicKeys,
+ );
+
+ return BtcTransaction.fromRaw(rawHex);
+ }
}
### cw_bitcoin_cash/lib/src/bitcoin_cash_wallet_service.dart
@@ -1,6 +1,8 @@
import 'dart:io';
import 'package:bip39/bip39.dart';
+import 'package:bitcoin_base/bitcoin_base.dart';
+import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart';
import 'package:cw_bitcoin/bitcoin_mnemonics_bip39.dart';
import 'package:cw_bitcoin_cash/cw_bitcoin_cash.dart';
import 'package:cw_core/encryption_file_utils.dart';
@@ -16,7 +18,7 @@ class BitcoinCashWalletService extends WalletService<
BitcoinCashNewWalletCredentials,
BitcoinCashRestoreWalletFromSeedCredentials,
BitcoinCashRestoreWalletFromWIFCredentials,
- BitcoinCashNewWalletCredentials> {
+ BitcoinRestoreWalletFromHardware> {
BitcoinCashWalletService(this.unspentCoinsInfoSource, this.isDirect);
final Box<UnspentCoinsInfo> unspentCoinsInfoSource;
@@ -100,9 +102,26 @@ class BitcoinCashWalletService extends WalletService<
}
@override
- Future<BitcoinCashWallet> restoreFromHardwareWallet(BitcoinCashNewWalletCredentials credentials) {
- throw UnimplementedError(
- "Restoring a Bitcoin Cash wallet from a hardware wallet is not yet supported!");
+ Future<BitcoinCashWallet> restoreFromHardwareWallet(
+ BitcoinRestoreWalletFromHardware credentials,
+ ) async {
+ final derivationInfo = await credentials.walletInfo!.getDerivationInfo();
+ derivationInfo.derivationPath = credentials.hwAccountData.derivationPath;
+ await derivationInfo.save();
+ await credentials.walletInfo!.save();
+
+ final wallet = BitcoinCashWallet(
+ password: credentials.password!,
+ xpub: credentials.hwAccountData.xpub,
+ walletInfo: credentials.walletInfo!,
+ derivationInfo: derivationInfo,
+ unspentCoinsInfo: unspentCoinsInfoSource,
+ encryptionFileUtils: encryptionFileUtilsFor(isDirect),
+ addressPageType: P2pkhAddressType.p2pkh,
+ );
+ await wallet.save();
+ await wallet.init();
+ return wallet;
}
@override
### cw_bitcoin_cash/lib/src/hardware/bitcoin_cash_hardware_wallet_service.dart
@@ -0,0 +1,11 @@
+import "package:cw_bitcoin/electrum_wallet.dart";
+import "package:cw_bitcoin/hardware/bitcoin_hardware_wallet_service.dart";
+import "package:cw_bitcoin/psbt/transaction_builder.dart";
+
+mixin BitcoinCashHardwareWalletService on BitcoinHardwareWalletService {
+ Future<String> signBitcoinCashTransaction({
+ required List<PSBTReadyBitcoinOutput> outputs,
+ required List<PSBTReadyUtxoWithAddress> inputs,
+ required Map<String, PublicKeyWithDerivationPath> publicKeys,
+ });
+}
### cw_bitcoin_cash/lib/src/hardware/bitcoin_cash_ledger_service.dart
@@ -0,0 +1,99 @@
+import "dart:async";
+import "dart:typed_data";
+
+import "package:bitcoin_base/bitcoin_base.dart";
+import "package:blockchain_utils/blockchain_utils.dart";
+import "package:cw_bitcoin/electrum_wallet.dart";
+import "package:cw_bitcoin/hardware/bitcoin_hardware_wallet_service.dart";
+import "package:cw_bitcoin/psbt/transaction_builder.dart";
+import "package:cw_bitcoin/utils.dart";
+import "package:cw_bitcoin_cash/src/hardware/bitcoin_cash_hardware_wallet_service.dart";
+import "package:cw_core/hardware/hardware_account_data.dart";
+import "package:cw_core/hardware/hardware_wallet_service.dart";
+import "package:ledger_flutter_plus/ledger_flutter_plus.dart";
+import "package:ledger_litecoin/ledger_litecoin.dart";
+
+class BitcoinCashLedgerService extends HardwareWalletService
+ with BitcoinHardwareWalletService, BitcoinCashHardwareWalletService {
+ BitcoinCashLedgerService(this.ledgerConnection)
+ : bitcoinCashLedgerApp = LitecoinLedgerApp(ledgerConnection);
+
+ final LedgerConnection ledgerConnection;
+ final LitecoinLedgerApp bitcoinCashLedgerApp;
+
+ @override
+ Future<List<HardwareAccountData>> getAvailableAccounts({int index = 0, int limit = 5}) async {
+ await bitcoinCashLedgerApp.getVersion();
+
+ final accounts = <HardwareAccountData>[];
+ final indexRange = List.generate(limit, (i) => i + index);
+
+ for (final i in indexRange) {
+ final derivationPath = "m/44'/145'/$i'";
+ final xpub = await bitcoinCashLedgerApp.getXPubKey(
+ accountsDerivationPath: derivationPath,
+ addressFormat: AddressFormat.cashaddr,
+ );
+ final hd = Bip32Slip10Secp256k1.fromExtendedKey(xpub).childKey(Bip32KeyIndex(0));
+
+ final address = generateP2PKHAddress(hd: hd, index: 0, network: BitcoinCashNetwork.mainnet);
+
+ accounts.add(
+ HardwareAccountData(
+ address: address,
+ accountIndex: i,
+ derivationPath: derivationPath,
+ xpub: xpub,
+ ),
+ );
+ }
+
+ return accounts;
+ }
+
+ @override
+ Future<String> signBitcoinCashTransaction({
+ required List<PSBTReadyBitcoinOutput> outputs,
+ required List<PSBTReadyUtxoWithAddress> inputs,
+ required Map<String, PublicKeyWithDerivationPath> publicKeys,
+ }) {
+ final readyInputs = <LedgerTransaction>[];
+ for (final utxo in inputs) {
+ final publicKeyAndDerivationPath = publicKeys[utxo.ownerDetails.address.pubKeyHash()]!;
+
+ readyInputs.add(
+ LedgerTransaction(
+ rawTx: utxo.rawTx,
+ outputIndex: utxo.utxo.vout,
+ ownerPublicKey: Uint8List.fromList(hex.decode(publicKeyAndDerivationPath.publicKey)),
+ ownerDerivationPath: publicKeyAndDerivationPath.derivationPath,
+ ),
+ );
+ }
+ String? changePath;
+ for (final output in outputs) {
+ if (output.isChange) {
+ changePath ??= output.changeDerivationPath;
+ }
+ }
+
+ return bitcoinCashLedgerApp.createTransaction(
+ inputs: readyInputs,
+ outputs: outputs
+ .map(
+ (e) => TransactionOutput.fromBigInt(
+ (e as BitcoinOutput).value,
+ Uint8List.fromList(e.address.toScriptPubKey().toBytes()),
+ ),
+ )
+ .toList(),
+ changePath: changePath,
+ sigHashType: 0x41,
+ additionals: ["bip143", "cashaddr"],
+ );
+ }
+
+ @override
+ Future<Uint8List> signMessage({required Uint8List message, String? derivationPath}) =>
+ bitcoinCashLedgerApp.signMessage(message: message, signDerivationPath: derivationPath);
+}
### cw_bitcoin_cash/pubspec.yaml
@@ -25,6 +25,11 @@ dependencies:
git:
url: https://github.com/cake-tech/blockchain_utils
ref: 59fdf29d72068e0522a96a8953ed7272833a9f57
+ ledger_flutter_plus: ^1.4.1
+ ledger_litecoin:
+ git:
+ url: https://github.com/cake-tech/ledger-flutter-plus-plugins
+ path: packages/ledger-litecoin
dev_dependencies:
flutter_test:
### cw_core/lib/hardware/device_connection_type.dart
@@ -25,6 +25,7 @@ enum DeviceConnectionType {
WalletType.monero,
WalletType.bitcoin,
WalletType.litecoin,
+ WalletType.bitcoinCash,
WalletType.ethereum,
WalletType.polygon,
WalletType.zcash,
### cw_evm/pubspec.yaml
@@ -25,7 +25,6 @@ dependencies:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
path: packages/ledger-ethereum
- ref: f4761cd5171d4c1e2e42fd3298261650539fb2db
bitbox_flutter:
git:
url: https://github.com/cake-tech/bitbox_flutter.git
### lib/bitcoin_cash/cw_bitcoin_cash.dart
@@ -48,4 +48,8 @@ class CWBitcoinCash extends BitcoinCash {
@override
TransactionPriority getBitcoinCashTransactionPrioritySlow() =>
BitcoinCashTransactionPriority.slow;
+
+ @override
+ HardwareWalletService getLedgerHardwareWalletService(ledger.LedgerConnection connection) =>
+ BitcoinCashLedgerService(connection);
}
### lib/view_model/hardware_wallet/ledger_view_model.dart
@@ -2,6 +2,7 @@ import "dart:async";
import "dart:io";
import "package:cake_wallet/bitcoin/bitcoin.dart";
+import "package:cake_wallet/bitcoin_cash/bitcoin_cash.dart";
import "package:cake_wallet/entities/hardware_wallet/hardware_wallet_device.dart";
import "package:cake_wallet/evm/evm.dart";
import "package:cake_wallet/generated/i18n.dart";
@@ -223,6 +224,7 @@ abstract class LedgerViewModelBase extends HardwareWalletViewModel with Store {
case WalletType.bitcoin:
return bitcoin!.setHardwareWalletService(wallet, getHardwareWalletService(wallet.type));
case WalletType.litecoin:
+ case WalletType.bitcoinCash:
return bitcoin!.setHardwareWalletService(wallet, getHardwareWalletService(wallet.type));
case WalletType.ethereum:
case WalletType.polygon:
@@ -243,6 +245,8 @@ abstract class LedgerViewModelBase extends HardwareWalletViewModel with Store {
return bitcoin!.getLedgerHardwareWalletService(connection, true);
case WalletType.litecoin:
return bitcoin!.getLedgerHardwareWalletService(connection, false);
+ case WalletType.bitcoinCash:
+ return bitcoinCash!.getLedgerHardwareWalletService(connection);
case WalletType.ethereum:
case WalletType.polygon:
return evm!.getLedgerHardwareWalletService(connection);
### lib/view_model/wallet_hardware_restore_view_model.dart
@@ -74,6 +74,7 @@ abstract class WalletHardwareRestoreViewModelBase extends WalletCreationVM with
switch (type) {
case WalletType.bitcoin:
case WalletType.litecoin:
+ case WalletType.bitcoinCash:
credentials = bitcoin!
.createBitcoinHardwareWalletCredentials(name: name, accountData: selectedAccount!);
break;
### pubspec_overrides.yaml
@@ -846,12 +846,12 @@ dependency_overrides:
ledger_bitcoin:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
- ref: 75bba8632c529debf30ee2b1858530009fa6440b
+ ref: bd86993c6c41085f9b2aa0b723f734bc4f6bf508
path: ./packages/ledger-bitcoin
ledger_ethereum:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
- ref: f4761cd5171d4c1e2e42fd3298261650539fb2db
+ ref: bd86993c6c41085f9b2aa0b723f734bc4f6bf508
path: ./packages/ledger-ethereum
ledger_flutter_plus:
git:
@@ -860,7 +860,7 @@ dependency_overrides:
ledger_litecoin:
git:
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
- ref: 75bba8632c529debf30ee2b1858530009fa6440b
+ ref: bd86993c6c41085f9b2aa0b723f734bc4f6bf508
path: ./packages/ledger-litecoin
ledger_usb_plus:
git:
### tool/configure.dart
@@ -732,7 +732,9 @@ import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_service.dart';
+import 'package:cw_core/hardware/hardware_wallet_service.dart';
import 'package:hive/hive.dart';
+import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
""";
const bitcoinCashCWHeaders = """
import 'package:cw_bitcoin_cash/cw_bitcoin_cash.dart';
@@ -759,6 +761,8 @@ abstract class BitcoinCash {
List<TransactionPriority> getTransactionPriorities();
TransactionPriority getBitcoinCashTransactionPrioritySlow();
+
+ HardwareWalletService getLedgerHardwareWalletService(ledger.LedgerConnection connection);
}
""";
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.