@solana/transaction-messages 2.4.0-canary-20250709085047 → 2.4.0-canary-20250709085912

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
  }
@@ -593,11 +602,12 @@ function compileTransactionMessage(transactionMessage) {
593
602
  transactionMessage.instructions
594
603
  );
595
604
  const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);
605
+ const lifetimeConstraint = transactionMessage.lifetimeConstraint;
596
606
  return {
597
607
  ...transactionMessage.version !== "legacy" ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) } : null,
608
+ ...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
598
609
  header: getCompiledMessageHeader(orderedAccounts),
599
610
  instructions: getCompiledInstructions(transactionMessage.instructions, orderedAccounts),
600
- lifetimeToken: getCompiledLifetimeToken(transactionMessage.lifetimeConstraint),
601
611
  staticAccounts: getCompiledStaticAccounts(orderedAccounts),
602
612
  version: transactionMessage.version
603
613
  };