mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
Fix static amount value for determining best rate and replace it with the input the user types
This commit is contained in:
parent
cbe31aa5aa
commit
dd99508d3e
1 changed files with 4 additions and 2 deletions
|
@ -296,12 +296,14 @@ abstract class ExchangeViewModelBase with Store {
|
|||
}
|
||||
|
||||
Future<void> _calculateBestRate() async {
|
||||
final amount = double.tryParse(depositAmount) ?? double.tryParse(receiveAmount) ?? 1;
|
||||
|
||||
final result = await Future.wait<double>(
|
||||
_tradeAvailableProviders
|
||||
.map((element) => element.calculateAmount(
|
||||
from: depositCurrency,
|
||||
to: receiveCurrency,
|
||||
amount: 1,
|
||||
amount: amount,
|
||||
isFixedRateMode: isFixedRateMode,
|
||||
isReceiveAmount: false))
|
||||
);
|
||||
|
@ -311,7 +313,7 @@ abstract class ExchangeViewModelBase with Store {
|
|||
for (int i=0;i<result.length;i++) {
|
||||
if (result[i] != 0) {
|
||||
/// add this provider as its valid for this trade
|
||||
_sortedAvailableProviders[result[i]] = _tradeAvailableProviders[i];
|
||||
_sortedAvailableProviders[result[i] / amount] = _tradeAvailableProviders[i];
|
||||
}
|
||||
}
|
||||
if (_sortedAvailableProviders.isNotEmpty) {
|
||||
|
|
Loading…
Reference in a new issue