@solana/transaction-messages 2.1.2-canary-20250514101103 → 2.2.0-canary-20250514101928
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 +4 -4
- package/dist/index.browser.cjs +10 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +9 -5
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +9 -5
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +10 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +9 -5
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/compilable-transaction-message.d.ts +2 -2
- package/dist/types/compilable-transaction-message.d.ts.map +1 -1
- package/dist/types/deprecated.d.ts +65 -0
- package/dist/types/deprecated.d.ts.map +1 -0
- package/dist/types/durable-nonce.d.ts +4 -4
- package/dist/types/durable-nonce.d.ts.map +1 -1
- package/dist/types/fee-payer.d.ts +3 -3
- package/dist/types/fee-payer.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ const message = createTransactionMessage({ version: 0 });
|
|
|
56
56
|
|
|
57
57
|
### Types
|
|
58
58
|
|
|
59
|
-
#### `
|
|
59
|
+
#### `TransactionMessageWithFeePayer`
|
|
60
60
|
|
|
61
61
|
This type represents a transaction message for which a fee payer has been declared. A transaction must conform to this type to be compiled and landed on the network.
|
|
62
62
|
|
|
@@ -64,7 +64,7 @@ This type represents a transaction message for which a fee payer has been declar
|
|
|
64
64
|
|
|
65
65
|
#### `setTransactionMessageFeePayer()`
|
|
66
66
|
|
|
67
|
-
Given a base58-encoded address of a system account, this method will return a new transaction message having the same type as the one supplied plus the `
|
|
67
|
+
Given a base58-encoded address of a system account, this method will return a new transaction message having the same type as the one supplied plus the `TransactionMessageWithFeePayer` type.
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
70
|
import { address } from '@solana/addresses';
|
|
@@ -171,9 +171,9 @@ function handleSubmit() {
|
|
|
171
171
|
}
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
#### `
|
|
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 `
|
|
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
|
|
package/dist/index.browser.cjs
CHANGED
|
@@ -670,8 +670,8 @@ function createTransactionMessage({
|
|
|
670
670
|
}
|
|
671
671
|
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
|
|
672
672
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
673
|
-
function
|
|
674
|
-
if (!
|
|
673
|
+
function assertIsTransactionMessageWithDurableNonceLifetime(transactionMessage) {
|
|
674
|
+
if (!isTransactionMessageWithDurableNonceLifetime(transactionMessage)) {
|
|
675
675
|
throw new errors.SolanaError(errors.SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME);
|
|
676
676
|
}
|
|
677
677
|
}
|
|
@@ -700,7 +700,7 @@ function isAdvanceNonceAccountInstruction(instruction) {
|
|
|
700
700
|
function isAdvanceNonceAccountInstructionData(data) {
|
|
701
701
|
return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function isTransactionMessageWithDurableNonceLifetime(transactionMessage) {
|
|
704
704
|
return "lifetimeConstraint" in transactionMessage && typeof transactionMessage.lifetimeConstraint.nonce === "string" && transactionMessage.instructions[0] != null && isAdvanceNonceAccountInstruction(transactionMessage.instructions[0]);
|
|
705
705
|
}
|
|
706
706
|
function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -715,7 +715,7 @@ function setTransactionMessageLifetimeUsingDurableNonce({
|
|
|
715
715
|
const firstInstruction = transactionMessage.instructions[0];
|
|
716
716
|
if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
|
|
717
717
|
if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
|
|
718
|
-
if (
|
|
718
|
+
if (isTransactionMessageWithDurableNonceLifetime(transactionMessage) && transactionMessage.lifetimeConstraint.nonce === nonce) {
|
|
719
719
|
return transactionMessage;
|
|
720
720
|
} else {
|
|
721
721
|
newInstructions = [firstInstruction, ...transactionMessage.instructions.slice(1)];
|
|
@@ -922,10 +922,15 @@ function decompileTransactionMessage(compiledTransactionMessage, config) {
|
|
|
922
922
|
);
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
+
// src/deprecated.ts
|
|
926
|
+
var assertIsDurableNonceTransactionMessage = assertIsTransactionMessageWithDurableNonceLifetime;
|
|
927
|
+
var isDurableNonceTransaction = isTransactionMessageWithDurableNonceLifetime;
|
|
928
|
+
|
|
925
929
|
exports.appendTransactionMessageInstruction = appendTransactionMessageInstruction;
|
|
926
930
|
exports.appendTransactionMessageInstructions = appendTransactionMessageInstructions;
|
|
927
931
|
exports.assertIsDurableNonceTransactionMessage = assertIsDurableNonceTransactionMessage;
|
|
928
932
|
exports.assertIsTransactionMessageWithBlockhashLifetime = assertIsTransactionMessageWithBlockhashLifetime;
|
|
933
|
+
exports.assertIsTransactionMessageWithDurableNonceLifetime = assertIsTransactionMessageWithDurableNonceLifetime;
|
|
929
934
|
exports.compileTransactionMessage = compileTransactionMessage;
|
|
930
935
|
exports.compressTransactionMessageUsingAddressLookupTables = compressTransactionMessageUsingAddressLookupTables;
|
|
931
936
|
exports.createTransactionMessage = createTransactionMessage;
|
|
@@ -939,6 +944,7 @@ exports.getTransactionVersionEncoder = getTransactionVersionEncoder;
|
|
|
939
944
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
940
945
|
exports.isDurableNonceTransaction = isDurableNonceTransaction;
|
|
941
946
|
exports.isTransactionMessageWithBlockhashLifetime = isTransactionMessageWithBlockhashLifetime;
|
|
947
|
+
exports.isTransactionMessageWithDurableNonceLifetime = isTransactionMessageWithDurableNonceLifetime;
|
|
942
948
|
exports.prependTransactionMessageInstruction = prependTransactionMessageInstruction;
|
|
943
949
|
exports.prependTransactionMessageInstructions = prependTransactionMessageInstructions;
|
|
944
950
|
exports.setTransactionMessageFeePayer = setTransactionMessageFeePayer;
|