@solana-program/compute-budget 0.7.0 → 0.9.0

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 (33) hide show
  1. package/dist/src/index.js +196 -0
  2. package/dist/src/index.js.map +1 -1
  3. package/dist/src/index.mjs +190 -2
  4. package/dist/src/index.mjs.map +1 -1
  5. package/dist/types/constants.d.ts +12 -0
  6. package/dist/types/constants.d.ts.map +1 -0
  7. package/dist/types/estimateAndSetComputeLimit.d.ts +24 -0
  8. package/dist/types/estimateAndSetComputeLimit.d.ts.map +1 -0
  9. package/dist/types/estimateComputeLimit.d.ts +63 -0
  10. package/dist/types/estimateComputeLimit.d.ts.map +1 -0
  11. package/dist/types/estimateComputeLimitInternal.d.ts +87 -0
  12. package/dist/types/estimateComputeLimitInternal.d.ts.map +1 -0
  13. package/dist/types/generated/instructions/requestHeapFrame.d.ts +7 -7
  14. package/dist/types/generated/instructions/requestHeapFrame.d.ts.map +1 -1
  15. package/dist/types/generated/instructions/requestUnits.d.ts +7 -7
  16. package/dist/types/generated/instructions/requestUnits.d.ts.map +1 -1
  17. package/dist/types/generated/instructions/setComputeUnitLimit.d.ts +7 -7
  18. package/dist/types/generated/instructions/setComputeUnitLimit.d.ts.map +1 -1
  19. package/dist/types/generated/instructions/setComputeUnitPrice.d.ts +7 -7
  20. package/dist/types/generated/instructions/setComputeUnitPrice.d.ts.map +1 -1
  21. package/dist/types/generated/instructions/setLoadedAccountsDataSizeLimit.d.ts +7 -7
  22. package/dist/types/generated/instructions/setLoadedAccountsDataSizeLimit.d.ts.map +1 -1
  23. package/dist/types/generated/shared/index.d.ts +3 -3
  24. package/dist/types/generated/shared/index.d.ts.map +1 -1
  25. package/dist/types/index.d.ts +5 -0
  26. package/dist/types/index.d.ts.map +1 -1
  27. package/dist/types/internal.d.ts +35 -0
  28. package/dist/types/internal.d.ts.map +1 -0
  29. package/dist/types/setComputeLimit.d.ts +36 -0
  30. package/dist/types/setComputeLimit.d.ts.map +1 -0
  31. package/dist/types/setComputePrice.d.ts +36 -0
  32. package/dist/types/setComputePrice.d.ts.map +1 -0
  33. package/package.json +8 -19
@@ -5,11 +5,11 @@
5
5
  *
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
- import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit';
8
+ import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit';
9
9
  import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
10
10
  export declare const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
11
- export declare function getSetComputeUnitPriceDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array;
12
- export type SetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>;
11
+ export declare function getSetComputeUnitPriceDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
13
13
  export type SetComputeUnitPriceInstructionData = {
14
14
  discriminator: number;
15
15
  /** Transaction compute unit price used for prioritization fees. */
@@ -19,9 +19,9 @@ export type SetComputeUnitPriceInstructionDataArgs = {
19
19
  /** Transaction compute unit price used for prioritization fees. */
20
20
  microLamports: number | bigint;
21
21
  };
22
- export declare function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs>;
23
- export declare function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData>;
24
- export declare function getSetComputeUnitPriceInstructionDataCodec(): Codec<SetComputeUnitPriceInstructionDataArgs, SetComputeUnitPriceInstructionData>;
22
+ export declare function getSetComputeUnitPriceInstructionDataEncoder(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs>;
23
+ export declare function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData>;
24
+ export declare function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<SetComputeUnitPriceInstructionDataArgs, SetComputeUnitPriceInstructionData>;
25
25
  export type SetComputeUnitPriceInput = {
26
26
  microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];
27
27
  };
@@ -32,5 +32,5 @@ export type ParsedSetComputeUnitPriceInstruction<TProgram extends string = typeo
32
32
  programAddress: Address<TProgram>;
33
33
  data: SetComputeUnitPriceInstructionData;
34
34
  };
