| 1 | import 'package:intl/intl.dart'; |
| 2 | import 'package:cw_core/crypto_amount_format.dart'; |
| 3 | |
| 4 | const wowneroAmountLength = 11; |
| 5 | const wowneroAmountDivider = 100000000000; |
| 6 | final wowneroAmountFormat = NumberFormat() |
| 7 | ..maximumFractionDigits = wowneroAmountLength |
| 8 | ..minimumFractionDigits = 1; |
| 9 | |
| 10 | String wowneroAmountToString({required int amount}) => wowneroAmountFormat |
| 11 | .format(cryptoAmountToDouble(amount: amount, divider: wowneroAmountDivider)) |
| 12 | .replaceAll(',', ''); |
| 13 | |
| 14 | double wowneroAmountToDouble({required int amount}) => |
| 15 | cryptoAmountToDouble(amount: amount, divider: wowneroAmountDivider); |
| 16 | |
| 17 | int wowneroParseAmount({required String amount}) => |
| 18 | (double.parse(amount) * wowneroAmountDivider).round(); |