You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
670 B
19 lines
670 B
3 years ago
|
import 'package:intl/intl.dart';
|
||
|
import 'package:cw_core/crypto_amount_format.dart';
|
||
|
|
||
|
const moneroAmountLength = 12;
|
||
|
const moneroAmountDivider = 1000000000000;
|
||
|
final moneroAmountFormat = NumberFormat()
|
||
|
..maximumFractionDigits = moneroAmountLength
|
||
|
..minimumFractionDigits = 1;
|
||
|
|
||
|
String moneroAmountToString({int amount}) => moneroAmountFormat
|
||
2 years ago
|
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider))
|
||
|
.replaceAll(',', '');
|
||
3 years ago
|
|
||
|
double moneroAmountToDouble({int amount}) =>
|
||
|
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
||
|
|
||
|
int moneroParseAmount({String amount}) =>
|
||
|
(double.parse(amount) * moneroAmountDivider).toInt();
|