mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-25 08:39:06 +00:00
Skip unsupported providers when calculating best rate provider (#500)
This commit is contained in:
parent
424cf25052
commit
244d20d1b6
1 changed files with 12 additions and 4 deletions
|
@ -210,6 +210,10 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
|
|
||||||
currentTradeAvailableProviders.clear();
|
currentTradeAvailableProviders.clear();
|
||||||
for (var provider in selectedProviders) {
|
for (var provider in selectedProviders) {
|
||||||
|
/// if this provider is not valid for the current pair, skip it
|
||||||
|
if (!providersForCurrentPair().contains(provider)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
provider
|
provider
|
||||||
.calculateAmount(
|
.calculateAmount(
|
||||||
from: receiveCurrency,
|
from: receiveCurrency,
|
||||||
|
@ -232,8 +236,8 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
isFixedRateMode: isFixedRateMode,
|
isFixedRateMode: isFixedRateMode,
|
||||||
).then((limits) {
|
).then((limits) {
|
||||||
/// if the entered amount doesn't exceed the limits of this provider
|
/// if the entered amount doesn't exceed the limits of this provider
|
||||||
if ((limits.max ?? double.maxFinite) >= _enteredAmount
|
if ((limits?.max ?? double.maxFinite) >= _enteredAmount
|
||||||
&& (limits.min ?? 0) <= _enteredAmount) {
|
&& (limits?.min ?? 0) <= _enteredAmount) {
|
||||||
/// add this provider as its valid for this trade
|
/// add this provider as its valid for this trade
|
||||||
/// will be sorted ascending already since
|
/// will be sorted ascending already since
|
||||||
/// we seek the least deposit amount
|
/// we seek the least deposit amount
|
||||||
|
@ -263,6 +267,10 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
|
|
||||||
currentTradeAvailableProviders.clear();
|
currentTradeAvailableProviders.clear();
|
||||||
for (var provider in selectedProviders) {
|
for (var provider in selectedProviders) {
|
||||||
|
/// if this provider is not valid for the current pair, skip it
|
||||||
|
if (!providersForCurrentPair().contains(provider)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
provider
|
provider
|
||||||
.calculateAmount(
|
.calculateAmount(
|
||||||
from: depositCurrency,
|
from: depositCurrency,
|
||||||
|
@ -286,8 +294,8 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
).then((limits) {
|
).then((limits) {
|
||||||
|
|
||||||
/// if the entered amount doesn't exceed the limits of this provider
|
/// if the entered amount doesn't exceed the limits of this provider
|
||||||
if ((limits.max ?? double.maxFinite) >= _enteredAmount
|
if ((limits?.max ?? double.maxFinite) >= _enteredAmount
|
||||||
&& (limits.min ?? 0) <= _enteredAmount) {
|
&& (limits?.min ?? 0) <= _enteredAmount) {
|
||||||
/// add this provider as its valid for this trade
|
/// add this provider as its valid for this trade
|
||||||
/// subtract from maxFinite so the provider
|
/// subtract from maxFinite so the provider
|
||||||
/// with the largest amount would be sorted ascending
|
/// with the largest amount would be sorted ascending
|
||||||
|
|
Loading…
Reference in a new issue