From fea0aeea64e9aafc4b05a0af99dc2084ce97db66 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 25 Apr 2023 15:08:00 -0600 Subject: [PATCH] paynym amount fixes --- lib/services/mixins/paynym_wallet_interface.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index bbbd0e8d9..4b768e9b7 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -498,6 +498,8 @@ mixin PaynymWalletInterface { utxoSigningData: utxoSigningData, change: 0, isSegwit: isSegwit, + // override amount to get around absurd fees error + overrideAmountForTesting: satoshisBeingUsed, )) .item2; @@ -563,7 +565,9 @@ mixin PaynymWalletInterface { Map transactionObject = { "hex": txn.item1, "recipientPaynym": targetPaymentCodeString, - "amount": amountToSend, + "amount": amountToSend.toAmountAsRaw( + fractionDigits: _coin.decimals, + ), "fee": feeBeingPaid, "vSize": txn.item2, "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), @@ -584,7 +588,8 @@ mixin PaynymWalletInterface { Map transactionObject = { "hex": txn.item1, "recipientPaynym": targetPaymentCodeString, - "amount": amountToSend, + "amount": + amountToSend.toAmountAsRaw(fractionDigits: _coin.decimals), "fee": feeBeingPaid, "vSize": txn.item2, "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), @@ -606,7 +611,7 @@ mixin PaynymWalletInterface { Map transactionObject = { "hex": txn.item1, "recipientPaynym": targetPaymentCodeString, - "amount": amountToSend, + "amount": amountToSend.toAmountAsRaw(fractionDigits: _coin.decimals), "fee": feeBeingPaid, "vSize": txn.item2, "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), @@ -639,6 +644,7 @@ mixin PaynymWalletInterface { required bool isSegwit, required List utxoSigningData, required int change, + int? overrideAmountForTesting, }) async { try { final targetPaymentCode = PaymentCode.fromPaymentCode( @@ -711,7 +717,7 @@ mixin PaynymWalletInterface { txb.addOutput( notificationAddress, - isSegwit ? _dustLimit : _dustLimitP2PKH, + overrideAmountForTesting ?? (isSegwit ? _dustLimit : _dustLimitP2PKH), ); txb.addOutput(opReturnScript, 0);