35
- export declare function parseSetComputeUnitPriceInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedSetComputeUnitPriceInstruction<TProgram>;
35
+ export declare function parseSetComputeUnitPriceInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSetComputeUnitPriceInstruction<TProgram>;
36
36
  //# sourceMappingURL=setComputeUnitPrice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAA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AsC,EACtC,kCAAkC,CACnC,CAKA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,sCAAsC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,wBAAwB,EAC/B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,8BAA8B,CAAC,eAAe,CAAC,CAgBjD;AAED,MAAM,MAAM,oCAAoC,CAC9C,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACzE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,oCAAoC,CAAC,QAAQ,CAAC,CAOhD"}
@@ -5,11 +5,11 @@
5
5
  *
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
- import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit';
8
+ import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit';
9
9
  import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
10
10
  export declare const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
11
- export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array;
12
- export type SetLoadedAccountsDataSizeLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>;
11
+ export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SetLoadedAccountsDataSizeLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
13
13
  export type SetLoadedAccountsDataSizeLimitInstructionData = {
14
14
  discriminator: number;
15
15
  accountDataSizeLimit: number;
@@ -17,9 +17,9 @@ export type SetLoadedAccountsDataSizeLimitInstructionData = {
17
17
  export type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {
18
18
  accountDataSizeLimit: number;
19
19
  };
20
- export declare function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs>;
21
- export declare function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData>;
22
- export declare function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<SetLoadedAccountsDataSizeLimitInstructionDataArgs, SetLoadedAccountsDataSizeLimitInstructionData>;
20
+ export declare function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs>;
21
+ export declare function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData>;
22
+ export declare function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<SetLoadedAccountsDataSizeLimitInstructionDataArgs, SetLoadedAccountsDataSizeLimitInstructionData>;
23
23
  export type SetLoadedAccountsDataSizeLimitInput = {
24
24
  accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];
25
25
  };
@@ -30,5 +30,5 @@ export type ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram extends str
30
30
  programAddress: Address<TProgram>;
31
31
  data: SetLoadedAccountsDataSizeLimitInstructionData;
32
32
  };
33
- export declare function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>;
33
+ export declare function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>;
34
34
  //# sourceMappingURL=setLoadedAccountsDataSizeLimit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,iDAAiD,IAAI,CAAC;AAEnE,wBAAgB,mDAAmD,6CAIlE;AAED,MAAM,MAAM,yCAAyC,CACnD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC7D,YAAY,CAAC,QAAQ,CAAC,GACxB,oBAAoB,CAAC,UAAU,CAAC,GAChC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;AAE/C,MAAM,MAAM,6CAA6C,GAAG;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iDAAiD,GAAG;IAC9D,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAgB,uDAAuD,IAAI,OAAO,CAAC,iDAAiD,CAAC,CAWpI;AAED,wBAAgB,uDAAuD,IAAI,OAAO,CAAC,6CAA6C,CAAC,CAKhI;AAED,wBAAgB,qDAAqD,IAAI,KAAK,CAC5E,iDAAiD,EACjD,6CAA6C,CAC9C,CAKA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,oBAAoB,EAAE,iDAAiD,CAAC,sBAAsB,CAAC,CAAC;CACjG,CAAC;AAEF,wBAAgB,4CAA4C,CAC1D,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,mCAAmC,EAC1C,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,yCAAyC,CAAC,eAAe,CAAC,CAgB5D;AAED,MAAM,MAAM,+CAA+C,CACzD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,6CAA6C,CAAC;CACrD,CAAC;AAEF,wBAAgB,8CAA8C,CAC5D,QAAQ,SAAS,MAAM,EAEvB,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,GACrE,+CAA+C,CAAC,QAAQ,CAAC,CAO3D"}
1
+ {"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACh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IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,6CAA6C,CAAC;CACrD,CAAC;AAEF,wBAAgB,8CAA8C,CAC5D,QAAQ,SAAS,MAAM,EAEvB,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,+CAA+C,CAAC,QAAQ,CAAC,CAO3D"}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
- import { type Address, type IAccountMeta, type IAccountSignerMeta, type ProgramDerivedAddress, type TransactionSigner } from '@solana/kit';
8
+ import { type AccountMeta, type AccountSignerMeta, type Address, type ProgramDerivedAddress, type TransactionSigner } from '@solana/kit';
9
9
  /**
10
10
  * Asserts that the given value is not null or undefined.
11
11
  * @internal
@@ -38,13 +38,13 @@ export type ResolvedAccount<T extends string = string, U extends Address<T> | Pr
38
38
  * Defines an instruction that stores additional bytes on-chain.
39
39
  * @internal
40
40
  */
41
- export type IInstructionWithByteDelta = {
41
+ export type InstructionWithByteDelta = {
42
42
  byteDelta: number;
43
43
  };
44
44
  /**
45
45
  * Get account metas and signers from resolved accounts.
46
46
  * @internal
47
47
  */
48
- export declare function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId'): (account: ResolvedAccount) => IAccountMeta | IAccountSignerMeta | undefined;
48
+ export declare function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId'): (account: ResolvedAccount) => AccountMeta | AccountSignerMeta | undefined;
49
49
  export declare function isTransactionSigner<TAddress extends string = string>(value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress>): value is TransactionSigner<TAddress>;
50
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generated/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,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 -1,2 +1,7 @@
1
1
  export * from './generated';
2
+ export * from './constants';
3
+ export * from './estimateAndSetComputeLimit';
4
+ export * from './estimateComputeLimit';
5
+ export * from './setComputeLimit';
6
+ export * from './setComputePrice';
2
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { BaseTransactionMessage, Instruction, MicroLamports } from '@solana/kit';
2
+ import { SetComputeUnitLimitInstruction, SetComputeUnitPriceInstruction } from './generated';
3
+ /**
4
+ * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message
5
+ * and its set limit, if any.
6
+ */
7
+ export declare function getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage: BaseTransactionMessage): {
8
+ index: number;
9
+ units: number;
10
+ } | null;
11
+ /**
12
+ * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message, if any.
13
+ */
14
+ export declare function getSetComputeUnitLimitInstructionIndex(transactionMessage: BaseTransactionMessage): number;
15
+ /**
16
+ * Checks if the given instruction is a `SetComputeUnitLimit` instruction.
17
+ */
18
+ export declare function isSetComputeUnitLimitInstruction(instruction: Instruction): instruction is SetComputeUnitLimitInstruction;
19
+ /**
20
+ * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message
21
+ * and its set micro-lamports, if any.
22
+ */
23
+ export declare function getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage: BaseTransactionMessage): {
24
+ index: number;
25
+ microLamports: MicroLamports;
26
+ } | null;
27
+ /**
28
+ * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message, if any.
29
+ */
30
+ export declare function getSetComputeUnitPriceInstructionIndex(transactionMessage: BaseTransactionMessage): number;
31
+ /**
32
+ * Checks if the given instruction is a `SetComputeUnitPrice` instruction.
33
+ */
34
+ export declare function isSetComputeUnitPriceInstruction(instruction: Instruction): instruction is SetComputeUnitPriceInstruction;
35
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAGtB,WAAW,EACX,aAAa,EAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8CAA8C,CAC5D,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYzC;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,8BAA8B,CAM/C;AAED;;;GAGG;AACH,wBAAgB,sDAAsD,CACpE,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,8BAA8B,CAM/C"}
@@ -0,0 +1,36 @@
1
+ import { BaseTransactionMessage } from '@solana/kit';
2
+ /**
3
+ * Appends a `SetComputeUnitLimit` instruction with a provisory
4
+ * compute unit limit to a given transaction message
5
+ * if and only if it does not already have one.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const transactionMessage = pipe(
10
+ * createTransactionMessage({ version: 0 }),
11
+ * fillProvisorySetComputeUnitLimitInstruction,
12
+ * // ...
13
+ * );
14
+ * ```
15
+ */
16
+ export declare function fillProvisorySetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(transactionMessage: TTransactionMessage): TTransactionMessage;
17
+ /**
18
+ * Updates the first `SetComputeUnitLimit` instruction in a transaction message
19
+ * with the given units, or appends a new instruction if none exists.
20
+ * A function of the current value can be provided instead of a static value.
21
+ *
22
+ * @param units - The new compute unit limit, or a function that takes the previous
23
+ * compute unit limit and returns the new limit.
24
+ * @param transactionMessage - The transaction message to update.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(
29
+ * // E.g. Keep the current limit if it is set, otherwise set it to the maximum.
30
+ * (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,
31
+ * transactionMessage,
32
+ * );
33
+ * ```
34
+ */
35
+ export declare function updateOrAppendSetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(units: number | ((previousUnits: number | null) => number), transactionMessage: TTransactionMessage): TTransactionMessage;
36
+ //# sourceMappingURL=setComputeLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setComputeLimit.d.ts","sourceRoot":"","sources":["../../src/setComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAKrB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CACzD,mBAAmB,SAAS,sBAAsB,EAClD,kBAAkB,EAAE,mBAAmB,uBAMxC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAC1D,mBAAmB,SAAS,sBAAsB,EAElD,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,EAC1D,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,CA0BrB"}
@@ -0,0 +1,36 @@
1
+ import { BaseTransactionMessage, MicroLamports } from '@solana/kit';
2
+ /**
3
+ * Sets the compute unit price of a transaction message in micro-Lamports.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const transactionMessage = pipe(
8
+ * createTransactionMessage({ version: 0 }),
9
+ * (m) => setTransactionMessageComputeUnitPrice(10_000, m),
10
+ * // ...
11
+ * );
12
+ * ```
13
+ */
14
+ export declare function setTransactionMessageComputeUnitPrice<TTransactionMessage extends BaseTransactionMessage>(microLamports: number | bigint, transactionMessage: TTransactionMessage): Omit<import("@solana/kit").ExcludeTransactionMessageWithinSizeLimit<TTransactionMessage>, "instructions"> & {
15
+ readonly instructions: readonly [...TTransactionMessage["instructions"], import("./generated").SetComputeUnitPriceInstruction<import("@solana/kit").Address<"ComputeBudget111111111111111111111111111111">, []>];
16
+ };
17
+ /**
18
+ * Updates the first `SetComputeUnitPrice` instruction in a transaction message
19
+ * with the given micro-Lamports, or appends a new instruction if none exists.
20
+ * A function of the current value can be provided instead of a static value.
21
+ *
22
+ * @param microLamports - The new compute unit price, or a function that
23
+ * takes the previous price and returns the new one.
24
+ * @param transactionMessage - The transaction message to update.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(
29
+ * // E.g. double the current price or set it to 10_000 if it isn't set.
30
+ * (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,
31
+ * transactionMessage,
32
+ * );
33
+ * ```
34
+ */
35
+ export declare function updateOrAppendSetComputeUnitPriceInstruction<TTransactionMessage extends BaseTransactionMessage>(microLamports: MicroLamports | ((previousMicroLamports: MicroLamports | null) => MicroLamports), transactionMessage: TTransactionMessage): TTransactionMessage;
36
+ //# sourceMappingURL=setComputePrice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,SAAS,sBAAsB,EAClD,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,mBAAmB;;EAKxE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAC1D,mBAAmB,SAAS,sBAAsB,EAElD,aAAa,EACT,aAAa,GACb,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EACpE,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,CAkCrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-program/compute-budget",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "JavaScript client for the Compute Budget program",
5
5
  "sideEffects": false,
6
6
  "module": "./dist/src/index.mjs",
@@ -32,38 +32,27 @@
32
32
  },
33
33
  "homepage": "https://github.com/solana-program/compute-budget#readme",
34
34
  "peerDependencies": {
35
- "@solana/kit": "^2.1.0"
35
+ "@solana/kit": "^3.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@ava/typescript": "^4.1.0",
39
38
  "@solana/eslint-config-solana": "^3.0.3",
40
- "@solana/kit": "^2.1.0",
41
- "@types/node": "^20",
39
+ "@solana/kit": "^3.0",
40
+ "@types/node": "^24",
42
41
  "@typescript-eslint/eslint-plugin": "^7.16.1",
43
42
  "@typescript-eslint/parser": "^7.16.1",
44
- "ava": "^6.1.3",
45
43
  "eslint": "^8.57.0",
46
44
  "prettier": "^3.3.3",
47
45
  "rimraf": "^5.0.5",
48
46
  "tsup": "^8.1.2",
49
47
  "typedoc": "^0.25.12",
50
- "typescript": "^5.5.3"
51
- },
52
- "ava": {
53
- "nodeArguments": [
54
- "--no-warnings"
55
- ],
56
- "typescript": {
57
- "compile": false,
58
- "rewritePaths": {
59
- "test/": "dist/test/"
60
- }
61
- }
48
+ "typescript": "^5.5.3",
49
+ "vitest": "^3.1.3"
62
50
  },
63
51
  "scripts": {
64
52
  "build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",
65
53
  "build:docs": "typedoc",
66
- "test": "ava",
54
+ "dev": "vitest",
55
+ "test": "vitest run",
67
56
  "lint": "eslint --ext js,ts,tsx src",
68
57
  "lint:fix": "eslint --fix --ext js,ts,tsx src",
69
58
  "format": "prettier --check src test",