Support for Address Lookup Tables (V0 transactions)
Hello,
I would be happy to add support for Address Lookup Tables to this package and wonder if you would be open to a PR for this?
Currently, this package only supports legacy transactions. Solana introduced V0 transactions, which can include Address Lookup Tables. These refer to on-chain stored addresses and can reduce the size of transactions.
I thought about adding, a Transaction.to_binary/2, which accepts a list of Address Lookup Tables and encodes the transaction using the V0 format.
Additionally I would add a AddressLookupTable and AddressLookupTable.Program module (or LookupTable and LookupTable.Program to prevent overly long names).
If you are open for a PR, I would like to know if you agree with the design, so I can take it into account.
Hi @jochemarends,
Thanks for the proposal. I'm open to PRs adding new features like this as long as the API/structure is consistent with the JavaScript web3.js package (or, I guess, its replacement) to make an easy transition for JS Web3 developers.
I don't know how Address Lookup Tables are passed to a transaction, as I haven't looked into it myself. There's an outstanding PR (#5) that adds an options keyword list as a second argument to Transaction.to_binary/2, though, so if the address tables are an optional argument to serialize maybe that's the place to put it? When you do look into it, please link to the JS package implementation so I can read it over myself.
Thank you for the response.
solana/web3.jshascompileToV0Message, which returns aMessageV0.solana/kithascompressTransactionMessageUsingAddressLookupTables, which returns aTransactionMessage.