From 06947f96b7c33800e1f6ed360c11d4261a97de82 Mon Sep 17 00:00:00 2001 From: Tolga Ay Date: Wed, 24 Jan 2024 11:09:16 +0300 Subject: [PATCH] Fix swap steps hanging (#99) * fix some swap steps hanging forever * fix MakerPaymentSpentByWatcher seen as fail step --- lib/blocs/swap_history_bloc.dart | 3 +++ lib/model/recent_swaps.dart | 2 +- lib/screens/dex/orders/swap/detailed_swap_steps.dart | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/blocs/swap_history_bloc.dart b/lib/blocs/swap_history_bloc.dart index 83c082669..e3d0c364e 100644 --- a/lib/blocs/swap_history_bloc.dart +++ b/lib/blocs/swap_history_bloc.dart @@ -49,6 +49,9 @@ class SwapHistoryBloc implements BlocBase { case 'MakerPaymentSpent': status = Status.SWAP_SUCCESSFUL; break; + case 'MakerPaymentSpentByWatcher': + status = Status.SWAP_SUCCESSFUL; + break; case 'TakerPaymentSpent': status = Status.SWAP_SUCCESSFUL; break; diff --git a/lib/model/recent_swaps.dart b/lib/model/recent_swaps.dart index ae7cb70ef..432920bcc 100644 --- a/lib/model/recent_swaps.dart +++ b/lib/model/recent_swaps.dart @@ -225,7 +225,7 @@ class SwapEEL { }); factory SwapEEL.fromJson(Map json) => SwapEEL( - data: json['data'] == null ? null : SwapEF.fromJson(json['data']), + data: json['data'] is Map ? SwapEF.fromJson(json['data']) : null, type: json['type'] ?? '', ); diff --git a/lib/screens/dex/orders/swap/detailed_swap_steps.dart b/lib/screens/dex/orders/swap/detailed_swap_steps.dart index 463b8a9e1..b4ef1e040 100644 --- a/lib/screens/dex/orders/swap/detailed_swap_steps.dart +++ b/lib/screens/dex/orders/swap/detailed_swap_steps.dart @@ -69,8 +69,8 @@ class _DetailedSwapStepsState extends State { if (index + 1 > swap.result.successEvents.length) { return SwapStepStatus.failed; } - if (swap.result.events[index].event.type == - swap.result.successEvents[index]) { + if (swap.result.successEvents + .any((String e) => e == swap.result.events[index].event.type)) { return SwapStepStatus.success; } else { return SwapStepStatus.failed;