@solana/transaction-messages 2.4.0-canary-20250709085504 → 2.4.0-canary-20250709090646

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.
@@ -271,11 +271,20 @@ function getCompiledMessageVersionedEncoder() {
271
271
  );
272
272
  }
273
273
  function getPreludeStructEncoderTuple() {
274
+ const lifetimeTokenEncoder = codecsDataStructures.getUnionEncoder(
275
+ [
276
+ // Use a 32-byte constant encoder for a missing lifetime token (index 0).
277
+ codecsDataStructures.getConstantEncoder(new Uint8Array(32)),
278
+ // Use a 32-byte base58 encoder for a valid lifetime token (index 1).
279
+ codecsCore.fixEncoderSize(getBase58Encoder(), 32)
280
+ ],
281
+ (value) => value === void 0 ? 0 : 1
282
+ );
274
283
  return [
275
284
  ["version", getTransactionVersionEncoder()],
276
285
  ["header", getMessageHeaderEncoder()],
277
286
  ["staticAccounts", codecsDataStructures.getArrayEncoder(addresses.getAddressEncoder(), { size: codecsNumbers.getShortU16Encoder() })],
278
- ["lifetimeToken", codecsCore.fixEncoderSize(getBase58Encoder(), 32)],
287
+ ["lifetimeToken", lifetimeTokenEncoder],
279
288
  ["instructions", codecsDataStructures.getArrayEncoder(getInstructionEncoder(), { size: codecsNumbers.getShortU16Encoder() })]
280
289
  ];
281
290
  }
@@ -587,22 +596,18 @@ function getCompiledStaticAccounts(orderedAccounts) {
587
596
  }
588
597
 
589
598
  // src/compile/message.ts
590
- var EMPTY_BLOCKHASH_LIFETIME_CONSTRAINT = {
591
- blockhash: "11111111111111111111111111111111",
592
- lastValidBlockHeight: 0n
593
- };
594
599
  function compileTransactionMessage(transactionMessage) {
595
600
  const addressMap = getAddressMapFromInstructions(
596
601
  transactionMessage.feePayer.address,
597
602
  transactionMessage.instructions
598
603
  );
599
604
  const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);
600
- const lifetimeConstraint = transactionMessage.lifetimeConstraint ?? EMPTY_BLOCKHASH_LIFETIME_CONSTRAINT;
605
+ const lifetimeConstraint = transactionMessage.lifetimeConstraint;
601
606
  return {
602
607
  ...transactionMessage.version !== "legacy" ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) } : null,
608
+ ...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
603
609
  header: getCompiledMessageHeader(orderedAccounts),
604
610
  instructions: getCompiledInstructions(transactionMessage.instructions, orderedAccounts),
605
- lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint),
606
611
  staticAccounts: getCompiledStaticAccounts(orderedAccounts),
607
612
  version: transactionMessage.version
608
613
  };