@solana/transaction-messages 2.2.0 → 2.3.0-canary-20250708185953

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.
Files changed (43) hide show
  1. package/README.md +9 -9
  2. package/dist/index.browser.cjs +34 -32
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.mjs +34 -34
  5. package/dist/index.browser.mjs.map +1 -1
  6. package/dist/index.native.mjs +34 -34
  7. package/dist/index.native.mjs.map +1 -1
  8. package/dist/index.node.cjs +34 -32
  9. package/dist/index.node.cjs.map +1 -1
  10. package/dist/index.node.mjs +34 -34
  11. package/dist/index.node.mjs.map +1 -1
  12. package/dist/types/blockhash.d.ts +2 -3
  13. package/dist/types/blockhash.d.ts.map +1 -1
  14. package/dist/types/compilable-transaction-message.d.ts +4 -5
  15. package/dist/types/compilable-transaction-message.d.ts.map +1 -1
  16. package/dist/types/compile/accounts.d.ts +3 -3
  17. package/dist/types/compile/accounts.d.ts.map +1 -1
  18. package/dist/types/compile/instructions.d.ts +2 -2
  19. package/dist/types/compile/instructions.d.ts.map +1 -1
  20. package/dist/types/compress-transaction-message.d.ts +5 -5
  21. package/dist/types/compress-transaction-message.d.ts.map +1 -1
  22. package/dist/types/create-transaction-message.d.ts +7 -3
  23. package/dist/types/create-transaction-message.d.ts.map +1 -1
  24. package/dist/types/decompile-message.d.ts.map +1 -1
  25. package/dist/types/deprecated.d.ts +65 -0
  26. package/dist/types/deprecated.d.ts.map +1 -0
  27. package/dist/types/durable-nonce-instruction.d.ts +43 -0
  28. package/dist/types/durable-nonce-instruction.d.ts.map +1 -0
  29. package/dist/types/durable-nonce.d.ts +47 -49
  30. package/dist/types/durable-nonce.d.ts.map +1 -1
  31. package/dist/types/fee-payer.d.ts +8 -3
  32. package/dist/types/fee-payer.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +3 -0
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/instructions.d.ts +21 -6
  36. package/dist/types/instructions.d.ts.map +1 -1
  37. package/dist/types/lifetime.d.ts +12 -0
  38. package/dist/types/lifetime.d.ts.map +1 -0
  39. package/dist/types/transaction-message-size.d.ts +13 -0
  40. package/dist/types/transaction-message-size.d.ts.map +1 -0
  41. package/dist/types/transaction-message.d.ts +5 -5
  42. package/dist/types/transaction-message.d.ts.map +1 -1
  43. package/package.json +10 -10
@@ -1,5 +1,5 @@
1
1
  import { type Blockhash } from '@solana/rpc-types';
2
- import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
2
+ import { ExcludeTransactionMessageLifetime, TransactionMessageWithLifetime } from './lifetime';
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,7 +92,6 @@ export declare function assertIsTransactionMessageWithBlockhashLifetime(transact
92
92
  * const txMessageWithBlockhashLifetime = setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, txMessage);
