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

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.
@@ -2,7 +2,7 @@ import { SolanaError, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SO
2
2
  import { isBlockhash } from '@solana/rpc-types';
3
3
  import { getAddressDecoder, getAddressComparator, assertIsAddress, getAddressEncoder } from '@solana/addresses';
4
4
  import { createEncoder, createDecoder, combineCodec, transformDecoder, transformEncoder, fixDecoderSize, fixEncoderSize, addDecoderSizePrefix, addEncoderSizePrefix } from '@solana/codecs-core';
5
- import { getStructDecoder, getStructEncoder, getArrayDecoder, getUnionEncoder, getConstantEncoder, getArrayEncoder, getBytesDecoder, getBytesEncoder } from '@solana/codecs-data-structures';
5
+ import { getStructDecoder, getStructEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder } from '@solana/codecs-data-structures';
6
6
  import { getShortU16Decoder, getShortU16Encoder, getU8Decoder, getU8Encoder } from '@solana/codecs-numbers';
7
7
  import { isSignerRole, AccountRole, isWritableRole, mergeRoles } from '@solana/instructions';
8
8
  import { pipe } from '@solana/functional';
@@ -269,20 +269,11 @@ function getCompiledMessageVersionedEncoder() {
269
269
  );
270
270
  }
271
271
  function getPreludeStructEncoderTuple() {
272
- const lifetimeTokenEncoder = getUnionEncoder(
273
- [
274
- // Use a 32-byte constant encoder for a missing lifetime token (index 0).
275
- getConstantEncoder(new Uint8Array(32)),
276
- // Use a 32-byte base58 encoder for a valid lifetime token (index 1).
277
- fixEncoderSize(getBase58Encoder(), 32)
278
- ],
279
- (value) => value === void 0 ? 0 : 1
280
- );
281
272
  return [
282
273
  ["version", getTransactionVersionEncoder()],
283
274
  ["header", getMessageHeaderEncoder()],
284
275
  ["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
285
- ["lifetimeToken", lifetimeTokenEncoder],
276
+ ["lifetimeToken", fixEncoderSize(getBase58Encoder(), 32)],
286
277
  ["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
287
278
  ];
288
279
  }
@@ -594,18 +585,22 @@ function getCompiledStaticAccounts(orderedAccounts) {
594
585
  }
595
586
 
596
587
  // src/compile/message.ts
588
+ var EMPTY_BLOCKHASH_LIFETIME_CONSTRAINT = {
589
+ blockhash: "11111111111111111111111111111111",
590
+ lastValidBlockHeight: 0n
591
+ };
597
592
  function compileTransactionMessage(transactionMessage) {
598
593
  const addressMap = getAddressMapFromInstructions(
599
594
  transactionMessage.feePayer.address,
600
595
  transactionMessage.instructions
601
596
  );
602
597
  const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);
603
- const lifetimeConstraint = transactionMessage.lifetimeConstraint;
598
+ const lifetimeConstraint = transactionMessage.lifetimeConstraint ?? EMPTY_BLOCKHASH_LIFETIME_CONSTRAINT;
604
599
  return {
605
600
  ...transactionMessage.version !== "legacy" ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) } : null,
606
- ...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
607
601
  header: getCompiledMessageHeader(orderedAccounts),
608
602
  instructions: getCompiledInstructions(transactionMessage.instructions, orderedAccounts),
603
+ lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint),
609
604
  staticAccounts: getCompiledStaticAccounts(orderedAccounts),
610
605
  version: transactionMessage.version
611
606
  };