@solana/transaction-messages 4.0.0-canary-20251008101046 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -626,7 +626,10 @@ function findAddressInLookupTables(address, role, addressesByLookupTableAddress)
626
626
  }
627
627
  }
628
628
  function compressTransactionMessageUsingAddressLookupTables(transactionMessage, addressesByLookupTableAddress) {
629
- const lookupTableAddresses = new Set(Object.values(addressesByLookupTableAddress).flatMap((a) => a));
629
+ const programAddresses = new Set(transactionMessage.instructions.map((ix) => ix.programAddress));
630
+ const eligibleLookupAddresses = new Set(
631
+ Object.values(addressesByLookupTableAddress).flatMap((a) => a).filter((address) => !programAddresses.has(address))
632
+ );
630
633
  const newInstructions = [];
631
634
  let updatedAnyInstructions = false;
632
635
  for (const instruction of transactionMessage.instructions) {
@@ -637,7 +640,7 @@ function compressTransactionMessageUsingAddressLookupTables(transactionMessage,
637
640
  const newAccounts = [];
638
641
  let updatedAnyAccounts = false;
639
642
  for (const account of instruction.accounts) {
640
- if ("lookupTableAddress" in account || !lookupTableAddresses.has(account.address) || isSignerRole(account.role)) {
643
+ if ("lookupTableAddress" in account || !eligibleLookupAddresses.has(account.address) || isSignerRole(account.role)) {
641
644
  newAccounts.push(account);
642
645
  continue;
643
646
  }