spark transaction to spark send fixes

This commit is contained in:
julian 2024-01-05 16:39:05 -06:00
parent 48ad3db84c
commit 42e18397d7

View file

@ -357,7 +357,7 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
(estimatedFee ~/ BigInt.from(totalRecipientCount)),
fractionDigits: cryptoCurrency.fractionDigits,
),
isChange: txData.recipients![i].isChange,
isChange: txData.recipients![i].isChange,
),
);
@ -411,20 +411,6 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
}
}
tempInputs.add(
InputV2.isarCantDoRequiredInDefaultConstructor(
scriptSigHex: "d3",
sequence: 0xffffffff,
outpoint: null,
addresses: [],
valueStringSats: "0",
witness: null,
innerRedeemScriptAsm: null,
coinbase: null,
walletOwns: true,
),
);
final extractedTx = txb.buildIncomplete();
extractedTx.addInput(
'0000000000000000000000000000000000000000000000000000000000000000'
@ -485,6 +471,24 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
rawValue: BigInt.from(spend.fee),
fractionDigits: cryptoCurrency.fractionDigits,
);
tempInputs.add(
InputV2.isarCantDoRequiredInDefaultConstructor(
scriptSigHex: "d3",
sequence: 0xffffffff,
outpoint: null,
addresses: [],
valueStringSats: tempOutputs
.map((e) => e.value)
.fold(fee.raw, (p, e) => p + e)
.toString(),
witness: null,
innerRedeemScriptAsm: null,
coinbase: null,
walletOwns: true,
),
);
return txData.copyWith(
raw: rawTxHex,
vSize: extractedTx.virtualSize(),
@ -1165,7 +1169,7 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
rawValue: BigInt.from(e.$2),
fractionDigits: cryptoCurrency.fractionDigits,
),
isChange: false, // ok?
isChange: false, // ok?
),
)
.toList(),