This is in version 1 with anchor:
async function execute(
program: Program<PaymentRollup>,
rollupPDA: PublicKey,
payments: Payment[],
proof: number[][],
accounts: any
) {
return program.methods
.executeCustomProgram(payments, proof)
.accountsPartial({
rollup: rollupPDA,
ownerTokenAccount: accounts.SENDER_ATA,
recipientTokenAccount: accounts.RECEIVER_ATA,
tokenProgram: TOKEN_PROGRAM_ID,
})
.remainingAccounts(accounts.executeAccounts)
.preInstructions([
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 })
])
.rpc();
}
however in version 2 it needs to be build etc and i need a feepayer. If i don't make it a feePayerSigner and partiallySign it, the simulation works but i can't send it to the network because then i get a Transaction signature verification failure.
const latestBlockhash = await rpcFactory.rpc.getLatestBlockhash().send();
const transaction = pipe(
createTransactionMessage({ version: 0 }),
tx => setTransactionMessageFeePayer(ownerAddress, tx),
tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash.value, tx),
tx => appendTransactionMessageInstruction(createBatchTokenPaymentInstruction, tx),
);
The entire idea is that we have a rollup which is signed and has permissions to spend funds and then afterwards we execute this so we don't require signing again (multiple times).
I'm totally lost, docs are of no help.