93
93
  * ```
94
94
  */
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;
95
+ export declare function setTransactionMessageLifetimeUsingBlockhash<TTransactionMessage extends BaseTransactionMessage & Partial<TransactionMessageWithLifetime>>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transactionMessage: TTransactionMessage): ExcludeTransactionMessageLifetime<TTransactionMessage> & TransactionMessageWithBlockhashLifetime;
97
96
  export {};
98
97
  //# sourceMappingURL=blockhash.d.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ACxD,kBAAkB,EAAE,mBAAmB,GACxC,uCAAuC,GAAG,mBAAmB,CAAC"}
1
+ {"version":3,"file":"blockhash.d.ts","sourceRoot":"","sources":["../../src/blockhash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,iCAAiC,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC/F,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,CAOxF;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,OAAO,CAAC,8BAA8B,CAAC,EAE5F,2BAA2B,EAAE,2BAA2B,EACxD,kBAAkB,EAAE,mBAAmB,GACxC,iCAAiC,CAAC,mBAAmB,CAAC,GAAG,uCAAuC,CAiBlG"}
@@ -1,12 +1,11 @@
1
- import { IInstruction } from '@solana/instructions';
2
- import { TransactionMessageWithBlockhashLifetime } from './blockhash';
3
- import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
4
- import { ITransactionMessageWithFeePayer } from './fee-payer';
1
+ import { Instruction } from '@solana/instructions';
2
+ import { TransactionMessageWithFeePayer } from './fee-payer';
3
+ import { TransactionMessageWithLifetime } from './lifetime';
5
4
  import { BaseTransactionMessage, TransactionVersion } from './transaction-message';
6
5
  /**
7
6
  * A transaction message having sufficient detail to be compiled for execution on the network.
8
7
  *
9
8
  * In essence, this means that it has at minimum a version, a fee payer, and a lifetime constraint.
10
9
  */
11
- export type CompilableTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = BaseTransactionMessage<TVersion, TInstruction> & ITransactionMessageWithFeePayer & (TransactionMessageWithBlockhashLifetime | TransactionMessageWithDurableNonceLifetime);
10
+ export type CompilableTransactionMessage<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends Instruction = Instruction> = BaseTransactionMessage<TVersion, TInstruction> & TransactionMessageWithFeePayer & TransactionMessageWithLifetime;
12
11
  //# 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;;;;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
+ {"version":3,"file":"compilable-transaction-message.d.ts","sourceRoot":"","sources":["../../src/compilable-transaction-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,CACpC,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,WAAW,GAAG,WAAW,IAC9C,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,8BAA8B,GAAG,8BAA8B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Address } from '@solana/addresses';
2
- import { IAccountLookupMeta, IAccountMeta, IInstruction, ReadonlyAccount, ReadonlyAccountLookup, ReadonlySignerAccount, WritableAccount, WritableAccountLookup, WritableSignerAccount } from '@solana/instructions';
2
+ import { AccountLookupMeta, AccountMeta, Instruction, 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<(IAccountLookupMeta | IAccountMeta)[], 'OrderedAccounts'>;
18
+ export type OrderedAccounts = Brand<(AccountLookupMeta | AccountMeta)[], '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 IInstruction[]): AddressMap;
24
+ export declare function getAddressMapFromInstructions(feePayer: Address, instructions: readonly Instruction[]): 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,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,CAA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BAAmB,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,iBAAiB,GAAG,WAAW,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC5F,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,WAAW,EAAE,GAAG,UAAU,CA6IjH;AAED,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,CA0CxF"}
@@ -1,5 +1,5 @@
1
1
  import { ReadonlyUint8Array } from '@solana/codecs-core';
2
- import { IInstruction } from '@solana/instructions';
2
+ import { Instruction } 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 IInstruction[], orderedAccounts: OrderedAccounts): CompiledInstruction[];
18
+ export declare function getCompiledInstructions(instructions: readonly Instruction[], 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,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
+ {"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,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,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,WAAW,EAAE,EACpC,eAAe,EAAE,eAAe,GACjC,mBAAmB,EAAE,CASvB"}
@@ -1,19 +1,19 @@
1
- import { IAccountLookupMeta, IAccountMeta, IInstruction } from '@solana/instructions';
1
+ import { AccountLookupMeta, AccountMeta, Instruction } 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 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];
7
+ type WidenInstructionAccounts<TInstruction extends Instruction> = TInstruction extends Instruction<infer TProgramAddress, infer TAccounts> ? Instruction<TProgramAddress, {
8
+ [K in keyof TAccounts]: TAccounts[K] extends AccountMeta<infer TAddress> ? AccountLookupMeta<TAddress> | AccountMeta<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 IAccountLookupMeta}
16
- * instead of an {@link IAccountMeta}.
15
+ * accounts that are found in the given lookup tables represented by an {@link AccountLookupMeta}
16
+ * instead of an {@link AccountMeta}.
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,EAAe,kBAAkB,EAAE,YAAY,EAAE,YAAY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BAAgB,kDAAkD,CAC9D,mBAAmB,SAAS,2BAA2B,GAAG,2BAA2B,EAErF,kBAAkB,EAAE,mBAAmB,EACvC,6BAA6B,EAAE,6BAA6B,GAC7D,mBAAmB,GAAG,mCAAmC,CAAC,mBAAmB,CAAC,CA2ChF"}
@@ -1,7 +1,13 @@
1
1
  import { TransactionMessage, TransactionVersion } from './transaction-message';
2
+ import { TransactionMessageWithinSizeLimit } from './transaction-message-size';
2
3
  type TransactionConfig<TVersion extends TransactionVersion> = Readonly<{
3
4
  version: TVersion;
4
5
  }>;
6
+ type EmptyTransactionMessage<TVersion extends TransactionVersion> = Omit<Extract<TransactionMessage, {
7
+ version: TVersion;
8
+ }>, 'instructions'> & TransactionMessageWithinSizeLimit & {
9
+ instructions: readonly [];
10
+ };
5
11
  /**
6
12
  * Given a {@link TransactionVersion} this method will return an empty transaction having the
7
13
  * capabilities of that version.
@@ -13,8 +19,6 @@ type TransactionConfig<TVersion extends TransactionVersion> = Readonly<{
13
19
  * const message = createTransactionMessage({ version: 0 });
14
20
  * ```
