@solana/transaction-messages 2.2.0-canary-20250708184753 → 2.2.1
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 +9 -9
- package/dist/index.browser.cjs +32 -34
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +34 -34
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +34 -34
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +32 -34
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +34 -34
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/blockhash.d.ts +3 -2
- package/dist/types/blockhash.d.ts.map +1 -1
- package/dist/types/compilable-transaction-message.d.ts +5 -4
- package/dist/types/compilable-transaction-message.d.ts.map +1 -1
- package/dist/types/compile/accounts.d.ts +3 -3
- package/dist/types/compile/accounts.d.ts.map +1 -1
- package/dist/types/compile/instructions.d.ts +2 -2
- package/dist/types/compile/instructions.d.ts.map +1 -1
- package/dist/types/compress-transaction-message.d.ts +5 -5
- package/dist/types/compress-transaction-message.d.ts.map +1 -1
- package/dist/types/create-transaction-message.d.ts +3 -7
- package/dist/types/create-transaction-message.d.ts.map +1 -1
- package/dist/types/decompile-message.d.ts.map +1 -1
- package/dist/types/durable-nonce.d.ts +49 -47
- package/dist/types/durable-nonce.d.ts.map +1 -1
- package/dist/types/fee-payer.d.ts +3 -8
- package/dist/types/fee-payer.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instructions.d.ts +6 -21
- package/dist/types/instructions.d.ts.map +1 -1
- package/dist/types/transaction-message.d.ts +5 -5
- package/dist/types/transaction-message.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/types/deprecated.d.ts +0 -65
- package/dist/types/deprecated.d.ts.map +0 -1
- package/dist/types/durable-nonce-instruction.d.ts +0 -43
- package/dist/types/durable-nonce-instruction.d.ts.map +0 -1
- package/dist/types/lifetime.d.ts +0 -12
- package/dist/types/lifetime.d.ts.map +0 -1
- package/dist/types/transaction-message-size.d.ts +0 -13
- package/dist/types/transaction-message-size.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Blockhash } from '@solana/rpc-types';
|
|
2
|
-
import {
|
|
2
|
+
import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
3
3
|
import { BaseTransactionMessage } from './transaction-message';
|
|
4
4
|
/**
|
|
5
5
|
* A constraint which, when applied to a transaction message, makes that transaction message
|
|
@@ -92,6 +92,7 @@ export declare function assertIsTransactionMessageWithBlockhashLifetime(transact
|
|
|
92
92
|
* const txMessageWithBlockhashLifetime = setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, txMessage);
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
|
-
export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage &
|
|
95
|
+
export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transactionMessage: TTransactionMessage): Omit<TTransactionMessage, 'lifetimeConstraint'> & TransactionMessageWithBlockhashLifetime;
|
|
96
|
+
export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithBlockhashLifetime)>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transactionMessage: TTransactionMessage): TransactionMessageWithBlockhashLifetime & TTransactionMessage;
|
|
96
97
|
export {};
|
|
97
98
|
//# sourceMappingURL=blockhash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockhash.d.ts","sourceRoot":"","sources":["../../src/blockhash.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
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;;;;;;;GAOG;AACH,KAAK,2BAA2B,GAAG,QAAQ,CAAC;IACxC;;;;;OAKG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAC;CAChC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,uCAAuC;IACpD,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;CAC5D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yCAAyC,CACrD,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,uCAAuC,CAAC,GAChH,kBAAkB,IAAI,sBAAsB,GAAG,uCAAuC,CAYxF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,+CAA+C,CAC3D,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,uCAAuC,CAAC,GAChH,OAAO,CAAC,kBAAkB,IAAI,sBAAsB,GAAG,uCAAuC,CAIhG;AAED;;;;;;;;;;;;GAYG;AACH,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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { IInstruction } from '@solana/instructions';
|
|
2
|
+
import { TransactionMessageWithBlockhashLifetime } from './blockhash';
|
|
3
|
+
import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
4
|
+
import { ITransactionMessageWithFeePayer } from './fee-payer';
|
|
4
5
|
import { BaseTransactionMessage, TransactionVersion } from './transaction-message';
|
|
5
6
|
/**
|
|
6
7
|
* A transaction message having sufficient detail to be compiled for execution on the network.
|
|
7
8
|
*
|
|
8
9
|
* In essence, this means that it has at minimum a version, a fee payer, and a lifetime constraint.
|
|
9
10
|
*/
|
|
10
|
-
export type CompilableTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends
|
|
11
|
+
export type CompilableTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = BaseTransactionMessage<TVersion, TInstruction> & ITransactionMessageWithFeePayer & (TransactionMessageWithBlockhashLifetime | TransactionMessageWithDurableNonceLifetime);
|
|
11
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,
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { IAccountLookupMeta, IAccountMeta, IInstruction, ReadonlyAccount, ReadonlyAccountLookup, ReadonlySignerAccount, WritableAccount, WritableAccountLookup, WritableSignerAccount } from '@solana/instructions';
|
|
3
3
|
import { Brand } from '@solana/nominal-types';
|
|
4
4
|
export declare const enum AddressMapEntryType {
|
|
5
5
|
FEE_PAYER = 0,
|
|
@@ -15,13 +15,13 @@ type FeePayerAccountEntry = Omit<WritableSignerAccount, 'address'> & {
|
|
|
15
15
|
type LookupTableAccountEntry = Omit<ReadonlyAccountLookup | WritableAccountLookup, 'address'> & {
|
|
16
16
|
[TYPE]: AddressMapEntryType.LOOKUP_TABLE;
|
|
17
17
|
};
|
|
18
|
-
export type OrderedAccounts = Brand<(
|
|
18
|
+
export type OrderedAccounts = Brand<(IAccountLookupMeta | IAccountMeta)[], 'OrderedAccounts'>;
|
|
19
19
|
type StaticAccountEntry = Omit<ReadonlyAccount | ReadonlySignerAccount | WritableAccount | WritableSignerAccount, 'address'> & {
|
|
20
20
|
[TYPE]: AddressMapEntryType.STATIC;
|
|
21
21
|
};
|
|
22
22
|
declare const TYPE: unique symbol;
|
|
23
23
|
export declare const ADDRESS_MAP_TYPE_PROPERTY: typeof TYPE;
|
|
24
|
-
export declare function getAddressMapFromInstructions(feePayer: Address, instructions: readonly
|
|
24
|
+
export declare function getAddressMapFromInstructions(feePayer: Address, instructions: readonly IInstruction[]): AddressMap;
|
|
25
25
|
export declare function getOrderedAccountsFromAddressMap(addressMap: AddressMap): OrderedAccounts;
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/compile/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAMlE,OAAO,
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/compile/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAMlE,OAAO,EAEH,kBAAkB,EAClB,YAAY,EACZ,YAAY,EAIZ,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,0BAAkB,mBAAmB;IACjC,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,MAAM,IAAA;CACT;AAED,KAAK,UAAU,GAAG;IACd,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,kBAAkB,CAAC;CAC1F,CAAC;AACF,KAAK,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG;IACjE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;CACzC,CAAC;AACF,KAAK,uBAAuB,GAAG,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,EAAE,SAAS,CAAC,GAAG;IAC5F,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC;CAC5C,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,kBAAkB,GAAG,YAAY,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC9F,KAAK,kBAAkB,GAAG,IAAI,CAC1B,eAAe,GAAG,qBAAqB,GAAG,eAAe,GAAG,qBAAqB,EACjF,SAAS,CACZ,GAAG;IAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAA;CAAE,CAAC;AAY3C,QAAA,MAAM,IAAI,eAAmC,CAAC;AAC9C,eAAO,MAAM,yBAAyB,EAAE,OAAO,IAAW,CAAC;AAE3D,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,YAAY,EAAE,GAAG,UAAU,CA6IlH;AAED,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,CA0CxF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReadonlyUint8Array } from '@solana/codecs-core';
|
|
2
|
-
import {
|
|
2
|
+
import { IInstruction } from '@solana/instructions';
|
|
3
3
|
import { OrderedAccounts } from './accounts';
|
|
4
4
|
type CompiledInstruction = Readonly<{
|
|
5
5
|
/**
|
|
@@ -15,6 +15,6 @@ type CompiledInstruction = Readonly<{
|
|
|
15
15
|
*/
|
|
16
16
|
programAddressIndex: number;
|
|
17
17
|
}>;
|
|
18
|
-
export declare function getCompiledInstructions(instructions: readonly
|
|
18
|
+
export declare function getCompiledInstructions(instructions: readonly IInstruction[], orderedAccounts: OrderedAccounts): CompiledInstruction[];
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -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,
|
|
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"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAccountLookupMeta, IAccountMeta, IInstruction } from '@solana/instructions';
|
|
2
2
|
import { AddressesByLookupTableAddress } from './addresses-by-lookup-table-address';
|
|
3
3
|
import { BaseTransactionMessage, TransactionMessage } from './transaction-message';
|
|
4
4
|
type TransactionMessageNotLegacy = Exclude<TransactionMessage, {
|
|
5
5
|
version: 'legacy';
|
|
6
6
|
}>;
|
|
7
|
-
type WidenInstructionAccounts<TInstruction extends
|
|
8
|
-
[K in keyof TAccounts]: TAccounts[K] extends
|
|
7
|
+
type WidenInstructionAccounts<TInstruction extends IInstruction> = TInstruction extends IInstruction<infer TProgramAddress, infer TAccounts> ? IInstruction<TProgramAddress, {
|
|
8
|
+
[K in keyof TAccounts]: TAccounts[K] extends IAccountMeta<infer TAddress> ? IAccountLookupMeta<TAddress> | IAccountMeta<TAddress> : TAccounts[K];
|
|
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
12
|
/**
|
|
13
13
|
* Given a transaction message and a mapping of lookup tables to the addresses stored in them, this
|
|
14
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
|
|
16
|
-
* instead of an {@link
|
|
15
|
+
* accounts that are found in the given lookup tables represented by an {@link IAccountLookupMeta}
|
|
16
|
+
* instead of an {@link IAccountMeta}.
|
|
17
17
|
*
|
|
18
18
|
* This means that these accounts will take up less space in the compiled transaction message. This
|
|
19
19
|
* size reduction is most significant when the transaction includes many accounts from the same
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compress-transaction-message.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"compress-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compress-transaction-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAEjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA0BnF,KAAK,2BAA2B,GAAG,OAAO,CAAC,kBAAkB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAGtF,KAAK,wBAAwB,CAAC,YAAY,SAAS,YAAY,IAC3D,YAAY,SAAS,YAAY,CAAC,MAAM,eAAe,EAAE,MAAM,SAAS,CAAC,GACnE,YAAY,CACR,eAAe,EACf;KACK,CAAC,IAAI,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,QAAQ,CAAC,GACnE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,GACrD,SAAS,CAAC,CAAC,CAAC;CACrB,CACJ,GACD,YAAY,CAAC;AAEvB,KAAK,sBAAsB,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAErD,KAAK,mCAAmC,CAAC,mBAAmB,SAAS,kBAAkB,IACnF,mBAAmB,SAAS,sBAAsB,CAAC,MAAM,QAAQ,EAAE,MAAM,YAAY,CAAC,GAChF,sBAAsB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC,GACpE,sBAAsB,CAClB,mBAAmB,EACnB,sBAAsB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC,CAC3E,GACL,mBAAmB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { TransactionMessage, TransactionVersion } from './transaction-message';
|
|
2
|
-
import { TransactionMessageWithinSizeLimit } from './transaction-message-size';
|
|
3
2
|
type TransactionConfig<TVersion extends TransactionVersion> = Readonly<{
|
|
4
3
|
version: TVersion;
|
|
5
4
|
}>;
|
|
6
|
-
type EmptyTransactionMessage<TVersion extends TransactionVersion> = Omit<Extract<TransactionMessage, {
|
|
7
|
-
version: TVersion;
|
|
8
|
-
}>, 'instructions'> & TransactionMessageWithinSizeLimit & {
|
|
9
|
-
instructions: readonly [];
|
|
10
|
-
};
|
|
11
5
|
/**
|
|
12
6
|
* Given a {@link TransactionVersion} this method will return an empty transaction having the
|
|
13
7
|
* capabilities of that version.
|
|
@@ -19,6 +13,8 @@ type EmptyTransactionMessage<TVersion extends TransactionVersion> = Omit<Extract
|
|
|
19
13
|
* const message = createTransactionMessage({ version: 0 });
|
|
20
14
|
* ```
|
|
21
15
|
*/
|
|
22
|
-
export declare function createTransactionMessage<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>):
|
|
16
|
+
export declare function createTransactionMessage<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>): Extract<TransactionMessage, {
|
|
17
|
+
version: TVersion;
|
|
18
|
+
}>;
|
|
23
19
|
export {};
|
|
24
20
|
//# sourceMappingURL=create-transaction-message.d.ts.map
|
|
@@ -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;
|
|
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"}
|
|
@@ -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;
|
|
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;AA+KvD,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"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Address } from '@solana/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
|
|
3
3
|
import { Brand } from '@solana/nominal-types';
|
|
4
|
-
import { AdvanceNonceAccountInstruction } from './durable-nonce-instruction';
|
|
5
|
-
import { ExcludeTransactionMessageLifetime } from './lifetime';
|
|
6
4
|
import { BaseTransactionMessage } from './transaction-message';
|
|
7
|
-
|
|
5
|
+
type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = IInstruction<'11111111111111111111111111111111'> & IInstructionWithAccounts<readonly [
|
|
6
|
+
WritableAccount<TNonceAccountAddress>,
|
|
7
|
+
ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,
|
|
8
|
+
ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>
|
|
9
|
+
]> & IInstructionWithData<AdvanceNonceAccountInstructionData>;
|
|
10
|
+
type AdvanceNonceAccountInstructionData = Brand<Uint8Array, 'AdvanceNonceAccountInstructionData'>;
|
|
8
11
|
type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Readonly<{
|
|
9
12
|
readonly nonce: Nonce<TNonceValue>;
|
|
10
13
|
readonly nonceAccountAddress: Address<TNonceAccountAddress>;
|
|
@@ -38,14 +41,51 @@ type NonceLifetimeConstraint<TNonceValue extends string = string> = Readonly<{
|
|
|
38
41
|
export interface TransactionMessageWithDurableNonceLifetime<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> {
|
|
39
42
|
readonly instructions: readonly [
|
|
40
43
|
AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,
|
|
41
|
-
...
|
|
44
|
+
...IInstruction[]
|
|
42
45
|
];
|
|
43
46
|
readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* From time to time you might acquire a transaction message, that you expect to have a
|
|
50
|
+
* nonce-based lifetime, from an untrusted network API or user input. Use this function to assert
|
|
51
|
+
* that such a transaction message actually has a nonce-based lifetime.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { assertIsDurableNonceTransactionMessage } from '@solana/transaction-messages';
|
|
56
|
+
*
|
|
57
|
+
* try {
|
|
58
|
+
* // If this type assertion function doesn't throw, then
|
|
59
|
+
* // Typescript will upcast `message` to `TransactionMessageWithDurableNonceLifetime`.
|
|
60
|
+
* assertIsDurableNonceTransactionMessage(message);
|
|
61
|
+
* // At this point, `message` is a `TransactionMessageWithDurableNonceLifetime` that can be used
|
|
62
|
+
* // with the RPC.
|
|
63
|
+
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
64
|
+
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
65
|
+
* } catch (e) {
|
|
66
|
+
* // `message` turned out not to have a nonce-based lifetime
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function assertIsDurableNonceTransactionMessage(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): asserts transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
|
|
71
|
+
/**
|
|
72
|
+
* A type guard that returns `true` if the instruction conforms to the
|
|
73
|
+
* {@link AdvanceNonceAccountInstruction} type, and refines its type for use in your program.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { isAdvanceNonceAccountInstruction } from '@solana/transaction-messages';
|
|
78
|
+
*
|
|
79
|
+
* if (isAdvanceNonceAccountInstruction(message.instructions[0])) {
|
|
80
|
+
* // At this point, the first instruction in the message has been refined to a
|
|
81
|
+
* // `AdvanceNonceAccountInstruction`.
|
|
82
|
+
* setNonceAccountAddress(message.instructions[0].accounts[0].address);
|
|
83
|
+
* } else {
|
|
84
|
+
* setError('The first instruction is not an `AdvanceNonce` instruction');
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
47
87
|
*/
|
|
48
|
-
export
|
|
88
|
+
export declare function isAdvanceNonceAccountInstruction(instruction: IInstruction): instruction is AdvanceNonceAccountInstruction;
|
|
49
89
|
/**
|
|
50
90
|
* A type guard that returns `true` if the transaction message conforms to the
|
|
51
91
|
* {@link TransactionMessageWithDurableNonceLifetime} type, and refines its type for use in your
|
|
@@ -69,30 +109,7 @@ export type ExcludeTransactionMessageDurableNonceLifetime<TTransactionMessage ex
|
|
|
69
109
|
* }
|
|
70
110
|
* ```
|
|
71
111
|
*/
|
|
72
|
-
export declare function
|
|
73
|
-
/**
|
|
74
|
-
* From time to time you might acquire a transaction message, that you expect to have a
|
|
75
|
-
* nonce-based lifetime, from an untrusted network API or user input. Use this function to assert
|
|
76
|
-
* that such a transaction message actually has a nonce-based lifetime.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```ts
|
|
80
|
-
* import { assertIsDurableNonceTransactionMessage } from '@solana/transaction-messages';
|
|
81
|
-
*
|
|
82
|
-
* try {
|
|
83
|
-
* // If this type assertion function doesn't throw, then
|
|
84
|
-
* // Typescript will upcast `message` to `TransactionMessageWithDurableNonceLifetime`.
|
|
85
|
-
* assertIsDurableNonceTransactionMessage(message);
|
|
86
|
-
* // At this point, `message` is a `TransactionMessageWithDurableNonceLifetime` that can be used
|
|
87
|
-
* // with the RPC.
|
|
88
|
-
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
89
|
-
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
90
|
-
* } catch (e) {
|
|
91
|
-
* // `message` turned out not to have a nonce-based lifetime
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function assertIsTransactionMessageWithDurableNonceLifetime(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): asserts transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
|
|
112
|
+
export declare function isDurableNonceTransaction(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
|
|
96
113
|
/**
|
|
97
114
|
* Given a nonce, the account where the value of the nonce is stored, and the address of the account
|
|
98
115
|
* authorized to consume that nonce, this method will return a new transaction having the same type
|
|
@@ -132,21 +149,6 @@ export declare function assertIsTransactionMessageWithDurableNonceLifetime(trans
|
|
|
132
149
|
* );
|
|
133
150
|
* ```
|
|
134
151
|
*/
|
|
135
|
-
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):
|
|
136
|
-
/**
|
|
137
|
-
* Helper type that transforms a given transaction message type into a new one that has the
|
|
138
|
-
* `AdvanceNonceAccount` instruction as the first instruction and a lifetime constraint
|
|
139
|
-
* representing the nonce value.
|
|
140
|
-
*/
|
|
141
|
-
type SetTransactionMessageWithDurableNonceLifetime<TTransactionMessage extends BaseTransactionMessage, TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Omit<TTransactionMessage extends TransactionMessageWithDurableNonceLifetime ? TTransactionMessage : ExcludeTransactionMessageWithinSizeLimit<TTransactionMessage>, 'instructions'> & {
|
|
142
|
-
readonly instructions: TTransactionMessage['instructions'] extends readonly [
|
|
143
|
-
AdvanceNonceAccountInstruction,
|
|
144
|
-
...infer TTail extends readonly Instruction[]
|
|
145
|
-
] ? readonly [AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>, ...TTail] : readonly [
|
|
146
|
-
AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,
|
|
147
|
-
...TTransactionMessage['instructions']
|
|
148
|
-
];
|
|
149
|
-
readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;
|
|
150
|
-
};
|
|
152
|
+
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;
|
|
151
153
|
export {};
|
|
152
154
|
//# 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;
|
|
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;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,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,KAAK,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;AAClG,KAAK,kBAAkB,CACnB,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM,IACnC,QAAQ,CAAC;IACT,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACnE,CAAC,CAAC;AACH,gGAAgG;AAChG,MAAM,MAAM,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACrF;;;;;;;GAOG;AACH,KAAK,uBAAuB,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IACzE;;;;;OAKG;IACH,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7B,CAAC,CAAC;AAMH;;;;;GAKG;AACH,MAAM,WAAW,0CAA0C,CACvD,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM;IAEnC,QAAQ,CAAC,YAAY,EAAE,SAAS;QAE5B,8BAA8B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;QAC5E,GAAG,YAAY,EAAE;KACpB,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CACrE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sCAAsC,CAClD,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,0CAA0C,CAAC,GACnH,OAAO,CAAC,kBAAkB,IAAI,sBAAsB,GAAG,0CAA0C,CAInG;AAoCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,YAAY,GAC1B,WAAW,IAAI,8BAA8B,CAkB/C;AAOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACrC,kBAAkB,EAAE,sBAAsB,GAAG,CAAC,sBAAsB,GAAG,0CAA0C,CAAC,GACnH,kBAAkB,IAAI,sBAAsB,GAAG,0CAA0C,CAO3F;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,8CAA8C,CAC1D,mBAAmB,SAAS,sBAAsB,EAClD,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,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"}
|
|
@@ -4,18 +4,14 @@ import { BaseTransactionMessage } from './transaction-message';
|
|
|
4
4
|
* Represents a transaction message for which a fee payer has been declared. A transaction must
|
|
5
5
|
* conform to this type to be compiled and landed on the network.
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ITransactionMessageWithFeePayer<TAddress extends string = string> {
|
|
8
8
|
readonly feePayer: Readonly<{
|
|
9
9
|
address: Address<TAddress>;
|
|
10
10
|
}>;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* A helper type to exclude the fee payer from a transaction message.
|
|
14
|
-
*/
|
|
15
|
-
type ExcludeTransactionMessageFeePayer<TTransactionMessage extends BaseTransactionMessage> = Omit<TTransactionMessage, 'feePayer'>;
|
|
16
12
|
/**
|
|
17
13
|
* Given a base58-encoded address of a system account, this method will return a new transaction
|
|
18
|
-
* message having the same type as the one supplied plus the {@link
|
|
14
|
+
* message having the same type as the one supplied plus the {@link ITransactionMessageWithFeePayer}
|
|
19
15
|
* type.
|
|
20
16
|
*
|
|
21
17
|
* @example
|
|
@@ -27,6 +23,5 @@ type ExcludeTransactionMessageFeePayer<TTransactionMessage extends BaseTransacti
|
|
|
27
23
|
* const txPaidByMe = setTransactionMessageFeePayer(myAddress, tx);
|
|
28
24
|
* ```
|
|
29
25
|
*/
|
|
30
|
-
export declare function setTransactionMessageFeePayer<TFeePayerAddress extends string, TTransactionMessage extends BaseTransactionMessage & Partial<
|
|
31
|
-
export {};
|
|
26
|
+
export declare function setTransactionMessageFeePayer<TFeePayerAddress extends string, TTransactionMessage extends BaseTransactionMessage & Partial<ITransactionMessageWithFeePayer>>(feePayer: Address<TFeePayerAddress>, transactionMessage: TTransactionMessage): ITransactionMessageWithFeePayer<TFeePayerAddress> & Omit<TTransactionMessage, 'feePayer'>;
|
|
32
27
|
//# sourceMappingURL=fee-payer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-payer.d.ts","sourceRoot":"","sources":["../../src/fee-payer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"fee-payer.d.ts","sourceRoot":"","sources":["../../src/fee-payer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,+BAA+B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC7E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CACzC,gBAAgB,SAAS,MAAM,EAC/B,mBAAmB,SAAS,sBAAsB,GAAG,OAAO,CAAC,+BAA+B,CAAC,EAE7F,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACnC,kBAAkB,EAAE,mBAAmB,GACxC,+BAA+B,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAe3F"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -36,10 +36,7 @@ export * from './compress-transaction-message';
|
|
|
36
36
|
export * from './create-transaction-message';
|
|
37
37
|
export * from './decompile-message';
|
|
38
38
|
export * from './durable-nonce';
|
|
39
|
-
export { isAdvanceNonceAccountInstruction } from './durable-nonce-instruction';
|
|
40
39
|
export * from './fee-payer';
|
|
41
40
|
export * from './instructions';
|
|
42
|
-
export * from './transaction-message-size';
|
|
43
41
|
export * from './transaction-message';
|
|
44
|
-
export * from './deprecated';
|
|
45
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kCAAkC,CAAC;AACjD,cAAc,WAAW,CAAC;AAC1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kCAAkC,CAAC;AACjD,cAAc,WAAW,CAAC;AAC1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ExcludeTransactionMessageDurableNonceLifetime } from './durable-nonce';
|
|
1
|
+
import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
3
2
|
import { BaseTransactionMessage } from './transaction-message';
|
|
4
|
-
import { ExcludeTransactionMessageWithinSizeLimit } from './transaction-message-size';
|
|
5
|
-
/**
|
|
6
|
-
* A helper type to append instructions to a transaction message
|
|
7
|
-
* without losing type information about the current instructions.
|
|
8
|
-
*/
|
|
9
|
-
type AppendTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage, TInstructions extends readonly Instruction[]> = Omit<ExcludeTransactionMessageWithinSizeLimit<TTransactionMessage>, 'instructions'> & {
|
|
10
|
-
readonly instructions: readonly [...TTransactionMessage['instructions'], ...TInstructions];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* A helper type to prepend instructions to a transaction message
|
|
14
|
-
* without losing type information about the current instructions.
|
|
15
|
-
*/
|
|
16
|
-
type PrependTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage, TInstructions extends readonly Instruction[]> = Omit<ExcludeTransactionMessageWithinSizeLimit<ExcludeTransactionMessageDurableNonceLifetime<TTransactionMessage>>, 'instructions'> & {
|
|
17
|
-
readonly instructions: readonly [...TInstructions, ...TTransactionMessage['instructions']];
|
|
18
|
-
};
|
|
19
3
|
/**
|
|
20
4
|
* Given an instruction, this method will return a new transaction message with that instruction
|
|
21
5
|
* having been added to the end of the list of existing instructions.
|
|
@@ -37,7 +21,7 @@ type PrependTransactionMessageInstructions<TTransactionMessage extends BaseTrans
|
|
|
37
21
|
* );
|
|
38
22
|
* ```
|
|
39
23
|
*/
|
|
40
|
-
export declare function appendTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage
|
|
24
|
+
export declare function appendTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage>(instruction: TTransactionMessage['instructions'][number], transactionMessage: TTransactionMessage): TTransactionMessage;
|
|
41
25
|
/**
|
|
42
26
|
* Given an array of instructions, this method will return a new transaction message with those
|
|
43
27
|
* instructions having been added to the end of the list of existing instructions.
|
|
@@ -65,7 +49,8 @@ export declare function appendTransactionMessageInstruction<TTransactionMessage
|
|
|
65
49
|
* );
|
|
66
50
|
* ```
|
|
67
51
|
*/
|
|
68
|
-
export declare function appendTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage
|
|
52
|
+
export declare function appendTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage>(instructions: ReadonlyArray<TTransactionMessage['instructions'][number]>, transactionMessage: TTransactionMessage): TTransactionMessage;
|
|
53
|
+
type ExcludeDurableNonce<T> = T extends TransactionMessageWithDurableNonceLifetime ? BaseTransactionMessage & Omit<T, keyof TransactionMessageWithDurableNonceLifetime> : T;
|
|
69
54
|
/**
|
|
70
55
|
* Given an instruction, this method will return a new transaction message with that instruction
|
|
71
56
|
* having been added to the beginning of the list of existing instructions.
|
|
@@ -87,7 +72,7 @@ export declare function appendTransactionMessageInstructions<TTransactionMessage
|
|
|
87
72
|
* );
|
|
88
73
|
* ```
|
|
89
74
|
*/
|
|
90
|
-
export declare function prependTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage
|
|
75
|
+
export declare function prependTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage>(instruction: TTransactionMessage['instructions'][number], transactionMessage: TTransactionMessage): ExcludeDurableNonce<TTransactionMessage>;
|
|
91
76
|
/**
|
|
92
77
|
* Given an array of instructions, this method will return a new transaction message with those
|
|
93
78
|
* instructions having been added to the beginning of the list of existing instructions.
|
|
@@ -115,6 +100,6 @@ export declare function prependTransactionMessageInstruction<TTransactionMessage
|
|
|
115
100
|
* );
|
|
116
101
|
* ```
|
|
117
102
|
*/
|
|
118
|
-
export declare function prependTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage
|
|
103
|
+
export declare function prependTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage>(instructions: ReadonlyArray<TTransactionMessage['instructions'][number]>, transactionMessage: TTransactionMessage): ExcludeDurableNonce<TTransactionMessage>;
|
|
119
104
|
export {};
|
|
120
105
|
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mCAAmC,CAAC,mBAAmB,SAAS,sBAAsB,EAClG,WAAW,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,EACxD,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAErB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oCAAoC,CAAC,mBAAmB,SAAS,sBAAsB,EACnG,YAAY,EAAE,aAAa,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,EACxE,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAKrB;AAID,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,0CAA0C,GAC5E,sBAAsB,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,0CAA0C,CAAC,GAClF,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oCAAoC,CAAC,mBAAmB,SAAS,sBAAsB,EACnG,WAAW,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,EACxD,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAAC,mBAAmB,CAAC,CAE1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qCAAqC,CAAC,mBAAmB,SAAS,sBAAsB,EACpG,YAAY,EAAE,aAAa,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,EACxE,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAAC,mBAAmB,CAAC,CAK1C"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type BaseTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends
|
|
1
|
+
import { IAccountMeta, IInstruction } from '@solana/instructions';
|
|
2
|
+
export type BaseTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = Readonly<{
|
|
3
3
|
instructions: readonly TInstruction[];
|
|
4
4
|
version: TVersion;
|
|
5
5
|
}>;
|
|
6
|
-
type
|
|
7
|
-
type LegacyTransactionMessage = BaseTransactionMessage<'legacy',
|
|
8
|
-
type V0TransactionMessage = BaseTransactionMessage<0,
|
|
6
|
+
type ILegacyInstruction<TProgramAddress extends string = string> = IInstruction<TProgramAddress, readonly IAccountMeta[]>;
|
|
7
|
+
type LegacyTransactionMessage = BaseTransactionMessage<'legacy', ILegacyInstruction>;
|
|
8
|
+
type V0TransactionMessage = BaseTransactionMessage<0, IInstruction>;
|
|
9
9
|
export type TransactionMessage = LegacyTransactionMessage | V0TransactionMessage;
|
|
10
10
|
export type TransactionVersion = 'legacy' | 0;
|
|
11
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-message.d.ts","sourceRoot":"","sources":["../../src/transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"transaction-message.d.ts","sourceRoot":"","sources":["../../src/transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,MAAM,MAAM,sBAAsB,CAC9B,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,QAAQ,CAAC;IACT,YAAY,EAAE,SAAS,YAAY,EAAE,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,KAAK,kBAAkB,CAAC,eAAe,SAAS,MAAM,GAAG,MAAM,IAAI,YAAY,CAC3E,eAAe,EACf,SAAS,YAAY,EAAE,CAC1B,CAAC;AACF,KAAK,wBAAwB,GAAG,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACrF,KAAK,oBAAoB,GAAG,sBAAsB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,oBAAoB,CAAC;AACjF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/transaction-messages",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Helpers for creating transaction messages",
|
|
5
5
|
"exports": {
|
|
6
6
|
"edge-light": {
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"maintained node versions"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@solana/addresses": "2.2.
|
|
58
|
-
"@solana/codecs-
|
|
59
|
-
"@solana/codecs-
|
|
60
|
-
"@solana/
|
|
61
|
-
"@solana/
|
|
62
|
-
"@solana/
|
|
63
|
-
"@solana/
|
|
64
|
-
"@solana/
|
|
65
|
-
"@solana/
|
|
57
|
+
"@solana/addresses": "2.2.1",
|
|
58
|
+
"@solana/codecs-core": "2.2.1",
|
|
59
|
+
"@solana/codecs-data-structures": "2.2.1",
|
|
60
|
+
"@solana/errors": "2.2.1",
|
|
61
|
+
"@solana/codecs-numbers": "2.2.1",
|
|
62
|
+
"@solana/instructions": "2.2.1",
|
|
63
|
+
"@solana/functional": "2.2.1",
|
|
64
|
+
"@solana/rpc-types": "2.2.1",
|
|
65
|
+
"@solana/nominal-types": "2.2.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"typescript": ">=5.3.3"
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@solana/addresses';
|
|
2
|
-
import { assertIsTransactionMessageWithDurableNonceLifetime, isTransactionMessageWithDurableNonceLifetime } from './durable-nonce';
|
|
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
|
-
*
|
|
7
|
-
* @deprecated Use {@link TransactionMessageWithFeePayer} instead. It was only renamed.
|
|
8
|
-
*/
|
|
9
|
-
export interface ITransactionMessageWithFeePayer<TAddress extends string = string> {
|
|
10
|
-
readonly feePayer: Readonly<{
|
|
11
|
-
address: Address<TAddress>;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* From time to time you might acquire a transaction message, that you expect to have a
|
|
16
|
-
* nonce-based lifetime, from an untrusted network API or user input. Use this function to assert
|
|
17
|
-
* that such a transaction message actually has a nonce-based lifetime.
|
|
18
|
-
*
|
|
19
|
-
* @deprecated Use {@link assertIsTransactionMessageWithDurableNonceLifetime} instead. It was only renamed.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* import { assertIsDurableNonceTransactionMessage } from '@solana/transaction-messages';
|
|
24
|
-
*
|
|
25
|
-
* try {
|
|
26
|
-
* // If this type assertion function doesn't throw, then
|
|
27
|
-
* // Typescript will upcast `message` to `TransactionMessageWithDurableNonceLifetime`.
|
|
28
|
-
* assertIsDurableNonceTransactionMessage(message);
|
|
29
|
-
* // At this point, `message` is a `TransactionMessageWithDurableNonceLifetime` that can be used
|
|
30
|
-
* // with the RPC.
|
|
31
|
-
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
32
|
-
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
33
|
-
* } catch (e) {
|
|
34
|
-
* // `message` turned out not to have a nonce-based lifetime
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare const assertIsDurableNonceTransactionMessage: typeof assertIsTransactionMessageWithDurableNonceLifetime;
|
|
39
|
-
/**
|
|
40
|
-
* A type guard that returns `true` if the transaction message conforms to the
|
|
41
|
-
* {@link TransactionMessageWithDurableNonceLifetime} type, and refines its type for use in your
|
|
42
|
-
* program.
|
|
43
|
-
*
|
|
44
|
-
* @deprecated Use {@link isTransactionMessageWithDurableNonceLifetime} instead. It was only renamed.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* import { isDurableNonceTransaction } from '@solana/transaction-messages';
|
|
49
|
-
* import { fetchNonce } from "@solana-program/system";
|
|
50
|
-
*
|
|
51
|
-
* if (isDurableNonceTransaction(message)) {
|
|
52
|
-
* // At this point, `message` has been refined to a
|
|
53
|
-
* // `TransactionMessageWithDurableNonceLifetime`.
|
|
54
|
-
* const { nonce, nonceAccountAddress } = message.lifetimeConstraint;
|
|
55
|
-
* const { data: { blockhash: actualNonce } } = await fetchNonce(nonceAccountAddress);
|
|
56
|
-
* setNonceIsValid(nonce === actualNonce);
|
|
57
|
-
* } else {
|
|
58
|
-
* setError(
|
|
59
|
-
* `${getSignatureFromTransaction(transaction)} does not have a nonce-based lifetime`,
|
|
60
|
-
* );
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare const isDurableNonceTransaction: typeof isTransactionMessageWithDurableNonceLifetime;
|
|
65
|
-
//# sourceMappingURL=deprecated.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACH,kDAAkD,EAClD,4CAA4C,EAC/C,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC7E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sCAAsC,2DAAqD,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB,qDAA+C,CAAC"}
|