paynym amount fixes

This commit is contained in:
julian 2023-04-25 15:08:00 -06:00
parent 8c3fffde9d
commit fea0aeea64

View file

@ -498,6 +498,8 @@ mixin PaynymWalletInterface {
utxoSigningData: utxoSigningData, utxoSigningData: utxoSigningData,
change: 0, change: 0,
isSegwit: isSegwit, isSegwit: isSegwit,
// override amount to get around absurd fees error
overrideAmountForTesting: satoshisBeingUsed,
)) ))
.item2; .item2;
@ -563,7 +565,9 @@ mixin PaynymWalletInterface {
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn.item1, "hex": txn.item1,
"recipientPaynym": targetPaymentCodeString, "recipientPaynym": targetPaymentCodeString,
"amount": amountToSend, "amount": amountToSend.toAmountAsRaw(
fractionDigits: _coin.decimals,
),
"fee": feeBeingPaid, "fee": feeBeingPaid,
"vSize": txn.item2, "vSize": txn.item2,
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -584,7 +588,8 @@ mixin PaynymWalletInterface {
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn.item1, "hex": txn.item1,
"recipientPaynym": targetPaymentCodeString, "recipientPaynym": targetPaymentCodeString,
"amount": amountToSend, "amount":
amountToSend.toAmountAsRaw(fractionDigits: _coin.decimals),
"fee": feeBeingPaid, "fee": feeBeingPaid,
"vSize": txn.item2, "vSize": txn.item2,
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -606,7 +611,7 @@ mixin PaynymWalletInterface {
Map<String, dynamic> transactionObject = { Map<String, dynamic> transactionObject = {
"hex": txn.item1, "hex": txn.item1,
"recipientPaynym": targetPaymentCodeString, "recipientPaynym": targetPaymentCodeString,
"amount": amountToSend, "amount": amountToSend.toAmountAsRaw(fractionDigits: _coin.decimals),
"fee": feeBeingPaid, "fee": feeBeingPaid,
"vSize": txn.item2, "vSize": txn.item2,
"usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(), "usedUTXOs": utxoSigningData.map((e) => e.utxo).toList(),
@ -639,6 +644,7 @@ mixin PaynymWalletInterface {
required bool isSegwit, required bool isSegwit,
required List<SigningData> utxoSigningData, required List<SigningData> utxoSigningData,
required int change, required int change,
int? overrideAmountForTesting,
}) async { }) async {
try { try {
final targetPaymentCode = PaymentCode.fromPaymentCode( final targetPaymentCode = PaymentCode.fromPaymentCode(
@ -711,7 +717,7 @@ mixin PaynymWalletInterface {
txb.addOutput( txb.addOutput(
notificationAddress, notificationAddress,
isSegwit ? _dustLimit : _dustLimitP2PKH, overrideAmountForTesting ?? (isSegwit ? _dustLimit : _dustLimitP2PKH),
); );
txb.addOutput(opReturnScript, 0); txb.addOutput(opReturnScript, 0);