mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 04:19:50 +00:00
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:
parent
d0827dd39e
commit
b3c20a5818
3 changed files with 24 additions and 4 deletions
|
@ -67,6 +67,8 @@ abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with S
|
|||
payjoinManager.resumeSessions();
|
||||
} catch (e) {
|
||||
printV(e);
|
||||
// Ignore Connectivity errors
|
||||
if (!e.toString().contains("error sending request for url")) rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +81,8 @@ abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with S
|
|||
payjoinManager.spawnReceiver(receiver: currentPayjoinReceiver!);
|
||||
} catch (e) {
|
||||
printV(e);
|
||||
// Ignore Connectivity errors
|
||||
if (!e.toString().contains("error sending request for url")) rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,8 +106,8 @@ class PayjoinSenderWorker {
|
|||
sendPort.send({'type': PayjoinSenderRequestTypes.requestPosted});
|
||||
|
||||
return await postRequest.$2.processResponse(response: response);
|
||||
} catch (e) {
|
||||
throw PayjoinSessionError.unrecoverable('Send V1 payjoin error: $e');
|
||||
} catch (e, stack) {
|
||||
throw PayjoinSessionError.unrecoverable('Send V1 payjoin error: $e, $stack');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue