Fix incorrect amount parsing due to bytes approximation

OmarHatem committed Feb 15, 2023 at 23:16 UTC 5abbc8f4ddaab9a58ed79327441aecb710f3c538
2 files changed +2 -2
cw_bitcoin/lib/bitcoin_amount_format.dart
+1 -1
@@ -17,7 +17,7 @@ int stringDoubleToBitcoinAmount(String amount) {
17 int result = 0;
18
19 try {
20 - result = (double.parse(amount) * bitcoinAmountDivider).toInt();
20 + result = (double.parse(amount) * bitcoinAmountDivider).round();
21 } catch (e) {
22 result = 0;
23 }
cw_core/lib/monero_amount_format.dart
+1 -1
@@ -15,4 +15,4 @@ double moneroAmountToDouble({required int amount}) =>
15 cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
16
17 int moneroParseAmount({required String amount}) =>
18 - (double.parse(amount) * moneroAmountDivider).toInt();
18 + (double.parse(amount) * moneroAmountDivider).round();