Open Legionaaa opened 11 months ago
If you require a backend signature and a frontend signature, you should use tx.partialSignWithPrivateKey
which will return you the witnessSet instead of the signedTx.
After the user signs the transaction, you can assemble both witnesses and then I'm pretty sure the fee should be correct.
const userWitness = <user signature from the frontend>
const backendWitness = tx.partialSignWithPrivateKey(validatorKey);
const signedTx = await tx.assemble([userWitness, backendWitness]).complete()
We're building a TX like this: let tx;
We're signing it on the backend (as it's required by the contract), and the TX is returned to the frontend to be signed by the user. So they can redeem.
The issue is the fee calculation is always a few lovelace short
I assume this is something to do with it taking into account the second signature size? Is there a way to juice the fee to take this into account or other workaround ?