Hello. I am trying to create a sponsored transaction. First, I create the transaction itself, then I sign it with the gas sponsor and afterward with the sender. Next, I attempt to send the transaction to the blockchain, but I receive an error 32602: “InvalidParams.” However, when I create and sign this transaction without a sponsor, it executes without errors
const sponsorSigner = Ed25519Keypair.fromSecretKey(OPERATOR_PRIVATE_KEY);
const tx = new Transaction();
tx.setSender(userAddress);
tx.moveCall({
target: '0x0c54e6e6fea6496b37e85edcb2ae74bba50ad0148df78c666a3e724e0364a8e3::mint::mint',
arguments: [
tx.object('0xee8810083f969ca42ecb2f59bf75959ae6c4edeca874b793cf4fa1ab86bb16cd'),
tx.pure.u64(1000000000),
tx.pure.address(userAddress),
],
});
const kindBytes = await tx.build({ client, onlyTransactionKind: true });
const sponsoredTx = Transaction.fromKind(kindBytes);
sponsoredTx.setGasOwner(OPERATOR_ADDRESS);
sponsoredTx.setGasPrice(750);
sponsoredTx.setGasBudget(50000000);
console.log(toBase64(kindBytes));
const sponsorSignedTx = await sponsorSigner.signTransaction(kindBytes);
const isVerifed = await sponsorSigner.getPublicKey().verifyTransaction(kindBytes, sponsorSignedTx.signature);
console.log(isVerifed)
const sponsoredTxJSON = await sponsoredTx.toJSON();
return {
sponsoredTxJSON,
sponsorSignature: sponsorSignedTx.signature,
txBytes: sponsorSignedTx.bytes
}