15
21
  */
16
- export declare function createTransactionMessage<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>): Extract<TransactionMessage, {
17
- version: TVersion;
18
- }>;
22
+ export declare function createTransactionMessage<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>): EmptyTransactionMessage<TVersion>;
19
23
  export {};
20
24
  //# 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;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
+ {"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;AAC/E,OAAO,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAE/E,KAAK,iBAAiB,CAAC,QAAQ,SAAS,kBAAkB,IAAI,QAAQ,CAAC;IACnE,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,KAAK,uBAAuB,CAAC,QAAQ,SAAS,kBAAkB,IAAI,IAAI,CACpE,OAAO,CAAC,kBAAkB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,EAClD,cAAc,CACjB,GACG,iCAAiC,GAAG;IAAE,YAAY,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,kBAAkB,EACxE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GACpC,uBAAuB,CAAC,QAAQ,CAAC,CAKnC"}
@@ -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;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
+ {"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;AA4KvD,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,CA0C9B"}
@@ -0,0 +1,65 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,43 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { Instruction, InstructionWithAccounts, InstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
3
+ import { Brand } from '@solana/nominal-types';
4
+ export type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = Instruction<'11111111111111111111111111111111'> & InstructionWithAccounts<readonly [
5
+ WritableAccount<TNonceAccountAddress>,
6
+ ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,
7
+ ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>
8
+ ]> & InstructionWithData<AdvanceNonceAccountInstructionData>;
9
+ type AdvanceNonceAccountInstructionData = Brand<Uint8Array, 'AdvanceNonceAccountInstructionData'>;
10
+ /**
11
+ * Creates an instruction for the System program to advance a nonce.
12
+ *
13
+ * This instruction is a prerequisite for a transaction with a nonce-based lifetime to be landed on
14
+ * the network. In order to be considered valid, the transaction must meet all of these criteria.
15
+ *
16
+ * 1. Its lifetime constraint must be a {@link NonceLifetimeConstraint}.
17
+ * 2. The value contained in the on-chain account at the address `nonceAccountAddress` must be equal
18
+ * to {@link NonceLifetimeConstraint.nonce} at the time the transaction is landed.
19
+ * 3. The first instruction in that transaction message must be the one returned by this function.
20
+ *
21
+ * You could also use the `getAdvanceNonceAccountInstruction` method of `@solana-program/system`.
22
+ */
23
+ export declare function createAdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string>(nonceAccountAddress: Address<TNonceAccountAddress>, nonceAuthorityAddress: Address<TNonceAuthorityAddress>): AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>;
24
+ /**
25
+ * A type guard that returns `true` if the instruction conforms to the
26
+ * {@link AdvanceNonceAccountInstruction} type, and refines its type for use in your program.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { isAdvanceNonceAccountInstruction } from '@solana/transaction-messages';
31
+ *
32
+ * if (isAdvanceNonceAccountInstruction(message.instructions[0])) {
33
+ * // At this point, the first instruction in the message has been refined to a
34
+ * // `AdvanceNonceAccountInstruction`.
35
+ * setNonceAccountAddress(message.instructions[0].accounts[0].address);
36
+ * } else {
37
+ * setError('The first instruction is not an `AdvanceNonce` instruction');
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function isAdvanceNonceAccountInstruction(instruction: Instruction): instruction is AdvanceNonceAccountInstruction;
42
+ export {};
43
+ //# sourceMappingURL=durable-nonce-instruction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-nonce-instruction.d.ts","sourceRoot":"","sources":["../../src/durable-nonce-instruction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAEH,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EAEnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,MAAM,MAAM,8BAA8B,CACtC,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,IAC9C,WAAW,CAAC,kCAAkC,CAAC,GAC/C,uBAAuB,CACnB,SAAS;IACL,eAAe,CAAC,oBAAoB,CAAC;IACrC,eAAe,CAAC,6CAA6C,CAAC;IAC9D,qBAAqB,CAAC,sBAAsB,CAAC,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;CAChG,CACJ,GACD,mBAAmB,CAAC,kCAAkC,CAAC,CAAC;AAE5D,KAAK,kCAAkC,GAAG,KAAK,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;AAMlG;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAChD,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAE9C,mBAAmB,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAClD,qBAAqB,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACvD,8BAA8B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAa9E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,WAAW,GACzB,WAAW,IAAI,8BAA8B,CAkB/C"}
@@ -1,13 +1,10 @@
1
1
  import { Address } from '@solana/addresses';
2
- import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
2
+ import { Instruction } from '@solana/instructions';
3
3
  import { Brand } from '@solana/nominal-types';
4
+ import { AdvanceNonceAccountInstruction } from './durable-nonce-instruction';
5
+ import { ExcludeTransactionMessageLifetime } from './lifetime';
4
6
  import { BaseTransactionMessage } from './transaction-message';
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'>;
7
+ import { ExcludeTransactionMessageWithinSizeLimit } from './transaction-message-size';
11
8
  type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Readonly<{
12
9
  readonly nonce: Nonce<TNonceValue>;
13
10
  readonly nonceAccountAddress: Address<TNonceAccountAddress>;
@@ -41,51 +38,14 @@ type NonceLifetimeConstraint<TNonceValue extends string = string> = Readonly<{
41
38
  export interface TransactionMessageWithDurableNonceLifetime<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> {
42
39
  readonly instructions: readonly [
43
40
  AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,
44
- ...IInstruction[]
41
+ ...Instruction[]
45
42
  ];
46
43
  readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;
47
44
  }
48
45
  /**
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
- * ```
46
+ * A helper type to exclude the durable nonce lifetime constraint from a transaction message.
87
47
  */
88
- export declare function isAdvanceNonceAccountInstruction(instruction: IInstruction): instruction is AdvanceNonceAccountInstruction;
48
+ export type ExcludeTransactionMessageDurableNonceLifetime<TTransactionMessage extends BaseTransactionMessage> = TTransactionMessage extends TransactionMessageWithDurableNonceLifetime ? ExcludeTransactionMessageLifetime<TTransactionMessage> : TTransactionMessage;
89
49
  /**
90
50
  * A type guard that returns `true` if the transaction message conforms to the
91
51
  * {@link TransactionMessageWithDurableNonceLifetime} type, and refines its type for use in your
@@ -109,7 +69,30 @@ export declare function isAdvanceNonceAccountInstruction(instruction: IInstructi
109
69
  * }
110
70
  * ```
111
71
  */
112
- export declare function isDurableNonceTransaction(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
72
+ export declare function isTransactionMessageWithDurableNonceLifetime(transactionMessage: BaseTransactionMessage | (BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime)): transactionMessage is BaseTransactionMessage & TransactionMessageWithDurableNonceLifetime;
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;
113
96
  /**
114
97
  * Given a nonce, the account where the value of the nonce is stored, and the address of the account
115
98
  * authorized to consume that nonce, this method will return a new transaction having the same type
@@ -149,6 +132,21 @@ export declare function isDurableNonceTransaction(transactionMessage: BaseTransa
149
132
  * );
150
133
  * ```
151
134
  */
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;
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): SetTransactionMessageWithDurableNonceLifetime<TTransactionMessage, TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;
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
+ };
153
151
  export {};
