feat: enhance hardware wallet compatibility and improve transaction handling (#3517)

* feat: enhance hardware wallet compatibility and improve transaction handling

- Updated hardware wallet services for Bitcoin and Litecoin (Ledger & Trezor).
- Added `LitecoinTrezorService` for signing and managing Litecoin transactions.
- Improved `PSBTTransaction` builder to handle change outputs and derivation paths.
- Fixed exception handling in `wallet_hardware_restore_view_model`.
- Refactored output and input structures to ensure consistency and extend compatibility.

* refactor: address comments

* refactor: address comments

* refactor: address comments
This commit is contained in:
Konstantin Ullrich
2026-09-01 19:42:33 +08:00
committed by GitHub
parent df87bab836
commit 0d353a0932
17 changed files with 521 additions and 305 deletions
+3 -1
View File
@@ -127,6 +127,7 @@ import 'package:hive/hive.dart';
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
import 'package:bitbox_flutter/bitbox_flutter.dart' as bitbox;
import 'package:trezor_connect/trezor_connect.dart' as trezor;
import 'package:trezor_flutter/trezor_flutter.dart' as trezor;
import 'package:blockchain_utils/blockchain_utils.dart';
import 'package:bip39/bip39.dart' as bip39;
import 'package:collection/collection.dart';
@@ -156,6 +157,7 @@ import 'package:cw_bitcoin/litecoin_wallet.dart';
import 'package:cw_bitcoin/hardware/bitcoin_ledger_service.dart';
import 'package:cw_bitcoin/hardware/litecoin_ledger_service.dart';
import 'package:cw_bitcoin/hardware/bitbox_service.dart';
import 'package:cw_bitcoin/hardware/litecoin_trezor_service.dart';
import 'package:cw_bitcoin/hardware/trezor_service.dart';
import 'package:mobx/mobx.dart';
import "package:breez_sdk_spark_flutter/src/rust/errors.dart";
@@ -275,7 +277,7 @@ abstract class Bitcoin {
Future<void> setHardwareWalletService(WalletBase wallet, HardwareWalletService service);
HardwareWalletService getLedgerHardwareWalletService(ledger.LedgerConnection connection, bool isBitcoin);
HardwareWalletService getBitboxHardwareWalletService(bitbox.BitboxManager manager, bool isBitcoin);
HardwareWalletService getTrezorHardwareWalletService(trezor.TrezorConnect connect, bool isBitcoin);
HardwareWalletService getTrezorHardwareWalletService(trezor.TrezorConnect? connect, trezor.TrezorClient? client, bool isBitcoin);
List<Output> updateOutputs(PendingTransaction pendingTransaction, List<Output> outputs);
bool txIsReceivedSilentPayment(TransactionInfo txInfo);
bool txIsMweb(TransactionInfo txInfo);