cake_wallet/lib/src/domain/monero/monero_amount_format.dart

15 lines
645 B
Dart
Raw Normal View History

2020-01-04 19:31:52 +00:00
import 'package:intl/intl.dart';
import 'package:cake_wallet/src/domain/common/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}) =>
moneroAmountFormat.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider));
2020-01-04 19:31:52 +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();