154
152
  //# 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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oBAAoB,EACpB,sBAAsB,EACtB,WAAW,CACd,CA6CA;AAED;;;;GAIG;AACH,KAAK,6CAA6C,CAC9C,mBAAmB,SAAS,sBAAsB,EAClD,oBAAoB,SAAS,MAAM,GAAG,MAAM,EAC5C,sBAAsB,SAAS,MAAM,GAAG,MAAM,EAC9C,WAAW,SAAS,MAAM,GAAG,MAAM,IACnC,IAAI,CAEJ,mBAAmB,SAAS,0CAA0C,GAChE,mBAAmB,GACnB,wCAAwC,CAAC,mBAAmB,CAAC,EAEnE,cAAc,CACjB,GAAG;IAEA,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,SAAS,SAAS;QACxE,8BAA8B;QAC9B,GAAG,MAAM,KAAK,SAAS,SAAS,WAAW,EAAE;KAChD,GACK,SAAS,CAAC,8BAA8B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,EAAE,GAAG,KAAK,CAAC,GACjG,SAAS;QACL,8BAA8B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;QAC5E,GAAG,mBAAmB,CAAC,cAAc,CAAC;KACzC,CAAC;IAER,QAAQ,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CACrE,CAAC"}
@@ -4,14 +4,18 @@ 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 ITransactionMessageWithFeePayer<TAddress extends string = string> {
7
+ export interface TransactionMessageWithFeePayer<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'>;
12
16
  /**
13
17
  * 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}
18
+ * message having the same type as the one supplied plus the {@link TransactionMessageWithFeePayer}
15
19
  * type.
16
20
  *
17
21
  * @example
@@ -23,5 +27,6 @@ export interface ITransactionMessageWithFeePayer<TAddress extends string = strin
23
27
  * const txPaidByMe = setTransactionMessageFeePayer(myAddress, tx);
24
28
  * ```
25
29
  */
26
- export declare function setTransactionMessageFeePayer<TFeePayerAddress extends string, TTransactionMessage extends BaseTransactionMessage & Partial<ITransactionMessageWithFeePayer>>(feePayer: Address<TFeePayerAddress>, transactionMessage: TTransactionMessage): ITransactionMessageWithFeePayer<TFeePayerAddress> & Omit<TTransactionMessage, 'feePayer'>;
30
+ export declare function setTransactionMessageFeePayer<TFeePayerAddress extends string, TTransactionMessage extends BaseTransactionMessage & Partial<TransactionMessageWithFeePayer>>(feePayer: Address<TFeePayerAddress>, transactionMessage: TTransactionMessage): ExcludeTransactionMessageFeePayer<TTransactionMessage> & TransactionMessageWithFeePayer<TFeePayerAddress>;
31
+ export {};
27
32
  //# 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,+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"}
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,8BAA8B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC5E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,KAAK,iCAAiC,CAAC,mBAAmB,SAAS,sBAAsB,IAAI,IAAI,CAC7F,mBAAmB,EACnB,UAAU,CACb,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CACzC,gBAAgB,SAAS,MAAM,EAC/B,mBAAmB,SAAS,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,EAE5F,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACnC,kBAAkB,EAAE,mBAAmB,GACxC,iCAAiC,CAAC,mBAAmB,CAAC,GAAG,8BAA8B,CAAC,gBAAgB,CAAC,CAe3G"}
@@ -36,7 +36,10 @@ 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';
39
40
  export * from './fee-payer';
40
41
  export * from './instructions';
42
+ export * from './transaction-message-size';
41
43
  export * from './transaction-message';
44
+ export * from './deprecated';
42
45
  //# 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,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
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,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,cAAc,CAAC"}
@@ -1,5 +1,21 @@
1
- import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
1
+ import { Instruction } from '@solana/instructions';
2
+ import { ExcludeTransactionMessageDurableNonceLifetime } from './durable-nonce';
2
3
  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
+ };
3
19
  /**
4
20
  * Given an instruction, this method will return a new transaction message with that instruction
5
21
  * having been added to the end of the list of existing instructions.
@@ -21,7 +37,7 @@ import { BaseTransactionMessage } from './transaction-message';
21
37
  * );
22
38
  * ```
23
39
  */
