mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
fixed autoselection if limit exist in atleast one exchange
This commit is contained in:
parent
f5cf012d81
commit
6e7443372f
2 changed files with 3 additions and 10 deletions
|
@ -12,7 +12,6 @@ import 'package:cake_wallet/exchange/trade_request.dart';
|
|||
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||
import 'package:cake_wallet/exchange/changenow/changenow_request.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/exchange/trade_not_created_exeption.dart';
|
||||
|
||||
class ChangeNowExchangeProvider extends ExchangeProvider {
|
||||
ChangeNowExchangeProvider()
|
||||
|
|
|
@ -294,7 +294,7 @@ abstract class ExchangeViewModelBase with Store {
|
|||
),
|
||||
);
|
||||
|
||||
results.sort((b, a) => (b['rate'] as double).compareTo(a['rate'] as double));
|
||||
results.sort((a, b) => (b['rate'] as double).compareTo(a['rate'] as double));
|
||||
|
||||
final providersInRange = results.where((element) => _filterProvider(element)).toList();
|
||||
|
||||
|
@ -535,17 +535,11 @@ abstract class ExchangeViewModelBase with Store {
|
|||
|
||||
bool _filterProvider(Map<String, dynamic> result){
|
||||
final limit = result['limit'] as Limits;
|
||||
final _provider = result['provider'] as ExchangeProvider;
|
||||
final amount = isReverse ? receiveAmount : depositAmount;
|
||||
final _amount = double.parse(amount.replaceAll(',', '.')) ?? 0;
|
||||
if(limit == null) return false;
|
||||
if(_amount >= limit.min ){
|
||||
if(_provider is ChangeNowExchangeProvider && _amount >= limit.min){
|
||||
return true;
|
||||
} else if(_amount <= limit.max){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(_amount >= limit.min && limit.max == null) return true;
|
||||
if(_amount >= limit.min && _amount <= limit.max) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue