Generic fixes for payjoin (#2342)

* feat: enhance Payjoin transaction details with block explorer link

* feat: enhance Payjoin transaction details with block explorer link

* fix: handle connectivity errors in Payjoin session operations
This commit is contained in:
Konstantin Ullrich 2025-06-27 15:38:09 +02:00 committed by GitHub
parent d0827dd39e
commit b3c20a5818
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 4 deletions

View file

@ -4,7 +4,9 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/trade_details/trade_details_list_card.dart';
import 'package:cake_wallet/src/screens/trade_details/trade_details_status_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/blockexplorer_list_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
import 'package:cake_wallet/themes/core/theme_store.dart';
import 'package:cake_wallet/utils/date_formatter.dart';
import 'package:cw_core/payjoin_session.dart';
@ -12,6 +14,7 @@ import 'package:cw_core/transaction_info.dart';
import 'package:flutter/widgets.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:mobx/mobx.dart';
import 'package:url_launcher/url_launcher.dart';
part 'payjoin_details_view_model.g.dart';
@ -40,7 +43,7 @@ abstract class PayjoinDetailsViewModelBase with Store {
@observable
late PayjoinSession payjoinSession;
final ObservableList<StandartListItem> items;
final ObservableList<TransactionDetailsListItem> items;
late final StreamSubscription<BoxEvent> listener;
@ -69,12 +72,25 @@ abstract class PayjoinDetailsViewModelBase with Store {
title: S.current.error,
value: payjoinSession.error!,
),
if (payjoinSession.txId?.isNotEmpty == true && transactionInfo != null)
if (payjoinSession.txId?.isNotEmpty == true && transactionInfo != null) ...[
StandartListItem(
title: S.current.transaction_details_transaction_id,
value: payjoinSession.txId!,
key: ValueKey('standard_list_item_transaction_details_id_key'),
),
BlockExplorerListItem(
title: S.current.view_in_block_explorer,
value: '${S.current.view_transaction_on}mempool.space',
onTap: () async {
try {
final uri = Uri.parse('https://mempool.cakewallet.com/tx/${payjoinSession.txId!}');
if (await canLaunchUrl(uri))
await launchUrl(uri, mode: LaunchMode.externalApplication);
} catch (e) {}
},
key: ValueKey('block_explorer_list_item_wallet_type_key'),
)
]
]);
if (transactionInfo != null) {