24
- export declare function appendTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage>(instruction: TTransactionMessage['instructions'][number], transactionMessage: TTransactionMessage): TTransactionMessage;
40
+ export declare function appendTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage, TInstruction extends Instruction>(instruction: TInstruction, transactionMessage: TTransactionMessage): AppendTransactionMessageInstructions<TTransactionMessage, [TInstruction]>;
25
41
  /**
26
42
  * Given an array of instructions, this method will return a new transaction message with those
27
43
  * instructions having been added to the end of the list of existing instructions.
@@ -49,8 +65,7 @@ export declare function appendTransactionMessageInstruction<TTransactionMessage
49
65
  * );
50
66
  * ```
51
67
  */
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;
68
+ export declare function appendTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage, const TInstructions extends readonly Instruction[]>(instructions: TInstructions, transactionMessage: TTransactionMessage): AppendTransactionMessageInstructions<TTransactionMessage, TInstructions>;
54
69
  /**
55
70
  * Given an instruction, this method will return a new transaction message with that instruction
56
71
  * having been added to the beginning of the list of existing instructions.
@@ -72,7 +87,7 @@ type ExcludeDurableNonce<T> = T extends TransactionMessageWithDurableNonceLifeti
72
87
  * );
73
88
  * ```
74
89
  */
75
- export declare function prependTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage>(instruction: TTransactionMessage['instructions'][number], transactionMessage: TTransactionMessage): ExcludeDurableNonce<TTransactionMessage>;
90
+ export declare function prependTransactionMessageInstruction<TTransactionMessage extends BaseTransactionMessage, TInstruction extends Instruction>(instruction: TInstruction, transactionMessage: TTransactionMessage): PrependTransactionMessageInstructions<TTransactionMessage, [TInstruction]>;
76
91
  /**
77
92
  * Given an array of instructions, this method will return a new transaction message with those
78
93
  * instructions having been added to the beginning of the list of existing instructions.
@@ -100,6 +115,6 @@ export declare function prependTransactionMessageInstruction<TTransactionMessage
100
115
  * );
101
116
  * ```
102
117
  */
