mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix: custom Bitcoin Ledger derivation paths and update ledger-bitcoin dependency (#2798)
* fix: custom Bitcoin Ledger derivation paths and update ledger-bitcoin dependency * fix: remove unused `derivationPath` in `signTransaction` method
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:cw_bitcoin/electrum_derivations.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/hardware/bitcoin_ledger_service.dart';
|
||||
import 'package:cw_bitcoin/payjoin/manager.dart';
|
||||
import 'package:cw_bitcoin/payjoin/storage.dart';
|
||||
import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
|
||||
@@ -31,9 +32,7 @@ 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:ledger_bitcoin/ledger_bitcoin.dart';
|
||||
import 'package:ledger_bitcoin/psbt.dart';
|
||||
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:ur/cbor_lite.dart';
|
||||
import 'package:ur/ur.dart';
|
||||
@@ -356,6 +355,11 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
||||
);
|
||||
|
||||
final psbtStr = base64Encode(psbt.serialize());
|
||||
if (hardwareWalletService is BitcoinLedgerService && derivationInfo.derivationPath != null) {
|
||||
(hardwareWalletService as BitcoinLedgerService)
|
||||
.setAccountDerivationPath(derivationInfo.derivationPath!);
|
||||
}
|
||||
|
||||
final rawHex = await hardwareWalletService!.signTransaction(transaction: psbtStr);
|
||||
return BtcTransaction.fromRaw(BytesUtils.toHexString(rawHex));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ class BitcoinLedgerService extends HardwareWalletService with BitcoinHardwareWal
|
||||
final LedgerConnection ledgerConnection;
|
||||
final BitcoinLedgerApp bitcoinLedgerApp;
|
||||
|
||||
void setAccountDerivationPath(String derivationPath) {
|
||||
bitcoinLedgerApp.derivationPath = derivationPath;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<HardwareAccountData>> getAvailableAccounts({int index = 0, int limit = 5}) async {
|
||||
final masterFp = await bitcoinLedgerApp.getMasterFingerprint();
|
||||
|
||||
@@ -49,7 +49,7 @@ dependencies:
|
||||
git:
|
||||
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
|
||||
path: packages/ledger-bitcoin
|
||||
ref: dc42621f55702d0732681afc2f90bc0047f26633
|
||||
ref: 75bba8632c529debf30ee2b1858530009fa6440b
|
||||
ledger_litecoin:
|
||||
git:
|
||||
url: https://github.com/cake-tech/ledger-flutter-plus-plugins
|
||||
|
||||
Reference in New Issue
Block a user