2020-01-04 19:31:52 +00:00
|
|
|
import 'package:intl/intl.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/crypto_amount_format.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
const moneroAmountLength = 12;
|
|
|
|
const moneroAmountDivider = 1000000000000;
|
|
|
|
final moneroAmountFormat = NumberFormat()
|
|
|
|
..maximumFractionDigits = moneroAmountLength
|
|
|
|
..minimumFractionDigits = 1;
|
|
|
|
|
|
|
|
String moneroAmountToString({int amount}) =>
|
2020-02-10 17:50:00 +00:00
|
|
|
moneroAmountFormat.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-02-10 17:50:00 +00:00
|
|
|
double moneroAmountToDouble({int amount}) => cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
2020-06-01 18:13:56 +00:00
|
|
|
|
|
|
|
int moneroParseAmount({String amount}) => moneroAmountFormat.parse(amount).toInt();
|