2022-03-16 10:50:12 +00:00
|
|
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
|
|
|
import 'package:cake_wallet/monero/monero.dart';
|
|
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
|
2020-02-11 20:50:10 +00:00
|
|
|
String formatAmount(String amount) {
|
2020-11-09 16:09:04 +00:00
|
|
|
if ((!amount.contains('.'))&&(!amount.contains(','))) {
|
2020-02-07 12:06:15 +00:00
|
|
|
return amount + '.00';
|
2020-11-09 16:09:04 +00:00
|
|
|
} else if ((amount.endsWith('.'))||(amount.endsWith(','))) {
|
2020-02-07 12:06:15 +00:00
|
|
|
return amount + '00';
|
|
|
|
}
|
|
|
|
return amount;
|
2022-03-16 10:50:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double formatAmountToDouble({WalletType type, int amount}) {
|
|
|
|
if (type == WalletType.bitcoin || type == WalletType.litecoin) {
|
|
|
|
return bitcoin.formatterBitcoinAmountToDouble(amount: amount);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == WalletType.monero) {
|
|
|
|
return monero.formatterMoneroAmountToDouble(amount: amount);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
2020-02-07 12:06:15 +00:00
|
|
|
}
|