cake_wallet/lib/monero/monero_amount_format.dart
2020-09-21 14:50:26 +03:00

15 lines
No EOL
636 B
Dart

import 'package:intl/intl.dart';
import 'package:cake_wallet/entities/crypto_amount_format.dart';
const moneroAmountLength = 12;
const moneroAmountDivider = 1000000000000;
final moneroAmountFormat = NumberFormat()
..maximumFractionDigits = moneroAmountLength
..minimumFractionDigits = 1;
String moneroAmountToString({int amount}) =>
moneroAmountFormat.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider));
double moneroAmountToDouble({int amount}) => cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
int moneroParseAmount({String amount}) => moneroAmountFormat.parse(amount).toInt();