1

I have a versioned transaction with an address lookup table. However, I need to convert it to one without an address lookup table (that is, the addresses will contribute to the 1232 byte limit per transaction). How would I go about doing this?

Preferred language: Typescript then Python if necessary

1 Answer 1

1

I think you can just grab the instructions and create a new transaction with them

const V0MessageWithLUT = .... // update with your transaction

let instructions = TransactionMessage.decompile(V0TxWithLUT).instructions;

const messageV0 = new TransactionMessage({
    payerKey: me.publicKey,
    recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
    instructions: [...instructions],
}).compileToV0Message();

let tx = new VersionedTransaction(messageV0);
4
  • Did you mean V0TxWithLUT.message? When I pass that into the decompile function, it doesn't work. Error message below.
    – Junior Hat
    Commented Aug 9 at 3:04
  • Promise { <rejected> Error: Failed to get account keys because address table lookups were not resolved at MessageV0.getAccountKeys (C:\Users\XX\Desktop\Projects\XX\node_modules\@solana\web3.js\src\message\v0.ts:105:13) at Function.decompile (C:\Users\XX\Desktop\Projects\XX\node_modules\@solana\web3.js\src\transaction\message.ts:57:33) at conv (C:\Users\XX\Desktop\Projects\XX\server.ts:230:39) at C:\Users\XX\Desktop\Projects\XX\server.ts:283:13 at processTicksAndRejections (node:internal/process/task_queues:95:5) }
    – Junior Hat
    Commented Aug 9 at 3:04
  • This is the function I tried to use. ``` lang-ts async function conv(V0TxWithLUT: VersionedTransaction, wallet:Wallet){ let instructions = TransactionMessage.decompile(V0TxWithLUT.message).instructions; console.log(instructions) console.log("\n\n\n") const messageV0 = new TransactionMessage({ payerKey: wallet.publicKey, recentBlockhash: (await connection.getLatestBlockhash()).blockhash, instructions: [...instructions], }).compileToV0Message(); console.log(messageV0) return new VersionedTransaction(messageV0) } ```
    – Junior Hat
    Commented Aug 9 at 3:26
  • can you check if this answer solves the error solana.stackexchange.com/a/13479/1708
    – Jimii
    Commented Aug 9 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.