mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-25 12:06:05 +00:00
Merge pull request #100 from cake-tech/CAKE-299-UI-fixes-on-the-send-screen
CAKE-299 | fixed bug for estimatedFee getter in the send_view_model.dart
This commit is contained in:
commit
e4bb14218b
1 changed files with 28 additions and 23 deletions
|
@ -79,33 +79,38 @@ abstract class SendViewModelBase with Store {
|
||||||
double get estimatedFee {
|
double get estimatedFee {
|
||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
if (cryptoAmount?.isNotEmpty ?? false) {
|
try {
|
||||||
int _amount = 0;
|
if (cryptoAmount?.isNotEmpty ?? false) {
|
||||||
switch (walletType) {
|
final _cryptoAmount = cryptoAmount.replaceAll(',', '.');
|
||||||
case WalletType.monero:
|
int _amount = 0;
|
||||||
_amount = moneroParseAmount(amount: cryptoAmount);
|
switch (walletType) {
|
||||||
break;
|
case WalletType.monero:
|
||||||
case WalletType.bitcoin:
|
_amount = moneroParseAmount(amount: _cryptoAmount);
|
||||||
_amount = stringDoubleToBitcoinAmount(cryptoAmount);
|
break;
|
||||||
break;
|
case WalletType.bitcoin:
|
||||||
default:
|
_amount = stringDoubleToBitcoinAmount(_cryptoAmount);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_amount > 0) {
|
||||||
|
amount = _amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_amount > 0) {
|
final fee = _wallet.calculateEstimatedFee(
|
||||||
amount = _amount;
|
_settingsStore.priority[_wallet.type], amount);
|
||||||
|
|
||||||
|
if (_wallet is BitcoinWallet) {
|
||||||
|
return bitcoinAmountToDouble(amount: fee);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final fee = _wallet.calculateEstimatedFee(
|
if (_wallet is MoneroWallet) {
|
||||||
_settingsStore.priority[_wallet.type], amount);
|
return moneroAmountToDouble(amount: fee);
|
||||||
|
}
|
||||||
if (_wallet is BitcoinWallet) {
|
} catch (e) {
|
||||||
return bitcoinAmountToDouble(amount: fee);
|
print(e.toString());
|
||||||
}
|
|
||||||
|
|
||||||
if (_wallet is MoneroWallet) {
|
|
||||||
return moneroAmountToDouble(amount: fee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue