@solana/transaction-messages 2.1.1-canary-20250425210025 → 2.1.1-canary-20250428190618
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/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/addresses-by-lookup-table-address.d.ts +4 -0
- package/dist/types/addresses-by-lookup-table-address.d.ts.map +1 -1
- package/dist/types/blockhash.d.ts +82 -0
- package/dist/types/blockhash.d.ts.map +1 -1
- package/dist/types/codecs/message.d.ts +20 -0
- package/dist/types/codecs/message.d.ts.map +1 -1
- package/dist/types/codecs/transaction-version.d.ts +19 -0
- package/dist/types/codecs/transaction-version.d.ts.map +1 -1
- package/dist/types/compilable-transaction-message.d.ts +5 -0
- package/dist/types/compilable-transaction-message.d.ts.map +1 -1
- package/dist/types/compile/address-table-lookups.d.ts +3 -0
- package/dist/types/compile/address-table-lookups.d.ts.map +1 -1
- package/dist/types/compile/header.d.ts +24 -0
- package/dist/types/compile/header.d.ts.map +1 -1
- package/dist/types/compile/instructions.d.ts +9 -0
- package/dist/types/compile/instructions.d.ts.map +1 -1
- package/dist/types/compile/message.d.ts +31 -0
- package/dist/types/compile/message.d.ts.map +1 -1
- package/dist/types/compress-transaction-message.d.ts +28 -0
- package/dist/types/compress-transaction-message.d.ts.map +1 -1
- package/dist/types/create-transaction-message.d.ts +11 -0
- package/dist/types/create-transaction-message.d.ts.map +1 -1
- package/dist/types/decompile-message.d.ts +23 -0
- package/dist/types/decompile-message.d.ts.map +1 -1
- package/dist/types/durable-nonce.d.ts +122 -0
- package/dist/types/durable-nonce.d.ts.map +1 -1
- package/dist/types/fee-payer.d.ts +18 -0
- package/dist/types/fee-payer.d.ts.map +1 -1
- package/dist/types/index.d.ts +29 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instructions.d.ts +96 -0
- package/dist/types/instructions.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1,15 +1,97 @@
|
|
|
1
1
|
import { type Blockhash } from '@solana/rpc-types';
|
|
2
2
|
import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
3
3
|
import { BaseTransactionMessage } from './transaction-message';
|
|
4
|
+
/**
|
|
5
|
+
* A constraint which, when applied to a transaction message, makes that transaction message
|
|
6
|
+
* eligible to land on the network. The transaction message will continue to be eligible to land
|
|
7
|
+
* until the network considers the `blockhash` to be expired.
|
|
8
|
+
*
|
|
9
|
+
* This can happen when the network proceeds past the `lastValidBlockHeight` for which the blockhash
|
|
10
|
+
* is considered valid, or when the network switches to a fork where that blockhash is not present.
|
|
11
|
+
*/
|
|
4
12
|
type BlockhashLifetimeConstraint = Readonly<{
|
|
13
|
+
/**
|
|
14
|
+
* A recent blockhash observed by the transaction proposer.
|
|
15
|
+
*
|
|
16
|
+
* The transaction message will be considered eligible to land until the network determines this
|
|
17
|
+
* blockhash to be too old, or has switched to a fork where it is not present.
|
|
18
|
+
*/
|
|
5
19
|
blockhash: Blockhash;
|
|
20
|
+
/**
|
|
21
|
+
* This is the block height beyond which the network will consider the blockhash to be too old
|
|
22
|
+
* to make a transaction message eligible to land.
|
|
23
|
+
*/
|
|
6
24
|
lastValidBlockHeight: bigint;
|
|
7
25
|
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Represents a transaction message whose lifetime is defined by the age of the blockhash it
|
|
28
|
+
* includes.
|
|
29
|
+
*
|
|
30
|
+
* Such a transaction can only be landed on the network if the current block height of the network
|
|
31
|
+
* is less than or equal to the value of
|
|
32
|
+
* `TransactionMessageWithBlockhashLifetime['lifetimeConstraint']['lastValidBlockHeight']`.
|
|
33
|
+
*/
|
|
8
34
|
export interface TransactionMessageWithBlockhashLifetime {
|
|
9
35
|
readonly lifetimeConstraint: BlockhashLifetimeConstraint;
|
|
10
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A type guard that returns `true` if the transaction message conforms to the
|
|
39
|
+
* {@link TransactionMessageWithBlockhashLifetime} type, and refines its type for use in your
|
|
40
|
+
* program.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { isTransactionMessageWithBlockhashLifetime } from '@solana/transaction-messages';
|
|
45
|
+
*
|
|
46
|
+
* if (isTransactionMessageWithBlockhashLifetime(message)) {
|
|
47
|
+
* // At this point, `message` has been refined to a `TransactionMessageWithBlockhashLifetime`.
|
|
48
|
+
* const { blockhash } = message.lifetimeConstraint;
|
|
49
|
+
* const { value: blockhashIsValid } = await rpc.isBlockhashValid(blockhash).send();
|
|
50
|
+
* setBlockhashIsValid(blockhashIsValid);
|
|
51
|
+
* } else {
|
|
52
|
+
* setError(
|
|
53
|
+
* `${getSignatureFromTransaction(transaction)} does not have a blockhash-based lifetime`,
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
11
58
|
export declare function isTransactionMessageWithBlockhashLifetime(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithBlockhashLifetime)): transactionMessage is BaseTransactionMessage & TransactionMessageWithBlockhashLifetime;
|
|
59
|
+
/**
|
|
60
|
+
* From time to time you might acquire a transaction message, that you expect to have a
|
|
61
|
+
* blockhash-based lifetime, from an untrusted network API or user input. Use this function to
|
|
62
|
+
* assert that such a transaction message actually has a blockhash-based lifetime.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { assertIsTransactionMessageWithBlockhashLifetime } from '@solana/transaction-messages';
|
|
67
|
+
*
|
|
68
|
+
* try {
|
|
69
|
+
* // If this type assertion function doesn't throw, then
|
|
70
|
+
* // Typescript will upcast `message` to `TransactionMessageWithBlockhashLifetime`.
|
|
71
|
+
* assertIsTransactionMessageWithBlockhashLifetime(message);
|
|
72
|
+
* // At this point, `message` is a `TransactionMessageWithBlockhashLifetime` that can be used
|
|
73
|
+
* // with the RPC.
|
|
74
|
+
* const { blockhash } = message.lifetimeConstraint;
|
|
75
|
+
* const { value: blockhashIsValid } = await rpc.isBlockhashValid(blockhash).send();
|
|
76
|
+
* } catch (e) {
|
|
77
|
+
* // `message` turned out not to have a blockhash-based lifetime
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
12
81
|
export declare function assertIsTransactionMessageWithBlockhashLifetime(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithBlockhashLifetime)): asserts transactionMessage is BaseTransactionMessage & TransactionMessageWithBlockhashLifetime;
|
|
82
|
+
/**
|
|
83
|
+
* Given a blockhash and the last block height at which that blockhash is considered usable to land
|
|
84
|
+
* transactions, this method will return a new transaction message having the same type as the one
|
|
85
|
+
* supplied plus the `TransactionMessageWithBlockhashLifetime` type.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import { setTransactionMessageLifetimeUsingBlockhash } from '@solana/transaction-messages';
|
|
90
|
+
*
|
|
91
|
+
* const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
|
|
92
|
+
* const txMessageWithBlockhashLifetime = setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, txMessage);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
13
95
|
export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transactionMessage: TTransactionMessage): Omit<TTransactionMessage, 'lifetimeConstraint'> & TransactionMessageWithBlockhashLifetime;
|
|
14
96
|
export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithBlockhashLifetime)>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transactionMessage: TTransactionMessage): TransactionMessageWithBlockhashLifetime & TTransactionMessage;
|
|
15
97
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockhash.d.ts","sourceRoot":"","sources":["../../src/blockhash.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,KAAK,2BAA2B,GAAG,QAAQ,CAAC;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,WAAW,uCAAuC;IACpD,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;CAC5D;AAED,wBAAgB,yCAAyC,CACrD,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,uCAAuC,CAAC,GAChH,kBAAkB,IAAI,sBAAsB,GAAG,uCAAuC,CAYxF;AAED,wBAAgB,+CAA+C,CAC3D,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,uCAAuC,CAAC,GAChH,OAAO,CAAC,kBAAkB,IAAI,sBAAsB,GAAG,uCAAuC,CAIhG;AAED,wBAAgB,2CAA2C,CACvD,mBAAmB,SAAS,sBAAsB,GAAG,0CAA0C,EAE/F,2BAA2B,EAAE,2BAA2B,EACxD,kBAAkB,EAAE,mBAAmB,GACxC,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,GAAG,uCAAuC,CAAC;AAE7F,wBAAgB,2CAA2C,CACvD,mBAAmB,SACb,sBAAsB,GACtB,CAAC,sBAAsB,GAAG,uCAAuC,CAAC,EAExE,2BAA2B,EAAE,2BAA2B,EACxD,kBAAkB,EAAE,mBAAmB,GACxC,uCAAuC,GAAG,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"blockhash.d.ts","sourceRoot":"","sources":["../../src/blockhash.ts"],"names":[],"mappings":"AACA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1
1
|
import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { CompiledTransactionMessage } from '../compile/message';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an encoder that you can use to encode a {@link CompiledTransactionMessage} to a byte
|
|
5
|
+
* array.
|
|
6
|
+
*
|
|
7
|
+
* The wire format of a Solana transaction consists of signatures followed by a compiled transaction
|
|
8
|
+
* message. The byte array produced by this encoder is the message part.
|
|
9
|
+
*/
|
|
3
10
|
export declare function getCompiledTransactionMessageEncoder(): VariableSizeEncoder<CompiledTransactionMessage>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns a decoder that you can use to decode a byte array representing a
|
|
13
|
+
* {@link CompiledTransactionMessage}.
|
|
14
|
+
*
|
|
15
|
+
* The wire format of a Solana transaction consists of signatures followed by a compiled transaction
|
|
16
|
+
* message. You can use this decoder to decode the message part.
|
|
17
|
+
*/
|
|
4
18
|
export declare function getCompiledTransactionMessageDecoder(): VariableSizeDecoder<CompiledTransactionMessage>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns a codec that you can use to encode from or decode to {@link CompiledTransactionMessage}
|
|
21
|
+
*
|
|
22
|
+
* @see {@link getCompiledTransactionMessageDecoder}
|
|
23
|
+
* @see {@link getCompiledTransactionMessageEncoder}
|
|
24
|
+
*/
|
|
5
25
|
export declare function getCompiledTransactionMessageCodec(): VariableSizeCodec<CompiledTransactionMessage>;
|
|
6
26
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AACA,OAAO,EAQH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAyDhE,wBAAgB,oCAAoC,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAiBtG;AAED,wBAAgB,oCAAoC,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAetG;AAED,wBAAgB,kCAAkC,IAAI,iBAAiB,CAAC,0BAA0B,CAAC,CAElG"}
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AACA,OAAO,EAQH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAyDhE;;;;;;GAMG;AACH,wBAAgB,oCAAoC,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAiBtG;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAetG;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,IAAI,iBAAiB,CAAC,0BAA0B,CAAC,CAElG"}
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { TransactionVersion } from '../transaction-message';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an encoder that you can use to encode a {@link TransactionVersion} to a byte array.
|
|
5
|
+
*
|
|
6
|
+
* Legacy messages will produce an empty array and will not advance the offset. Versioned messages
|
|
7
|
+
* will produce an array with a single byte.
|
|
8
|
+
*/
|
|
3
9
|
export declare function getTransactionVersionEncoder(): VariableSizeEncoder<TransactionVersion>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a decoder that you can use to decode a byte array representing a
|
|
12
|
+
* {@link TransactionVersion}.
|
|
13
|
+
*
|
|
14
|
+
* When the byte at the current offset is determined to represent a legacy transaction, this decoder
|
|
15
|
+
* will return `'legacy'` and will not advance the offset.
|
|
16
|
+
*/
|
|
4
17
|
export declare function getTransactionVersionDecoder(): VariableSizeDecoder<TransactionVersion>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a codec that you can use to encode from or decode to {@link TransactionVersion}
|
|
20
|
+
*
|
|
21
|
+
* @see {@link getTransactionVersionDecoder}
|
|
22
|
+
* @see {@link getTransactionVersionEncoder}
|
|
23
|
+
*/
|
|
5
24
|
export declare function getTransactionVersionCodec(): VariableSizeCodec<TransactionVersion>;
|
|
6
25
|
//# sourceMappingURL=transaction-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-version.d.ts","sourceRoot":"","sources":["../../../src/codecs/transaction-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI5D,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAiBtF;AAED,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CActF;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAElF"}
|
|
1
|
+
{"version":3,"file":"transaction-version.d.ts","sourceRoot":"","sources":["../../../src/codecs/transaction-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI5D;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAiBtF;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CActF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAElF"}
|
|
@@ -3,5 +3,10 @@ import { TransactionMessageWithBlockhashLifetime } from './blockhash';
|
|
|
3
3
|
import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
4
4
|
import { ITransactionMessageWithFeePayer } from './fee-payer';
|
|
5
5
|
import { BaseTransactionMessage, TransactionVersion } from './transaction-message';
|
|
6
|
+
/**
|
|
7
|
+
* A transaction message having sufficient detail to be compiled for execution on the network.
|
|
8
|
+
*
|
|
9
|
+
* In essence, this means that it has at minimum a version, a fee payer, and a lifetime constraint.
|
|
10
|
+
*/
|
|
6
11
|
export type CompilableTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = BaseTransactionMessage<TVersion, TInstruction> & ITransactionMessageWithFeePayer & (TransactionMessageWithBlockhashLifetime | TransactionMessageWithDurableNonceLifetime);
|
|
7
12
|
//# sourceMappingURL=compilable-transaction-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilable-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compilable-transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,uCAAuC,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,MAAM,MAAM,4BAA4B,CACpC,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC9C,+BAA+B,GAC/B,CAAC,uCAAuC,GAAG,0CAA0C,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"compilable-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compilable-transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,uCAAuC,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,CACpC,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC9C,+BAA+B,GAC/B,CAAC,uCAAuC,GAAG,0CAA0C,CAAC,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { OrderedAccounts } from '../compile/accounts';
|
|
3
3
|
type AddressTableLookup = Readonly<{
|
|
4
|
+
/** The address of the address lookup table account. */
|
|
4
5
|
lookupTableAddress: Address;
|
|
6
|
+
/** Indices of accounts in a lookup table to load as read-only. */
|
|
5
7
|
readableIndices: readonly number[];
|
|
8
|
+
/** Indices of accounts in a lookup table to load as writable. */
|
|
6
9
|
writableIndices: readonly number[];
|
|
7
10
|
}>;
|
|
8
11
|
export declare function getCompiledAddressTableLookups(orderedAccounts: OrderedAccounts): AddressTableLookup[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-table-lookups.d.ts","sourceRoot":"","sources":["../../../src/compile/address-table-lookups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,KAAK,kBAAkB,GAAG,QAAQ,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC,CAAC;AAEH,wBAAgB,8BAA8B,CAAC,eAAe,EAAE,eAAe,GAAG,kBAAkB,EAAE,CAsBrG"}
|
|
1
|
+
{"version":3,"file":"address-table-lookups.d.ts","sourceRoot":"","sources":["../../../src/compile/address-table-lookups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,KAAK,kBAAkB,GAAG,QAAQ,CAAC;IAC/B,uDAAuD;IACvD,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,iEAAiE;IACjE,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC,CAAC;AAEH,wBAAgB,8BAA8B,CAAC,eAAe,EAAE,eAAe,GAAG,kBAAkB,EAAE,CAsBrG"}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { OrderedAccounts } from '../compile/accounts';
|
|
2
2
|
type MessageHeader = Readonly<{
|
|
3
|
+
/**
|
|
4
|
+
* The number of accounts in the static accounts list that are neither writable nor
|
|
5
|
+
* signers.
|
|
6
|
+
*
|
|
7
|
+
* Adding this number to `numSignerAccounts` yields the index of the first read-only non-signer
|
|
8
|
+
* account in the static accounts list.
|
|
9
|
+
*/
|
|
3
10
|
numReadonlyNonSignerAccounts: number;
|
|
11
|
+
/**
|
|
12
|
+
* The number of read-only accounts in the static accounts list that must sign this
|
|
13
|
+
* transaction.
|
|
14
|
+
*
|
|
15
|
+
* Subtracting this number from `numSignerAccounts` yields the index of the first read-only
|
|
16
|
+
* signer account in the static accounts list.
|
|
17
|
+
*/
|
|
4
18
|
numReadonlySignerAccounts: number;
|
|
19
|
+
/**
|
|
20
|
+
* The number of accounts in the static accounts list that must sign this transaction.
|
|
21
|
+
*
|
|
22
|
+
* Subtracting `numReadonlySignerAccounts` from this number yields the number of
|
|
23
|
+
* writable signer accounts in the static accounts list. Writable signer accounts always
|
|
24
|
+
* begin at index zero in the static accounts list.
|
|
25
|
+
*
|
|
26
|
+
* This number itself is the index of the first non-signer account in the static
|
|
27
|
+
* accounts list.
|
|
28
|
+
*/
|
|
5
29
|
numSignerAccounts: number;
|
|
6
30
|
}>;
|
|
7
31
|
export declare function getCompiledMessageHeader(orderedAccounts: OrderedAccounts): MessageHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/compile/header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC1B,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAuBxF"}
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/compile/header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,KAAK,aAAa,GAAG,QAAQ,CAAC;IAC1B;;;;;;OAMG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;;;;OAMG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAClC;;;;;;;;;OASG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAuBxF"}
|
|
@@ -2,8 +2,17 @@ import { ReadonlyUint8Array } from '@solana/codecs-core';
|
|
|
2
2
|
import { IInstruction } from '@solana/instructions';
|
|
3
3
|
import { OrderedAccounts } from './accounts';
|
|
4
4
|
type CompiledInstruction = Readonly<{
|
|
5
|
+
/**
|
|
6
|
+
* An ordered list of indices that indicate which accounts in the transaction message's
|
|
7
|
+
* accounts list are loaded by this instruction.
|
|
8
|
+
*/
|
|
5
9
|
accountIndices?: number[];
|
|
10
|
+
/** The input to the invoked program */
|
|
6
11
|
data?: ReadonlyUint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* The index of the address in the transaction message's accounts list associated with the
|
|
14
|
+
* program to invoke.
|
|
15
|
+
*/
|
|
7
16
|
programAddressIndex: number;
|
|
8
17
|
}>;
|
|
9
18
|
export declare function getCompiledInstructions(instructions: readonly IInstruction[], orderedAccounts: OrderedAccounts): CompiledInstruction[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/compile/instructions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,mBAAmB,GAAG,QAAQ,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAAC;AAUH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,eAAe,EAAE,eAAe,GACjC,mBAAmB,EAAE,CASvB"}
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/compile/instructions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,mBAAmB,GAAG,QAAQ,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,uCAAuC;IACvC,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAAC;AAUH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,eAAe,EAAE,eAAe,GACjC,mBAAmB,EAAE,CASvB"}
|
|
@@ -5,19 +5,50 @@ import { getCompiledInstructions } from './instructions';
|
|
|
5
5
|
import { getCompiledLifetimeToken } from './lifetime-token';
|
|
6
6
|
import { getCompiledStaticAccounts } from './static-accounts';
|
|
7
7
|
type BaseCompiledTransactionMessage = Readonly<{
|
|
8
|
+
/**
|
|
9
|
+
* Information about the version of the transaction message and the role of the accounts it
|
|
10
|
+
* loads.
|
|
11
|
+
*/
|
|
8
12
|
header: ReturnType<typeof getCompiledMessageHeader>;
|
|
9
13
|
instructions: ReturnType<typeof getCompiledInstructions>;
|
|
14
|
+
/**
|
|
15
|
+
* 32 bytes of data observed by the transaction proposed that makes a transaction eligible to
|
|
16
|
+
* land on the network.
|
|
17
|
+
*
|
|
18
|
+
* In the case of a transaction message with a nonce lifetime constraint, this will be the value
|
|
19
|
+
* of the nonce itself. In all other cases this will be a recent blockhash.
|
|
20
|
+
*/
|
|
10
21
|
lifetimeToken: ReturnType<typeof getCompiledLifetimeToken>;
|
|
22
|
+
/** A list of addresses indicating which accounts to load */
|
|
11
23
|
staticAccounts: ReturnType<typeof getCompiledStaticAccounts>;
|
|
12
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* A transaction message in a form suitable for encoding for execution on the network.
|
|
27
|
+
*
|
|
28
|
+
* You can not fully reconstruct a source message from a compiled message without extra information.
|
|
29
|
+
* In particular, supporting details about the lifetime constraint and the concrete addresses of
|
|
30
|
+
* accounts sourced from account lookup tables are lost to compilation.
|
|
31
|
+
*/
|
|
13
32
|
export type CompiledTransactionMessage = LegacyCompiledTransactionMessage | VersionedCompiledTransactionMessage;
|
|
14
33
|
type LegacyCompiledTransactionMessage = BaseCompiledTransactionMessage & Readonly<{
|
|
15
34
|
version: 'legacy';
|
|
16
35
|
}>;
|
|
17
36
|
type VersionedCompiledTransactionMessage = BaseCompiledTransactionMessage & Readonly<{
|
|
37
|
+
/** A list of address tables and the accounts that this transaction loads from them */
|
|
18
38
|
addressTableLookups?: ReturnType<typeof getCompiledAddressTableLookups>;
|
|
19
39
|
version: number;
|
|
20
40
|
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Converts the type of transaction message data structure that you create in your application to
|
|
43
|
+
* the type of transaction message data structure that can be encoded for execution on the network.
|
|
44
|
+
*
|
|
45
|
+
* This is a lossy process; you can not fully reconstruct a source message from a compiled message
|
|
46
|
+
* without extra information. In particular, supporting details about the lifetime constraint and
|
|
47
|
+
* the concrete addresses of accounts sourced from account lookup tables will be lost to
|
|
48
|
+
* compilation.
|
|
49
|
+
*
|
|
50
|
+
* @see {@link decompileTransactionMessage}
|
|
51
|
+
*/
|
|
21
52
|
export declare function compileTransactionMessage(transactionMessage: CompilableTransactionMessage & Readonly<{
|
|
22
53
|
version: 'legacy';
|
|
23
54
|
}>): LegacyCompiledTransactionMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/compile/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,KAAK,8BAA8B,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,UA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E,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IACpD,YAAY,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACzD;;;;;;OAMG;IACH,aAAa,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC3D,4DAA4D;IAC5D,cAAc,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;CAChE,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,gCAAgC,GAAG,mCAAmC,CAAC;AAEhH,KAAK,gCAAgC,GAAG,8BAA8B,GAClE,QAAQ,CAAC;IACL,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEP,KAAK,mCAAmC,GAAG,8BAA8B,GACrE,QAAQ,CAAC;IACL,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;IACxE,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEP;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACrC,kBAAkB,EAAE,4BAA4B,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,GACnF,gCAAgC,CAAC;AACpC,wBAAgB,yBAAyB,CACrC,kBAAkB,EAAE,4BAA4B,GACjD,mCAAmC,CAAC"}
|
|
@@ -9,6 +9,34 @@ type WidenInstructionAccounts<TInstruction extends IInstruction> = TInstruction
|
|
|
9
9
|
}> : TInstruction;
|
|
10
10
|
type ExtractAdditionalProps<T, U> = Omit<T, keyof U>;
|
|
11
11
|
type WidenTransactionMessageInstructions<TTransactionMessage extends TransactionMessage> = TTransactionMessage extends BaseTransactionMessage<infer TVersion, infer TInstruction> ? BaseTransactionMessage<TVersion, WidenInstructionAccounts<TInstruction>> & ExtractAdditionalProps<TTransactionMessage, BaseTransactionMessage<TVersion, WidenInstructionAccounts<TInstruction>>> : TTransactionMessage;
|
|
12
|
+
/**
|
|
13
|
+
* Given a transaction message and a mapping of lookup tables to the addresses stored in them, this
|
|
14
|
+
* function will return a new transaction message with the same instructions but with all non-signer
|
|
15
|
+
* accounts that are found in the given lookup tables represented by an {@link IAccountLookupMeta}
|
|
16
|
+
* instead of an {@link IAccountMeta}.
|
|
17
|
+
*
|
|
18
|
+
* This means that these accounts will take up less space in the compiled transaction message. This
|
|
19
|
+
* size reduction is most significant when the transaction includes many accounts from the same
|
|
20
|
+
* lookup table.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { address } from '@solana/addresses';
|
|
25
|
+
* import { compressTransactionMessageUsingAddressLookupTables } from '@solana/transaction-messages';
|
|
26
|
+
*
|
|
27
|
+
* const lookupTableAddress = address('4QwSwNriKPrz8DLW4ju5uxC2TN5cksJx6tPUPj7DGLAW');
|
|
28
|
+
* const accountAddress = address('5n2ADjHPsqB4EVUNEX48xRqtnmuLu5XSHDwkJRR98qpM');
|
|
29
|
+
* const lookupTableAddresses: AddressesByLookupTableAddress = {
|
|
30
|
+
* [lookupTableAddress]: [accountAddress],
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* const compressedTransactionMessage = compressTransactionMessageUsingAddressLookupTables(
|
|
34
|
+
* transactionMessage,
|
|
35
|
+
* lookupTableAddresses,
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
12
40
|
export declare function compressTransactionMessageUsingAddressLookupTables<TTransactionMessage extends TransactionMessageNotLegacy = TransactionMessageNotLegacy>(transactionMessage: TTransactionMessage, addressesByLookupTableAddress: AddressesByLookupTableAddress): TTransactionMessage | WidenTransactionMessageInstructions<TTransactionMessage>;
|
|
13
41
|
export {};
|
|
14
42
|
//# sourceMappingURL=compress-transaction-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compress-transaction-message.ts"],"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;;;;;;;;;GA2BG;AACH,wBAAgB,kDAAkD,CAC9D,mBAAmB,SAAS,2BAA2B,GAAG,2BAA2B,EAErF,kBAAkB,EAAE,mBAAmB,EACvC,6BAA6B,EAAE,6BAA6B,GAC7D,mBAAmB,GAAG,mCAAmC,CAAC,mBAAmB,CAAC,CA2ChF"}
|
|
@@ -2,6 +2,17 @@ import { TransactionMessage, TransactionVersion } from './transaction-message';
|
|
|
2
2
|
type TransactionConfig<TVersion extends TransactionVersion> = Readonly<{
|
|
3
3
|
version: TVersion;
|
|
4
4
|
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Given a {@link TransactionVersion} this method will return an empty transaction having the
|
|
7
|
+
* capabilities of that version.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { createTransactionMessage } from '@solana/transaction-messages';
|
|
12
|
+
*
|
|
13
|
+
* const message = createTransactionMessage({ version: 0 });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
5
16
|
export declare function createTransactionMessage<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>): Extract<TransactionMessage, {
|
|
6
17
|
version: TVersion;
|
|
7
18
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-transaction-message.d.ts","sourceRoot":"","sources":["../../src/create-transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,KAAK,iBAAiB,CAAC,QAAQ,SAAS,kBAAkB,IAAI,QAAQ,CAAC;IACnE,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,kBAAkB,EACxE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GACpC,OAAO,CAAC,kBAAkB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"create-transaction-message.d.ts","sourceRoot":"","sources":["../../src/create-transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,KAAK,iBAAiB,CAAC,QAAQ,SAAS,kBAAkB,IAAI,QAAQ,CAAC;IACnE,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,kBAAkB,EACxE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GACpC,OAAO,CAAC,kBAAkB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -2,8 +2,31 @@ import { AddressesByLookupTableAddress } from './addresses-by-lookup-table-addre
|
|
|
2
2
|
import { CompilableTransactionMessage } from './compilable-transaction-message';
|
|
3
3
|
import { CompiledTransactionMessage } from './compile';
|
|
4
4
|
export type DecompileTransactionMessageConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* If the compiled message loads addresses from one or more address lookup tables, you will have
|
|
7
|
+
* to supply a map of those tables to an array of the addresses they contained at the time that
|
|
8
|
+
* the transaction message was constructed.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link decompileTransactionMessageFetchingLookupTables} if you do not already have this.
|
|
11
|
+
*/
|
|
5
12
|
addressesByLookupTableAddress?: AddressesByLookupTableAddress;
|
|
13
|
+
/**
|
|
14
|
+
* If the compiled message has a blockhash-based lifetime constraint, you will have to supply
|
|
15
|
+
* the block height after which that blockhash is no longer valid for use as a lifetime
|
|
16
|
+
* constraint.
|
|
17
|
+
*/
|
|
6
18
|
lastValidBlockHeight?: bigint;
|
|
7
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Converts the type of transaction message data structure appropriate for execution on the network
|
|
22
|
+
* to the type of transaction message data structure designed for use in your application.
|
|
23
|
+
*
|
|
24
|
+
* Because compilation is a lossy process, you can not fully reconstruct a source message from a
|
|
25
|
+
* compiled message without extra information. In order to faithfully reconstruct the original
|
|
26
|
+
* source message you will need to supply supporting details about the lifetime constraint and the
|
|
27
|
+
* concrete addresses of any accounts sourced from account lookup tables.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link compileTransactionMessage}
|
|
30
|
+
*/
|
|
8
31
|
export declare function decompileTransactionMessage(compiledTransactionMessage: CompiledTransactionMessage, config?: DecompileTransactionMessageConfig): CompilableTransactionMessage;
|
|
9
32
|
//# sourceMappingURL=decompile-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decompile-message.d.ts","sourceRoot":"","sources":["../../src/decompile-message.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAuKvD,MAAM,MAAM,iCAAiC,GAAG;IAC5C,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,2BAA2B,CACvC,0BAA0B,EAAE,0BAA0B,EACtD,MAAM,CAAC,EAAE,iCAAiC,GAC3C,4BAA4B,CAyC9B"}
|
|
1
|
+
{"version":3,"file":"decompile-message.d.ts","sourceRoot":"","sources":["../../src/decompile-message.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAuKvD,MAAM,MAAM,iCAAiC,GAAG;IAC5C;;;;;;OAMG;IACH,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;IAC9D;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACvC,0BAA0B,EAAE,0BAA0B,EACtD,MAAM,CAAC,EAAE,iCAAiC,GAC3C,4BAA4B,CAyC9B"}
|
|
@@ -14,12 +14,33 @@ type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuth
|
|
|
14
14
|
readonly nonceAccountAddress: Address<TNonceAccountAddress>;
|
|
15
15
|
readonly nonceAuthorityAddress: Address<TNonceAuthorityAddress>;
|
|
16
16
|
}>;
|
|
17
|
+
/** Represents a string that is particularly known to be the base58-encoded value of a nonce. */
|
|
17
18
|
export type Nonce<TNonceValue extends string = string> = TNonceValue & {
|
|
18
19
|
readonly __brand: unique symbol;
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* A constraint which, when applied to a transaction message, makes that transaction message
|
|
23
|
+
* eligible to land on the network.
|
|
24
|
+
*
|
|
25
|
+
* The transaction message will continue to be eligible to land until the network considers the
|
|
26
|
+
* `nonce` to have advanced. This can happen when the nonce account in which this nonce is found is
|
|
27
|
+
* destroyed, or the nonce value within changes.
|
|
28
|
+
*/
|
|
20
29
|
type NonceLifetimeConstraint<TNonceValue extends string = string> = Readonly<{
|
|
30
|
+
/**
|
|
31
|
+
* A value contained in the related nonce account at the time the transaction was prepared.
|
|
32
|
+
*
|
|
33
|
+
* The transaction will be considered eligible to land until the nonce account ceases to exist
|
|
34
|
+
* or contain this value.
|
|
35
|
+
*/
|
|
21
36
|
nonce: Nonce<TNonceValue>;
|
|
22
37
|
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Represents a transaction message whose lifetime is defined by the value of a nonce it includes.
|
|
40
|
+
*
|
|
41
|
+
* Such a transaction can only be landed on the network if the nonce is known to the network and has
|
|
42
|
+
* not already been used to land a different transaction.
|
|
43
|
+
*/
|
|
23
44
|
export interface TransactionMessageWithDurableNonceLifetime<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> {
|
|
24
45
|
readonly instructions: readonly [
|
|
25
46
|
AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,
|
|
@@ -27,9 +48,110 @@ export interface TransactionMessageWithDurableNonceLifetime<TNonceAccountAddress
|
|
|
27
48
|
];
|
|
28
49
|
readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;
|
|
29
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* From time to time you might acquire a transaction message, that you expect to have a
|
|
53
|
+
* nonce-based lifetime, from an untrusted network API or user input. Use this function to assert
|
|
54
|
+
* that such a transaction message actually has a nonce-based lifetime.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { assertIsDurableNonceTransactionMessage } from '@solana/transaction-messages';
|
|
59
|
+
*
|
|
60
|
+
* try {
|
|
61
|
+
* // If this type assertion function doesn't throw, then
|
|
62
|
+
* // Typescript will upcast `message` to `TransactionMessageWithDurableNonceLifetime`.
|
|
63
|
+
* assertIsDurableNonceTransactionMessage(message);
|
|
64
|
+
* // At this point, `message` is a `TransactionMessageWithDurableNonceLifetime` that can be used
|
|
65
|
+
* // with the RPC.
|
|
66
|
+
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
67
|
+
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
68
|
+
* } catch (e) {
|
|
69
|
+
* // `message` turned out not to have a nonce-based lifetime
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
30
73
|
export declare function assertIsDurableNonceTransactionMessage(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): asserts transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
|
|
74
|
+
/**
|
|
75
|
+
* A type guard that returns `true` if the instruction conforms to the
|
|
76
|
+
* {@link AdvanceNonceAccountInstruction} type, and refines its type for use in your program.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { isAdvanceNonceAccountInstruction } from '@solana/transaction-messages';
|
|
81
|
+
*
|
|
82
|
+
* if (isAdvanceNonceAccountInstruction(message.instructions[0])) {
|
|
83
|
+
* // At this point, the first instruction in the message has been refined to a
|
|
84
|
+
* // `AdvanceNonceAccountInstruction`.
|
|
85
|
+
* setNonceAccountAddress(message.instructions[0].accounts[0].address);
|
|
86
|
+
* } else {
|
|
87
|
+
* setError('The first instruction is not an `AdvanceNonce` instruction');
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
31
91
|
export declare function isAdvanceNonceAccountInstruction(instruction: IInstruction): instruction is AdvanceNonceAccountInstruction;
|
|
92
|
+
/**
|
|
93
|
+
* A type guard that returns `true` if the transaction message conforms to the
|
|
94
|
+
* {@link TransactionMessageWithDurableNonceLifetime} type, and refines its type for use in your
|
|
95
|
+
* program.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { isTransactionMessageWithDurableNonceLifetime } from '@solana/transaction-messages';
|
|
100
|
+
* import { fetchNonce } from "@solana-program/system";
|
|
101
|
+
*
|
|
102
|
+
* if (isTransactionMessageWithDurableNonceLifetime(message)) {
|
|
103
|
+
* // At this point, `message` has been refined to a
|
|
104
|
+
* // `TransactionMessageWithDurableNonceLifetime`.
|
|
105
|
+
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
106
|
+
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
107
|
+
* setNonceIsValid(nonce === actualNonce);
|
|
108
|
+
* } else {
|
|
109
|
+
* setError(
|
|
110
|
+
* `${getSignatureFromTransaction(transaction)} does not have a nonce-based lifetime`,
|
|
111
|
+
* );
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
32
115
|
export declare function isDurableNonceTransaction(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
|
|
116
|
+
/**
|
|
117
|
+
* Given a nonce, the account where the value of the nonce is stored, and the address of the account
|
|
118
|
+
* authorized to consume that nonce, this method will return a new transaction having the same type
|
|
119
|
+
* as the one supplied plus the {@link TransactionMessageWithDurableNonceLifetime} type.
|
|
120
|
+
*
|
|
121
|
+
* In particular, this method _prepends_ an instruction to the transaction message designed to
|
|
122
|
+
* consume (or 'advance') the nonce in the same transaction whose lifetime is defined by it.
|
|
123
|
+
*
|
|
124
|
+
* @param config
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { setTransactionMessageLifetimeUsingDurableNonce } from '@solana/transactions';
|
|
129
|
+
*
|
|
130
|
+
* const NONCE_VALUE_OFFSET =
|
|
131
|
+
* 4 + // version(u32)
|
|
132
|
+
* 4 + // state(u32)
|
|
133
|
+
* 32; // nonce authority(pubkey)
|
|
134
|
+
* // Then comes the nonce value.
|
|
135
|
+
*
|
|
136
|
+
* const nonceAccountAddress = address('EGtMh4yvXswwHhwVhyPxGrVV2TkLTgUqGodbATEPvojZ');
|
|
137
|
+
* const nonceAuthorityAddress = address('4KD1Rdrd89NG7XbzW3xsX9Aqnx2EExJvExiNme6g9iAT');
|
|
138
|
+
* const { value: nonceAccount } = await rpc
|
|
139
|
+
* .getAccountInfo(nonceAccountAddress, {
|
|
140
|
+
* dataSlice: { length: 32, offset: NONCE_VALUE_OFFSET },
|
|
141
|
+
* encoding: 'base58',
|
|
142
|
+
* })
|
|
143
|
+
* .send();
|
|
144
|
+
* const nonce =
|
|
145
|
+
* // This works because we asked for the exact slice of data representing the nonce
|
|
146
|
+
* // value, and furthermore asked for it in `base58` encoding.
|
|
147
|
+
* nonceAccount!.data[0] as unknown as Nonce;
|
|
148
|
+
*
|
|
149
|
+
* const durableNonceTransactionMessage = setTransactionMessageLifetimeUsingDurableNonce(
|
|
150
|
+
* { nonce, nonceAccountAddress, nonceAuthorityAddress },
|
|
151
|
+
* tx,
|
|
152
|
+
* );
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
33
155
|
export declare function setTransactionMessageLifetimeUsingDurableNonce<TTransactionMessage extends BaseTransactionMessage, TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string>({ nonce, nonceAccountAddress, nonceAuthorityAddress, }: DurableNonceConfig<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>, transactionMessage: TTransactionMessage | (TransactionMessageWithDurableNonceLifetime & TTransactionMessage)): TransactionMessageWithDurableNonceLifetime<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue> & TTransactionMessage;
|
|
34
156
|
export {};
|
|
35
157
|
//# sourceMappingURL=durable-nonce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-nonce.d.ts","sourceRoot":"","sources":["../../src/durable-nonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAEH,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EAEpB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,KAAK,8BAA8B,CAC/B,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,IAC9C,YAAY,CAAC,kCAAkC,CAAC,GAChD,wBAAwB,CACpB,SAAS;IACL,eAAe,CAAC,oBAAoB,CAAC;IACrC,eAAe,CAAC,6CAA6C,CAAC;IAC9D,qBAAqB,CAAC,sBAAsB,CAAC,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;CAChG,CACJ,GACD,oBAAoB,CAAC,kCAAkC,CAAC,CAAC;AAC7D,KAAK,kCAAkC,GAAG,UAAU,GAAG;IACnD,QAAQ,CAAC,O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S,MAAM,GAAG,MAAM,EAEnC,EACI,KAAK,EACL,mBAAmB,EACnB,qBAAqB,GACxB,EAAE,kBAAkB,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAChF,kBAAkB,EAAE,mBAAmB,GAAG,CAAC,0CAA0C,GAAG,mBAAmB,CAAC,GAC7G,0CAA0C,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,CAAC,GACpG,mBAAmB,CA8CtB"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
2
|
import { BaseTransactionMessage } from './transaction-message';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a transaction message for which a fee payer has been declared. A transaction must
|
|
5
|
+
* conform to this type to be compiled and landed on the network.
|
|
6
|
+
*/
|
|
3
7
|
export interface ITransactionMessageWithFeePayer<TAddress extends string = string> {
|
|
4
8
|
readonly feePayer: Readonly<{
|
|
5
9
|
address: Address<TAddress>;
|
|
6
10
|
}>;
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Given a base58-encoded address of a system account, this method will return a new transaction
|
|
14
|
+
* message having the same type as the one supplied plus the {@link ITransactionMessageWithFeePayer}
|
|
15
|
+
* type.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { address } from '@solana/addresses';
|
|
20
|
+
* import { setTransactionMessageFeePayer } from '@solana/transaction-messages';
|
|
21
|
+
*
|
|
22
|
+
* const myAddress = address('mpngsFd4tmbUfzDYJayjKZwZcaR7aWb2793J6grLsGu');
|
|
23
|
+
* const txPaidByMe = setTransactionMessageFeePayer(myAddress, tx);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
8
26
|
export declare function setTransactionMessageFeePayer<TFeePayerAddress extends string, TTransactionMessage extends BaseTransactionMessage & Partial<ITransactionMessageWithFeePayer>>(feePayer: Address<TFeePayerAddress>, transactionMessage: TTransactionMessage): ITransactionMessageWithFeePayer<TFeePayerAddress> & Omit<TTransactionMessage, 'feePayer'>;
|
|
9
27
|
//# sourceMappingURL=fee-payer.d.ts.map
|