1

I'm confused about look up tables. Suppose I want to call a function from a program which requires to pass in a list of transactions. Usually I would pass in a list of accounts as my keys: [{pubkey:... , isWritable: false, isSigner: false}, ....]. According to the docs instead of passing the full address to the look up table I can pass in a 1 byte index corresponding to the index of a given address in my look up table. How can I pass in this 1 byte most online implementations only pass in the look up table but not the indexes. How would the program then know which addresses correspond to which ?

I'm looking for something of the sort:

const instruction = new TransactionInstruction({
 keys: [{pubkey: 1, isSigner: false, isWritable: true}],
 programId: TENSORSWAP_ADDR,
 data,
});```

1 Answer 1

0

You need to use a versioned tx to use lookup tables

const messageV0 = new web3.TransactionMessage({
  payerKey: payer.publicKey,
  recentBlockhash: blockhash,
  instructions: arrayOfInstructions,
}).compileToV0Message([lookupTableAccount]);

const transactionV0 = new web3.VersionedTransaction(messageV0);

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.