@solana/transactions 3.0.0-canary-20250722092257 → 3.0.0-canary-20250722095653
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 +14 -1
- package/dist/index.browser.cjs +10 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +9 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +9 -2
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +10 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +9 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/sendable-transaction.d.ts +62 -0
- package/dist/types/sendable-transaction.d.ts.map +1 -0
- package/dist/types/signatures.d.ts +3 -3
- package/dist/types/signatures.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FullySignedTransaction } from './signatures';
|
|
2
|
+
import { Transaction } from './transaction';
|
|
3
|
+
import { TransactionWithinSizeLimit } from './transaction-size';
|
|
4
|
+
/**
|
|
5
|
+
* Helper type that includes all transaction types required
|
|
6
|
+
* for the transaction to be sent to the network.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link isSendableTransaction}
|
|
9
|
+
* @see {@link assertIsSendableTransaction}
|
|
10
|
+
*/
|
|
11
|
+
export type SendableTransaction = FullySignedTransaction & TransactionWithinSizeLimit;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a transaction has all the required
|
|
14
|
+
* conditions to be sent to the network.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { isSendableTransaction } from '@solana/transactions';
|
|
19
|
+
*
|
|
20
|
+
* const transaction = getTransactionDecoder().decode(transactionBytes);
|
|
21
|
+
* if (isSendableTransaction(transaction)) {
|
|
22
|
+
* // At this point we know that the transaction can be sent to the network.
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link assertIsSendableTransaction}
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSendableTransaction<TTransaction extends Transaction>(transaction: TTransaction): transaction is SendableTransaction & TTransaction;
|
|
29
|
+
/**
|
|
30
|
+
* Asserts that a given transaction has all the
|
|
31
|
+
* required conditions to be sent to the network.
|
|
32
|
+
*
|
|
33
|
+
* From time to time you might acquire a {@link Transaction}
|
|
34
|
+
* from an untrusted network API or user input and you are not sure
|
|
35
|
+
* that it has all the required conditions to be sent to the network
|
|
36
|
+
* — such as being fully signed and within the size limit.
|
|
37
|
+
* This function can be used to assert that such a transaction
|
|
38
|
+
* is in fact sendable.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { assertIsSendableTransaction } from '@solana/transactions';
|
|
43
|
+
*
|
|
44
|
+
* const transaction = getTransactionDecoder().decode(transactionBytes);
|
|
45
|
+
* try {
|
|
46
|
+
* // If this type assertion function doesn't throw, then Typescript will upcast `transaction`
|
|
47
|
+
* // to `SendableTransaction`.
|
|
48
|
+
* assertIsSendableTransaction(transaction);
|
|
49
|
+
* // At this point we know that the transaction can be sent to the network.
|
|
50
|
+
* await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });
|
|
51
|
+
* } catch(e) {
|
|
52
|
+
* if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING)) {
|
|
53
|
+
* setError(`Missing signatures for ${e.context.addresses.join(', ')}`);
|
|
54
|
+
* } else if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT)) {
|
|
55
|
+
* setError(`Transaction exceeds size limit of ${e.context.transactionSizeLimit} bytes`);
|
|
56
|
+
* }
|
|
57
|
+
* throw;
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function assertIsSendableTransaction<TTransaction extends Transaction>(transaction: TTransaction): asserts transaction is SendableTransaction & TTransaction;
|
|
62
|
+
//# sourceMappingURL=sendable-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendable-transaction.d.ts","sourceRoot":"","sources":["../../src/sendable-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,sBAAsB,EAA4B,MAAM,cAAc,CAAC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAGH,0BAA0B,EAC7B,MAAM,oBAAoB,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,GAAG,0BAA0B,CAAC;AAEtF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,SAAS,WAAW,EAClE,WAAW,EAAE,YAAY,GAC1B,WAAW,IAAI,mBAAmB,GAAG,YAAY,CAEnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,SAAS,WAAW,EACxE,WAAW,EAAE,YAAY,GAC1B,OAAO,CAAC,WAAW,IAAI,mBAAmB,GAAG,YAAY,CAG3D"}
|
|
@@ -6,7 +6,7 @@ import { Transaction } from './transaction';
|
|
|
6
6
|
* Represents a transaction that is signed by all of its required signers. Being fully signed is a
|
|
7
7
|
* prerequisite of functions designed to land transactions on the network.
|
|
8
8
|
*/
|
|
9
|
-
export type FullySignedTransaction = NominalType<'transactionSignedness', 'fullySigned'
|
|
9
|
+
export type FullySignedTransaction = NominalType<'transactionSignedness', 'fullySigned'>;
|
|
10
10
|
/**
|
|
11
11
|
* Given a transaction signed by its fee payer, this method will return the {@link Signature} that
|
|
12
12
|
* uniquely identifies it. This string can be used to look up transactions at a later date, for
|
|
@@ -41,7 +41,7 @@ export declare function getSignatureFromTransaction(transaction: Transaction): S
|
|
|
41
41
|
* @see {@link signTransaction} if you want to assert that the transaction has all of its required
|
|
42
42
|
* signatures after signing.
|
|
43
43
|
*/
|
|
44
|
-
export declare function partiallySignTransaction<
|
|
44
|
+
export declare function partiallySignTransaction<TTransaction extends Transaction & TransactionWithLifetime>(keyPairs: CryptoKeyPair[], transaction: TTransaction): Promise<TTransaction>;
|
|
45
45
|
/**
|
|
46
46
|
* Given an array of `CryptoKey` objects which are private keys pertaining to addresses that are
|
|
47
47
|
* required to sign a transaction, this method will return a new signed transaction of type
|
|
@@ -60,7 +60,7 @@ export declare function partiallySignTransaction<T extends Transaction & Transac
|
|
|
60
60
|
* @see {@link partiallySignTransaction} if you want to sign the transaction without asserting that
|
|
61
61
|
* the resulting transaction is fully signed.
|
|
62
62
|
*/
|
|
63
|
-
export declare function signTransaction<
|
|
63
|
+
export declare function signTransaction<TTransaction extends Transaction & TransactionWithLifetime>(keyPairs: CryptoKeyPair[], transaction: TTransaction): Promise<FullySignedTransaction & TTransaction>;
|
|
64
64
|
/**
|
|
65
65
|
* Checks whether a given {@link Transaction} is fully signed.
|
|
66
66
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAA6B,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,uBAAuB,EAAE,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAA6B,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;AAIzF;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAW/E;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,wBAAwB,CAAC,YAAY,SAAS,WAAW,GAAG,uBAAuB,EACrG,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAC1B,OAAO,CAAC,YAAY,CAAC,CAqDvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CAAC,YAAY,SAAS,WAAW,GAAG,uBAAuB,EAC5F,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAC1B,OAAO,CAAC,sBAAsB,GAAG,YAAY,CAAC,CAKhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,SAAS,WAAW,EACrE,WAAW,EAAE,YAAY,GAC1B,WAAW,IAAI,sBAAsB,GAAG,YAAY,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,SAAS,WAAW,EAC3E,WAAW,EAAE,YAAY,GAC1B,OAAO,CAAC,WAAW,IAAI,sBAAsB,GAAG,YAAY,CAa9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/transactions",
|
|
3
|
-
"version": "3.0.0-canary-
|
|
3
|
+
"version": "3.0.0-canary-20250722095653",
|
|
4
4
|
"description": "Helpers for creating and serializing transactions",
|
|
5
5
|
"exports": {
|
|
6
6
|
"edge-light": {
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"maintained node versions"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@solana/
|
|
58
|
-
"@solana/codecs-
|
|
59
|
-
"@solana/codecs-
|
|
60
|
-
"@solana/
|
|
61
|
-
"@solana/codecs-strings": "3.0.0-canary-
|
|
62
|
-
"@solana/errors": "3.0.0-canary-
|
|
63
|
-
"@solana/functional": "3.0.0-canary-
|
|
64
|
-
"@solana/keys": "3.0.0-canary-
|
|
65
|
-
"@solana/instructions": "3.0.0-canary-
|
|
66
|
-
"@solana/nominal-types": "3.0.0-canary-
|
|
67
|
-
"@solana/
|
|
68
|
-
"@solana/
|
|
57
|
+
"@solana/codecs-core": "3.0.0-canary-20250722095653",
|
|
58
|
+
"@solana/codecs-data-structures": "3.0.0-canary-20250722095653",
|
|
59
|
+
"@solana/codecs-numbers": "3.0.0-canary-20250722095653",
|
|
60
|
+
"@solana/addresses": "3.0.0-canary-20250722095653",
|
|
61
|
+
"@solana/codecs-strings": "3.0.0-canary-20250722095653",
|
|
62
|
+
"@solana/errors": "3.0.0-canary-20250722095653",
|
|
63
|
+
"@solana/functional": "3.0.0-canary-20250722095653",
|
|
64
|
+
"@solana/keys": "3.0.0-canary-20250722095653",
|
|
65
|
+
"@solana/instructions": "3.0.0-canary-20250722095653",
|
|
66
|
+
"@solana/nominal-types": "3.0.0-canary-20250722095653",
|
|
67
|
+
"@solana/rpc-types": "3.0.0-canary-20250722095653",
|
|
68
|
+
"@solana/transaction-messages": "3.0.0-canary-20250722095653"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"typescript": ">=5.3.3"
|