From bbb9246c5cc2436a8682a1e0a6bbe411d2b75d6c Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Tue, 23 Sep 2025 13:21:28 +0300 Subject: [PATCH] skip swaptrade if trade is larger than 2k --- lib/view_model/exchange/exchange_view_model.dart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index 047ea8397..6cafde9bd 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -669,12 +669,20 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with if (limitsState is LimitsLoadedSuccessfully) { if (double.tryParse(amount) == null) continue; - if (limits.min != null && double.parse(amount) < limits.min!) + if (limits.min != null && double.parse(amount) < limits.min!) { continue; - else if (limits.max != null && double.parse(amount) > limits.max!) + } else if (limits.max != null && double.parse(amount) > limits.max!) { continue; - else { + } else { try { + if (provider is SwapTradeExchangeProvider) { + final destinationAmount = (fiatConversionStore.prices[request.toCurrency] ?? 0.00) * (double.tryParse(request.toAmount) ?? 0.00); + final sendingAmount = (fiatConversionStore.prices[request.fromCurrency] ?? 0.00) * (double.tryParse(request.fromAmount) ?? 0.00); + + if (destinationAmount > 2000 || sendingAmount > 2000) { + continue; + } + } tradeState = TradeIsCreating(); final trade = await provider.createTrade( request: request,