You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a type AddressesByLookupTableAddress which stores the addresses for lookup tables. I used this in the deserialize-transaction example. To get this you need to write code like:
// The only data from the lookup table we need is its addressestypeLookupTableData={addresses: Address[];};// We fetch the JSON parsed representation of the lookup table from the RPCconstlookupTableAccount=awaitfetchJsonParsedAccount<LookupTableData>(rpc,LOOKUP_TABLE_ADDRESS);assertAccountDecoded(lookupTableAccount);assertAccountExists(lookupTableAccount);constlookupAddresses={[LOOKUP_TABLE_ADDRESS]: lookupTableAccount.data.addresses,}
We could write a helper function that does this for you, with better error handling, perhaps for multiple lookup tables.
Example use case
constlookupAddresses=awaitfetchAddressesForLookupTableAddresses(rpc,[LOOKUP_TABLE_ADDRESS])// compress a transaction message using the lookup tablesconsttransactionMessageWithLookupTables=compressTransactionMessageUsingAddressLookupTables(transactionMessage,lookupAddresses);
We also use the same data structure for decompileTransactionMessage
Details
Use await fetchJsonParsedAccounts
Add assertions that the accounts are owned by the Lookup Table Program
Add specific errors for the assertions
The text was updated successfully, but these errors were encountered:
Motivation
We have a type
AddressesByLookupTableAddress
which stores the addresses for lookup tables. I used this in thedeserialize-transaction
example. To get this you need to write code like:We could write a helper function that does this for you, with better error handling, perhaps for multiple lookup tables.
Example use case
We also use the same data structure for
decompileTransactionMessage
Details
await fetchJsonParsedAccounts
The text was updated successfully, but these errors were encountered: