Skip to content

Commit

Permalink
Fix bug in ReceivingSwapPage where tx variable was not properly initi…
Browse files Browse the repository at this point in the history
…alized
  • Loading branch information
mocodesmo committed May 2, 2024
1 parent 0a30f77 commit 4431e5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/home/bloc/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,17 @@ class HomeState with _$HomeState {
Transaction? getTxFromSwap(SwapTx swap) {
final isLiq = swap.walletType == BaseWalletType.Liquid;
final network = swap.network;
print('----> 1 $isLiq $network');
final wallet = !isLiq
? getMainSecureWallet(network)?.state.wallet
: getMainInstantWallet(network)?.state.wallet;
print('----> 2 $wallet');
if (wallet == null) return null;
print('----> 3');
final idx = wallet.transactions.indexWhere((t) => t.swapTx?.id == swap.id);
print('----> 4 $idx');
if (idx == -1) return null;
print('----> 5');
return wallet.transactions[idx];
}

Expand Down
5 changes: 3 additions & 2 deletions lib/swap/receive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ class _ReceivingSwapPageState extends State<ReceivingSwapPage> {
if (swapTx.id != widget.tx.id) return;

if (swapTx.settledReverse()) {
await Future.delayed(200.ms);
tx = context.read<HomeCubit>().state.getTxFromSwap(widget.tx);
setState(() {
received = true;
});
await Future.delayed(800.ms);
tx = context.read<HomeCubit>().state.getTxFromSwap(widget.tx);
setState(() {});
}
},
child: Scaffold(
Expand Down

0 comments on commit 4431e5a

Please sign in to comment.