mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
sp improv (#2437)
* fix(sp): proper address on details screen * fix(sp): fields to update on incoming msg * Update lib/bitcoin/cw_bitcoin.dart --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -802,7 +802,7 @@ class CWBitcoin extends Bitcoin {
|
||||
}
|
||||
|
||||
@override
|
||||
String? getTransactionAddress(Object wallet, TransactionInfo tx) {
|
||||
List<String>? getTransactionAddresses(Object wallet, TransactionInfo tx) {
|
||||
final bitcoinWallet = wallet as BitcoinWallet;
|
||||
final bitcoinTx = tx as ElectrumTransactionInfo;
|
||||
|
||||
@@ -810,10 +810,16 @@ class CWBitcoin extends Bitcoin {
|
||||
return null;
|
||||
}
|
||||
|
||||
// final bitcoinSPAddrs =
|
||||
// bitcoinTx.unspents!.first.bitcoinAddressRecord as BitcoinSilentPaymentAddressRecord;
|
||||
final bitcoinSPAddrs = wallet.walletAddresses as BitcoinWalletAddresses;
|
||||
final bitcoinSPAddr = bitcoinSPAddrs.silentAddresses.first;
|
||||
return bitcoinSPAddr.address;
|
||||
final addresses = <String>[];
|
||||
final labels = <String>[];
|
||||
try {
|
||||
bitcoinTx.unspents!.forEach((unspent) {
|
||||
addresses.add(bitcoinWallet.walletAddresses.silentAddresses
|
||||
.firstWhere((address) => address.silentPaymentTweak == unspent.silentPaymentLabel)
|
||||
.address);
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,17 +351,19 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
if (wallet.type == WalletType.bitcoin && tx.direction == TransactionDirection.incoming) {
|
||||
try {
|
||||
final address = bitcoin!.getTransactionAddress(wallet, tx);
|
||||
final addresses = bitcoin!.getTransactionAddresses(wallet, tx);
|
||||
|
||||
if (address != null) {
|
||||
if (addresses != null) {
|
||||
isRecipientAddressShown = true;
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
);
|
||||
for (final address in addresses) {
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
printV(e.toString());
|
||||
|
||||
Reference in New Issue
Block a user