@solana/transaction-messages 2.2.0-canary-20250514101537 → 2.2.0-canary-20250514102324

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.
package/README.md CHANGED
@@ -171,9 +171,9 @@ function handleSubmit() {
171
171
  }
172
172
  ```
173
173
 
174
- #### `assertIsDurableNonceTransactionMessage()`
174
+ #### `assertIsTransactionMessageWithDurableNonceLifetime()`
175
175
 
176
- From time to time you might acquire a transaction message that you expect to be a durable nonce transaction, from an untrusted network API or user input. To assert that such an arbitrary transaction is in fact a durable nonce transaction, use the `assertIsDurableNonceTransactionMessage` function.
176
+ From time to time you might acquire a transaction message that you expect to be a durable nonce transaction, from an untrusted network API or user input. To assert that such an arbitrary transaction is in fact a durable nonce transaction, use the `assertIsTransactionMessageWithDurableNonceLifetime` function.
177
177
 
178
178
  See [`assertIsBlockhash()`](#assertisblockhash) for an example of how to use an assertion function.
179
179
 
@@ -670,11 +670,6 @@ function createTransactionMessage({
670
670
  }
671
671
  var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
672
672
  var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
673
- function assertIsDurableNonceTransactionMessage(transactionMessage) {
674
- if (!isDurableNonceTransaction(transactionMessage)) {
675
- throw new errors.SolanaError(errors.SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME);
676
- }
677
- }
678
673
  function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
679
674
  return {
680
675
  accounts: [
@@ -700,9 +695,16 @@ function isAdvanceNonceAccountInstruction(instruction) {
700
695
  function isAdvanceNonceAccountInstructionData(data) {
701
696
  return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
702
697
  }
703
- function isDurableNonceTransaction(transactionMessage) {
698
+
699
+ // src/durable-nonce.ts
700
+ function isTransactionMessageWithDurableNonceLifetime(transactionMessage) {
704
701
  return "lifetimeConstraint" in transactionMessage && typeof transactionMessage.lifetimeConstraint.nonce === "string" && transactionMessage.instructions[0] != null && isAdvanceNonceAccountInstruction(transactionMessage.instructions[0]);
705
702
  }
703
+ function assertIsTransactionMessageWithDurableNonceLifetime(transactionMessage) {
704
+ if (!isTransactionMessageWithDurableNonceLifetime(transactionMessage)) {
705
+ throw new errors.SolanaError(errors.SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME);
706
+ }
707
+ }
706
708
  function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
707
709
  return instruction.accounts[0].address === nonceAccountAddress && instruction.accounts[2].address === nonceAuthorityAddress;
708
710
  }
@@ -715,7 +717,7 @@ function setTransactionMessageLifetimeUsingDurableNonce({
715
717
  const firstInstruction = transactionMessage.instructions[0];
716
718
  if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
717
719
  if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
718
- if (isDurableNonceTransaction(transactionMessage) && transactionMessage.lifetimeConstraint.nonce === nonce) {
720
+ if (isTransactionMessageWithDurableNonceLifetime(transactionMessage) && transactionMessage.lifetimeConstraint.nonce === nonce) {
719
721
  return transactionMessage;
720
722
  } else {
721
723
  newInstructions = [firstInstruction, ...transactionMessage.instructions.slice(1)];
@@ -922,10 +924,15 @@ function decompileTransactionMessage(compiledTransactionMessage, config) {
922
924
  );
923
925
  }
924
926
 
927
+ // src/deprecated.ts
928
+ var assertIsDurableNonceTransactionMessage = assertIsTransactionMessageWithDurableNonceLifetime;
929
+ var isDurableNonceTransaction = isTransactionMessageWithDurableNonceLifetime;
930
+
925
931
  exports.appendTransactionMessageInstruction = appendTransactionMessageInstruction;
926
932
  exports.appendTransactionMessageInstructions = appendTransactionMessageInstructions;
927
933
  exports.assertIsDurableNonceTransactionMessage = assertIsDurableNonceTransactionMessage;
928
934
  exports.assertIsTransactionMessageWithBlockhashLifetime = assertIsTransactionMessageWithBlockhashLifetime;
935
+ exports.assertIsTransactionMessageWithDurableNonceLifetime = assertIsTransactionMessageWithDurableNonceLifetime;
929
936
  exports.compileTransactionMessage = compileTransactionMessage;
930
937
  exports.compressTransactionMessageUsingAddressLookupTables = compressTransactionMessageUsingAddressLookupTables;
931
938
  exports.createTransactionMessage = createTransactionMessage;
@@ -939,6 +946,7 @@ exports.getTransactionVersionEncoder = getTransactionVersionEncoder;
939
946
  exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
940
947
  exports.isDurableNonceTransaction = isDurableNonceTransaction;
941
948
  exports.isTransactionMessageWithBlockhashLifetime = isTransactionMessageWithBlockhashLifetime;
949
+ exports.isTransactionMessageWithDurableNonceLifetime = isTransactionMessageWithDurableNonceLifetime;
942
950
  exports.prependTransactionMessageInstruction = prependTransactionMessageInstruction;
943
951
  exports.prependTransactionMessageInstructions = prependTransactionMessageInstructions;
944
952
  exports.setTransactionMessageFeePayer = setTransactionMessageFeePayer;