103
- export declare function prependTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage>(instructions: ReadonlyArray<TTransactionMessage['instructions'][number]>, transactionMessage: TTransactionMessage): ExcludeDurableNonce<TTransactionMessage>;
118
+ export declare function prependTransactionMessageInstructions<TTransactionMessage extends BaseTransactionMessage, const TInstructions extends readonly Instruction[]>(instructions: TInstructions, transactionMessage: TTransactionMessage): PrependTransactionMessageInstructions<TTransactionMessage, TInstructions>;
104
119
  export {};
105
120
  //# sourceMappingURL=instructions.d.ts.map
@@ -1 +1 @@
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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,WAAW,EAEhC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,mBAAmB,GACxC,qCAAqC,CAAC,mBAAmB,EAAE,CAAC,YAAY,CAAC,CAAC,CAE5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qCAAqC,CACjD,mBAAmB,SAAS,sBAAsB,EAClD,KAAK,CAAC,aAAa,SAAS,SAAS,WAAW,EAAE,EAElD,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,mBAAmB,GACxC,qCAAqC,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAQ3E"}
@@ -0,0 +1,12 @@
1
+ import { TransactionMessageWithBlockhashLifetime } from './blockhash';
2
+ import { TransactionMessageWithDurableNonceLifetime } from './durable-nonce';
3
+ import { BaseTransactionMessage } from './transaction-message';
4
+ /**
5
+ * A transaction message with any valid lifetime constraint.
6
+ */
7
+ export type TransactionMessageWithLifetime = TransactionMessageWithBlockhashLifetime | TransactionMessageWithDurableNonceLifetime;
8
+ /**
9
+ * A helper type to exclude any lifetime constraint from a transaction message.
10
+ */
11
+ export type ExcludeTransactionMessageLifetime<TTransactionMessage extends BaseTransactionMessage> = Omit<TTransactionMessage, 'lifetimeConstraint'>;
12
+ //# sourceMappingURL=lifetime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifetime.d.ts","sourceRoot":"","sources":["../../src/lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACpC,uCAAuC,GACvC,0CAA0C,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,iCAAiC,CAAC,mBAAmB,SAAS,sBAAsB,IAAI,IAAI,CACpG,mBAAmB,EACnB,oBAAoB,CACvB,CAAC"}