🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@solana-program/compute-budget

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana-program/compute-budget - npm Package Compare versions

Comparing version
0.15.0
to
0.16.0
+12
src/constants.ts
/**
* A provisory compute unit limit is used to indicate that the transaction
* should be estimated for compute units before being sent to the network.
*
* Setting it to zero ensures the transaction fails unless it is properly estimated.
*/
export const PROVISORY_COMPUTE_UNIT_LIMIT = 0;
/**
* The maximum compute unit limit that can be set for a transaction.
*/
export const MAX_COMPUTE_UNIT_LIMIT = 1_400_000;
import { TransactionMessage, TransactionMessageWithFeePayer } from '@solana/kit';
import { MAX_COMPUTE_UNIT_LIMIT, PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';
import {
EstimateComputeUnitLimitFactoryFunction,
EstimateComputeUnitLimitFactoryFunctionConfig,
} from './estimateComputeLimitInternal';
import { findSetComputeUnitLimitInstructionIndexAndUnits } from './introspect';
import { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';
type EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <
TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer,
>(
transactionMessage: TTransactionMessage,
config?: EstimateComputeUnitLimitFactoryFunctionConfig,
) => Promise<TTransactionMessage>;
/**
* Given a transaction message, if it does not have an explicit compute unit limit,
* estimates the compute unit limit and updates the transaction message with
* the estimated limit. Otherwise, returns the transaction message unchanged.
*
* It requires a function that estimates the compute unit limit.
*
* @example
* ```ts
* const estimateAndUpdateCUs = estimateAndUpdateProvisoryComputeUnitLimitFactory(
* estimateComputeUnitLimitFactory({ rpc })
* );
*
* const transactionMessageWithCUs = await estimateAndUpdateCUs(transactionMessage);
* ```
*
* @see {@link estimateAndUpdateProvisoryComputeUnitLimitFactory}
*/
export function estimateAndUpdateProvisoryComputeUnitLimitFactory(
estimateComputeUnitLimit: EstimateComputeUnitLimitFactoryFunction,
): EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction {
return async function fn(transactionMessage, config) {
const instructionDetails = findSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);
// If the transaction message already has a compute unit limit instruction
// which is set to a specific value — i.e. not 0 or the maximum limit —
// we don't need to estimate the compute unit limit.
if (
instructionDetails &&
instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT &&
instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT
) {
return transactionMessage;
}
return updateOrAppendSetComputeUnitLimitInstruction(
await estimateComputeUnitLimit(transactionMessage, config),
transactionMessage,
);
};
}
import {
estimateComputeUnitLimit,
EstimateComputeUnitLimitFactoryConfig,
EstimateComputeUnitLimitFactoryFunction,
} from './estimateComputeLimitInternal';
/**
* Use this utility to estimate the actual compute unit cost of a given transaction message.
*
* Correctly budgeting a compute unit limit for your transaction message can increase the
* probability that your transaction will be accepted for processing. If you don't declare a compute
* unit limit on your transaction, validators will assume an upper limit of 200K compute units (CU)
* per instruction.
*
* Since validators have an incentive to pack as many transactions into each block as possible, they
* may choose to include transactions that they know will fit into the remaining compute budget for
* the current block over transactions that might not. For this reason, you should set a compute
* unit limit on each of your transaction messages, whenever possible.
*
* > [!WARNING]
* > The compute unit estimate is just that -- an estimate. The compute unit consumption of the
* > actual transaction might be higher or lower than what was observed in simulation. Unless you
* > are confident that your particular transaction message will consume the same or fewer compute
* > units as was estimated, you might like to augment the estimate by either a fixed number of CUs
* > or a multiplier.
*
* > [!NOTE]
* > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the
* > network by a wallet, you might like to leave it up to the wallet to determine the compute unit
* > limit. Consider that the wallet might have a more global view of how many compute units certain
* > types of transactions consume, and might be able to make better estimates of an appropriate
* > compute unit budget.
*
* > [!INFO]
* > In the event that a transaction message does not already have a `SetComputeUnitLimit`
* > instruction, this function will add one before simulation. This ensures that the compute unit
* > consumption of the `SetComputeUnitLimit` instruction itself is included in the estimate.
*
* @param config
*
* @example
* ```ts
* import { getSetComputeUnitLimitInstruction } from '@solana-program/compute-budget';
* import { createSolanaRpc, estimateComputeUnitLimitFactory, pipe } from '@solana/kit';
*
* // Create an estimator function.
* const rpc = createSolanaRpc('http://127.0.0.1:8899');
* const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });
*
* // Create your transaction message.
* const transactionMessage = pipe(
* createTransactionMessage({ version: 'legacy' }),
* /* ... *\/
* );
*
* // Request an estimate of the actual compute units this message will consume. This is done by
* // simulating the transaction and grabbing the estimated compute units from the result.
* const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);
*
* // Set the transaction message's compute unit budget.
* const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(
* getSetComputeUnitLimitInstruction({ units: estimatedUnits }),
* transactionMessage,
* );
* ```
*/
export function estimateComputeUnitLimitFactory({
rpc,
}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFactoryFunction {
return async function estimateComputeUnitLimitFactoryFunction(transactionMessage, config) {
return await estimateComputeUnitLimit({
...config,
rpc,
transactionMessage,
});
};
}
import {
TransactionMessage,
Commitment,
compileTransaction,
getBase64EncodedWireTransaction,
getSolanaErrorFromTransactionError,
isSolanaError,
isTransactionMessageWithDurableNonceLifetime,
pipe,
Rpc,
RpcSimulateTransactionResult,
SimulateTransactionApi,
Slot,
SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,
SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,
SolanaError,
Transaction,
TransactionMessageWithFeePayer,
} from '@solana/kit';
import { MAX_COMPUTE_UNIT_LIMIT } from './constants';
import { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';
export type EstimateComputeUnitLimitFactoryConfig = Readonly<{
/** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */
rpc: Rpc<SimulateTransactionApi>;
}>;
export type EstimateComputeUnitLimitFactoryFunction = (
transactionMessage: TransactionMessage & TransactionMessageWithFeePayer,
config?: EstimateComputeUnitLimitFactoryFunctionConfig,
) => Promise<number>;
export type EstimateComputeUnitLimitFactoryFunctionConfig = {
abortSignal?: AbortSignal;
/**
* Compute the estimate as of the highest slot that has reached this level of commitment.
*
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
* example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
* is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
* default commitment applied by the server is `"finalized"`.
*/
commitment?: Commitment;
/**
* Prevents accessing stale data by enforcing that the RPC node has processed transactions up to
* this slot
*/
minContextSlot?: Slot;
};
type EstimateComputeUnitLimitConfig = EstimateComputeUnitLimitFactoryFunctionConfig &
Readonly<{
rpc: Rpc<SimulateTransactionApi>;
transactionMessage: TransactionMessage & TransactionMessageWithFeePayer;
}>;
/**
* Simulates a transaction message on the network and returns the number of compute units it
* consumed during simulation.
*
* The estimate this function returns can be used to set a compute unit limit on the transaction.
* Correctly budgeting a compute unit limit for your transaction message can increase the probability
* that your transaction will be accepted for processing.
*
* If you don't declare a compute unit limit on your transaction, validators will assume an upper
* limit of 200K compute units (CU) per instruction. Since validators have an incentive to pack as
* many transactions into each block as possible, they may choose to include transactions that they
* know will fit into the remaining compute budget for the current block over transactions that
* might not. For this reason, you should set a compute unit limit on each of your transaction
* messages, whenever possible.
*
* ## Example
*
* ```ts
* import { getSetComputeLimitInstruction } from '@solana-program/compute-budget';
* import { createSolanaRpc, getComputeUnitEstimateForTransactionMessageFactory, pipe } from '@solana/kit';
*
* // Create an estimator function.
* const rpc = createSolanaRpc('http://127.0.0.1:8899');
* const getComputeUnitEstimateForTransactionMessage =
* getComputeUnitEstimateForTransactionMessageFactory({ rpc });
*
* // Create your transaction message.
* const transactionMessage = pipe(
* createTransactionMessage({ version: 'legacy' }),
* /* ... *\/
* );
*
* // Request an estimate of the actual compute units this message will consume.
* const computeUnitsEstimate =
* await getComputeUnitEstimateForTransactionMessage(transactionMessage);
*
* // Set the transaction message's compute unit budget.
* const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(
* getSetComputeLimitInstruction({ units: computeUnitsEstimate }),
* transactionMessage,
* );
* ```
*
* > [!WARNING]
* > The compute unit estimate is just that &ndash; an estimate. The compute unit consumption of the
* > actual transaction might be higher or lower than what was observed in simulation. Unless you
* > are confident that your particular transaction message will consume the same or fewer compute
* > units as was estimated, you might like to augment the estimate by either a fixed number of CUs
* > or a multiplier.
*
* > [!NOTE]
* > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the
* > network by a wallet, you might like to leave it up to the wallet to determine the compute unit
* > limit. Consider that the wallet might have a more global view of how many compute units certain
* > types of transactions consume, and might be able to make better estimates of an appropriate
* > compute unit budget.
*/
export async function estimateComputeUnitLimit({
transactionMessage,
...configs
}: EstimateComputeUnitLimitConfig): Promise<number> {
const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);
const transaction = pipe(
transactionMessage,
m => updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m),
compileTransaction,
);
return await simulateTransactionAndGetConsumedUnits({
transaction,
replaceRecentBlockhash,
...configs,
});
}
type SimulateTransactionAndGetConsumedUnitsConfig = Omit<EstimateComputeUnitLimitConfig, 'transactionMessage'> &
Readonly<{ replaceRecentBlockhash?: boolean; transaction: Transaction }>;
async function simulateTransactionAndGetConsumedUnits({
abortSignal,
rpc,
transaction,
...simulateConfig
}: SimulateTransactionAndGetConsumedUnitsConfig): Promise<number> {
const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);
try {
const response = await rpc
.simulateTransaction(wireTransactionBytes, { ...simulateConfig, encoding: 'base64', sigVerify: false })
.send({ abortSignal });
const { err: transactionError, ...simulationResult } = response.value as RpcSimulateTransactionResult;
if (simulationResult.unitsConsumed == null) {
// This should never be hit, because all RPCs should support `unitsConsumed` by now.
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);
}
if (transactionError) {
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {
...simulationResult,
cause: getSolanaErrorFromTransactionError(transactionError),
});
}
// FIXME(https://github.com/anza-xyz/agave/issues/1295): The simulation response returns
// compute units as a u64, but the `SetComputeLimit` instruction only accepts a u32. Until
// this changes, downcast it.
return simulationResult.unitsConsumed > 4_294_967_295n ? 4_294_967_295 : Number(simulationResult.unitsConsumed);
} catch (e) {
if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) throw e;
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, { cause: e });
}
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
export * from './instructions';
export * from './programs';
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
export * from './requestHeapFrame';
export * from './requestUnits';
export * from './setComputeUnitLimit';
export * from './setComputeUnitPrice';
export * from './setLoadedAccountsDataSizeLimit';
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
combineCodec,
getStructDecoder,
getStructEncoder,
getU32Decoder,
getU32Encoder,
getU8Decoder,
getU8Encoder,
transformEncoder,
type AccountMeta,
type Address,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
export const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;
export function getRequestHeapFrameDiscriminatorBytes(): ReadonlyUint8Array {
return getU8Encoder().encode(REQUEST_HEAP_FRAME_DISCRIMINATOR);
}
export type RequestHeapFrameInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
export type RequestHeapFrameInstructionData = {
discriminator: number;
/**
* Requested transaction-wide program heap size in bytes.
* Must be multiple of 1024. Applies to each program, including CPIs.
*/
bytes: number;
};
export type RequestHeapFrameInstructionDataArgs = {
/**
* Requested transaction-wide program heap size in bytes.
* Must be multiple of 1024. Applies to each program, including CPIs.
*/
bytes: number;
};
export function getRequestHeapFrameInstructionDataEncoder(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['bytes', getU32Encoder()],
]),
value => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR }),
);
}
export function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['bytes', getU32Decoder()],
]);
}
export function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<
RequestHeapFrameInstructionDataArgs,
RequestHeapFrameInstructionData
> {
return combineCodec(getRequestHeapFrameInstructionDataEncoder(), getRequestHeapFrameInstructionDataDecoder());
}
export type RequestHeapFrameInput = {
bytes: RequestHeapFrameInstructionDataArgs['bytes'];
};
export function getRequestHeapFrameInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(
input: RequestHeapFrameInput,
config?: { programAddress?: TProgramAddress },
): RequestHeapFrameInstruction<TProgramAddress> {
// Program address.
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
// Original args.
const args = { ...input };
return Object.freeze({
data: getRequestHeapFrameInstructionDataEncoder().encode(args as RequestHeapFrameInstructionDataArgs),
programAddress,
} as RequestHeapFrameInstruction<TProgramAddress>);
}
export type ParsedRequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {
programAddress: Address<TProgram>;
data: RequestHeapFrameInstructionData;
};
export function parseRequestHeapFrameInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedRequestHeapFrameInstruction<TProgram> {
return {
programAddress: instruction.programAddress,
data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data),
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
combineCodec,
getStructDecoder,
getStructEncoder,
getU32Decoder,
getU32Encoder,
getU8Decoder,
getU8Encoder,
transformEncoder,
type AccountMeta,
type Address,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
export const REQUEST_UNITS_DISCRIMINATOR = 0;
export function getRequestUnitsDiscriminatorBytes(): ReadonlyUint8Array {
return getU8Encoder().encode(REQUEST_UNITS_DISCRIMINATOR);
}
export type RequestUnitsInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
export type RequestUnitsInstructionData = {
discriminator: number;
/** Units to request for transaction-wide compute. */
units: number;
/** Prioritization fee lamports. */
additionalFee: number;
};
export type RequestUnitsInstructionDataArgs = {
/** Units to request for transaction-wide compute. */
units: number;
/** Prioritization fee lamports. */
additionalFee: number;
};
export function getRequestUnitsInstructionDataEncoder(): FixedSizeEncoder<RequestUnitsInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['units', getU32Encoder()],
['additionalFee', getU32Encoder()],
]),
value => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR }),
);
}
export function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['units', getU32Decoder()],
['additionalFee', getU32Decoder()],
]);
}
export function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<
RequestUnitsInstructionDataArgs,
RequestUnitsInstructionData
> {
return combineCodec(getRequestUnitsInstructionDataEncoder(), getRequestUnitsInstructionDataDecoder());
}
export type RequestUnitsInput = {
units: RequestUnitsInstructionDataArgs['units'];
additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];
};
export function getRequestUnitsInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(
input: RequestUnitsInput,
config?: { programAddress?: TProgramAddress },
): RequestUnitsInstruction<TProgramAddress> {
// Program address.
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
// Original args.
const args = { ...input };
return Object.freeze({
data: getRequestUnitsInstructionDataEncoder().encode(args as RequestUnitsInstructionDataArgs),
programAddress,
} as RequestUnitsInstruction<TProgramAddress>);
}
export type ParsedRequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {
programAddress: Address<TProgram>;
data: RequestUnitsInstructionData;
};
export function parseRequestUnitsInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedRequestUnitsInstruction<TProgram> {
return {
programAddress: instruction.programAddress,
data: getRequestUnitsInstructionDataDecoder().decode(instruction.data),
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
combineCodec,
getStructDecoder,
getStructEncoder,
getU32Decoder,
getU32Encoder,
getU8Decoder,
getU8Encoder,
transformEncoder,
type AccountMeta,
type Address,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
export const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;
export function getSetComputeUnitLimitDiscriminatorBytes(): ReadonlyUint8Array {
return getU8Encoder().encode(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR);
}
export type SetComputeUnitLimitInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
export type SetComputeUnitLimitInstructionData = {
discriminator: number;
/** Transaction-wide compute unit limit. */
units: number;
};
export type SetComputeUnitLimitInstructionDataArgs = {
/** Transaction-wide compute unit limit. */
units: number;
};
export function getSetComputeUnitLimitInstructionDataEncoder(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['units', getU32Encoder()],
]),
value => ({ ...value, discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR }),
);
}
export function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['units', getU32Decoder()],
]);
}
export function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<
SetComputeUnitLimitInstructionDataArgs,
SetComputeUnitLimitInstructionData
> {
return combineCodec(getSetComputeUnitLimitInstructionDataEncoder(), getSetComputeUnitLimitInstructionDataDecoder());
}
export type SetComputeUnitLimitInput = {
units: SetComputeUnitLimitInstructionDataArgs['units'];
};
export function getSetComputeUnitLimitInstruction<
TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
>(
input: SetComputeUnitLimitInput,
config?: { programAddress?: TProgramAddress },
): SetComputeUnitLimitInstruction<TProgramAddress> {
// Program address.
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
// Original args.
const args = { ...input };
return Object.freeze({
data: getSetComputeUnitLimitInstructionDataEncoder().encode(args as SetComputeUnitLimitInstructionDataArgs),
programAddress,
} as SetComputeUnitLimitInstruction<TProgramAddress>);
}
export type ParsedSetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {
programAddress: Address<TProgram>;
data: SetComputeUnitLimitInstructionData;
};
export function parseSetComputeUnitLimitInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedSetComputeUnitLimitInstruction<TProgram> {
return {
programAddress: instruction.programAddress,
data: getSetComputeUnitLimitInstructionDataDecoder().decode(instruction.data),
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
combineCodec,
getStructDecoder,
getStructEncoder,
getU64Decoder,
getU64Encoder,
getU8Decoder,
getU8Encoder,
transformEncoder,
type AccountMeta,
type Address,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
export const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
export function getSetComputeUnitPriceDiscriminatorBytes(): ReadonlyUint8Array {
return getU8Encoder().encode(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR);
}
export type SetComputeUnitPriceInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
export type SetComputeUnitPriceInstructionData = {
discriminator: number;
/** Transaction compute unit price used for prioritization fees. */
microLamports: bigint;
};
export type SetComputeUnitPriceInstructionDataArgs = {
/** Transaction compute unit price used for prioritization fees. */
microLamports: number | bigint;
};
export function getSetComputeUnitPriceInstructionDataEncoder(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['microLamports', getU64Encoder()],
]),
value => ({ ...value, discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR }),
);
}
export function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['microLamports', getU64Decoder()],
]);
}
export function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<
SetComputeUnitPriceInstructionDataArgs,
SetComputeUnitPriceInstructionData
> {
return combineCodec(getSetComputeUnitPriceInstructionDataEncoder(), getSetComputeUnitPriceInstructionDataDecoder());
}
export type SetComputeUnitPriceInput = {
microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];
};
export function getSetComputeUnitPriceInstruction<
TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
>(
input: SetComputeUnitPriceInput,
config?: { programAddress?: TProgramAddress },
): SetComputeUnitPriceInstruction<TProgramAddress> {
// Program address.
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
// Original args.
const args = { ...input };
return Object.freeze({
data: getSetComputeUnitPriceInstructionDataEncoder().encode(args as SetComputeUnitPriceInstructionDataArgs),
programAddress,
} as SetComputeUnitPriceInstruction<TProgramAddress>);
}
export type ParsedSetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {
programAddress: Address<TProgram>;
data: SetComputeUnitPriceInstructionData;
};
export function parseSetComputeUnitPriceInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedSetComputeUnitPriceInstruction<TProgram> {
return {
programAddress: instruction.programAddress,
data: getSetComputeUnitPriceInstructionDataDecoder().decode(instruction.data),
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
combineCodec,
getStructDecoder,
getStructEncoder,
getU32Decoder,
getU32Encoder,
getU8Decoder,
getU8Encoder,
transformEncoder,
type AccountMeta,
type Address,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
export const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
export function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): ReadonlyUint8Array {
return getU8Encoder().encode(SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR);
}
export type SetLoadedAccountsDataSizeLimitInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;
export type SetLoadedAccountsDataSizeLimitInstructionData = { discriminator: number; accountDataSizeLimit: number };
export type SetLoadedAccountsDataSizeLimitInstructionDataArgs = { accountDataSizeLimit: number };
export function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['accountDataSizeLimit', getU32Encoder()],
]),
value => ({ ...value, discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR }),
);
}
export function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['accountDataSizeLimit', getU32Decoder()],
]);
}
export function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<
SetLoadedAccountsDataSizeLimitInstructionDataArgs,
SetLoadedAccountsDataSizeLimitInstructionData
> {
return combineCodec(
getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),
getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(),
);
}
export type SetLoadedAccountsDataSizeLimitInput = {
accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];
};
export function getSetLoadedAccountsDataSizeLimitInstruction<
TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
>(
input: SetLoadedAccountsDataSizeLimitInput,
config?: { programAddress?: TProgramAddress },
): SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress> {
// Program address.
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
// Original args.
const args = { ...input };
return Object.freeze({
data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(
args as SetLoadedAccountsDataSizeLimitInstructionDataArgs,
),
programAddress,
} as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>);
}
export type ParsedSetLoadedAccountsDataSizeLimitInstruction<
TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,
> = { programAddress: Address<TProgram>; data: SetLoadedAccountsDataSizeLimitInstructionData };
export function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {
return {
programAddress: instruction.programAddress,
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(instruction.data),
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import {
containsBytes,
extendClient,
getU8Encoder,
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
SolanaError,
type Address,
type ClientWithTransactionPlanning,
type ClientWithTransactionSending,
type Instruction,
type InstructionWithData,
type ReadonlyUint8Array,
} from '@solana/kit';
import { addSelfPlanAndSendFunctions, type SelfPlanAndSendFunctions } from '@solana/kit/program-client-core';
import {
getRequestHeapFrameInstruction,
getRequestUnitsInstruction,
getSetComputeUnitLimitInstruction,
getSetComputeUnitPriceInstruction,
getSetLoadedAccountsDataSizeLimitInstruction,
parseRequestHeapFrameInstruction,
parseRequestUnitsInstruction,
parseSetComputeUnitLimitInstruction,
parseSetComputeUnitPriceInstruction,
parseSetLoadedAccountsDataSizeLimitInstruction,
type ParsedRequestHeapFrameInstruction,
type ParsedRequestUnitsInstruction,
type ParsedSetComputeUnitLimitInstruction,
type ParsedSetComputeUnitPriceInstruction,
type ParsedSetLoadedAccountsDataSizeLimitInstruction,
type RequestHeapFrameInput,
type RequestUnitsInput,
type SetComputeUnitLimitInput,
type SetComputeUnitPriceInput,
type SetLoadedAccountsDataSizeLimitInput,
} from '../instructions';
export const COMPUTE_BUDGET_PROGRAM_ADDRESS =
'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;
export enum ComputeBudgetInstruction {
RequestUnits,
RequestHeapFrame,
SetComputeUnitLimit,
SetComputeUnitPrice,
SetLoadedAccountsDataSizeLimit,
}
export function identifyComputeBudgetInstruction(
instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
): ComputeBudgetInstruction {
const data = 'data' in instruction ? instruction.data : instruction;
if (containsBytes(data, getU8Encoder().encode(0), 0)) {
return ComputeBudgetInstruction.RequestUnits;
}
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
return ComputeBudgetInstruction.RequestHeapFrame;
}
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
return ComputeBudgetInstruction.SetComputeUnitLimit;
}
if (containsBytes(data, getU8Encoder().encode(3), 0)) {
return ComputeBudgetInstruction.SetComputeUnitPrice;
}
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
return ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;
}
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
instructionData: data,
programName: 'computeBudget',
});
}
export type ParsedComputeBudgetInstruction<TProgram extends string = 'ComputeBudget111111111111111111111111111111'> =
| ({ instructionType: ComputeBudgetInstruction.RequestUnits } & ParsedRequestUnitsInstruction<TProgram>)
| ({ instructionType: ComputeBudgetInstruction.RequestHeapFrame } & ParsedRequestHeapFrameInstruction<TProgram>)
| ({
instructionType: ComputeBudgetInstruction.SetComputeUnitLimit;
} & ParsedSetComputeUnitLimitInstruction<TProgram>)
| ({
instructionType: ComputeBudgetInstruction.SetComputeUnitPrice;
} & ParsedSetComputeUnitPriceInstruction<TProgram>)
| ({
instructionType: ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;
} & ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>);
export function parseComputeBudgetInstruction<TProgram extends string>(
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
): ParsedComputeBudgetInstruction<TProgram> {
const instructionType = identifyComputeBudgetInstruction(instruction);
switch (instructionType) {
case ComputeBudgetInstruction.RequestUnits: {
return {
instructionType: ComputeBudgetInstruction.RequestUnits,
...parseRequestUnitsInstruction(instruction),
};
}
case ComputeBudgetInstruction.RequestHeapFrame: {
return {
instructionType: ComputeBudgetInstruction.RequestHeapFrame,
...parseRequestHeapFrameInstruction(instruction),
};
}
case ComputeBudgetInstruction.SetComputeUnitLimit: {
return {
instructionType: ComputeBudgetInstruction.SetComputeUnitLimit,
...parseSetComputeUnitLimitInstruction(instruction),
};
}
case ComputeBudgetInstruction.SetComputeUnitPrice: {
return {
instructionType: ComputeBudgetInstruction.SetComputeUnitPrice,
...parseSetComputeUnitPriceInstruction(instruction),
};
}
case ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit: {
return {
instructionType: ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit,
...parseSetLoadedAccountsDataSizeLimitInstruction(instruction),
};
}
default:
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
instructionType: instructionType as string,
programName: 'computeBudget',
});
}
}
export type ComputeBudgetPlugin = { instructions: ComputeBudgetPluginInstructions };
export type ComputeBudgetPluginInstructions = {
requestUnits: (
input: RequestUnitsInput,
) => ReturnType<typeof getRequestUnitsInstruction> & SelfPlanAndSendFunctions;
requestHeapFrame: (
input: RequestHeapFrameInput,
) => ReturnType<typeof getRequestHeapFrameInstruction> & SelfPlanAndSendFunctions;
setComputeUnitLimit: (
input: SetComputeUnitLimitInput,
) => ReturnType<typeof getSetComputeUnitLimitInstruction> & SelfPlanAndSendFunctions;
setComputeUnitPrice: (
input: SetComputeUnitPriceInput,
) => ReturnType<typeof getSetComputeUnitPriceInstruction> & SelfPlanAndSendFunctions;
setLoadedAccountsDataSizeLimit: (
input: SetLoadedAccountsDataSizeLimitInput,
) => ReturnType<typeof getSetLoadedAccountsDataSizeLimitInstruction> & SelfPlanAndSendFunctions;
};
export type ComputeBudgetPluginRequirements = ClientWithTransactionPlanning & ClientWithTransactionSending;
export function computeBudgetProgram() {
return <T extends ComputeBudgetPluginRequirements>(
client: T,
): Omit<T, 'computeBudget'> & { computeBudget: ComputeBudgetPlugin } => {
return extendClient(client, {
computeBudget: <ComputeBudgetPlugin>{
instructions: {
requestUnits: input => addSelfPlanAndSendFunctions(client, getRequestUnitsInstruction(input)),
requestHeapFrame: input =>
addSelfPlanAndSendFunctions(client, getRequestHeapFrameInstruction(input)),
setComputeUnitLimit: input =>
addSelfPlanAndSendFunctions(client, getSetComputeUnitLimitInstruction(input)),
setComputeUnitPrice: input =>
addSelfPlanAndSendFunctions(client, getSetComputeUnitPriceInstruction(input)),
setLoadedAccountsDataSizeLimit: input =>
addSelfPlanAndSendFunctions(client, getSetLoadedAccountsDataSizeLimitInstruction(input)),
},
},
});
};
}
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
export * from './computeBudget';
export * from './generated';
export * from './constants';
export * from './estimateAndSetComputeLimit';
export * from './estimateComputeLimit';
export * from './introspect';
export * from './setComputeLimit';
export * from './setComputePrice';
import {
TransactionMessage,
getU32Decoder,
getU64Decoder,
Instruction,
MicroLamports,
ReadonlyUint8Array,
} from '@solana/kit';
import {
COMPUTE_BUDGET_PROGRAM_ADDRESS,
ComputeBudgetInstruction,
identifyComputeBudgetInstruction,
SetComputeUnitLimitInstruction,
SetComputeUnitPriceInstruction,
} from './generated';
/**
* Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message
* and its set limit, if any.
*/
export function findSetComputeUnitLimitInstructionIndexAndUnits(
transactionMessage: TransactionMessage,
): { index: number; units: number } | null {
const index = transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);
if (index < 0) {
return null;
}
const units = getU32Decoder().decode(transactionMessage.instructions[index].data as ReadonlyUint8Array, 1);
return { index, units };
}
/**
* Checks if the given instruction is a `SetComputeUnitLimit` instruction.
*/
function isSetComputeUnitLimitInstruction(instruction: Instruction): instruction is SetComputeUnitLimitInstruction {
return (
instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&
identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===
ComputeBudgetInstruction.SetComputeUnitLimit
);
}
/**
* Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message
* and its set micro-lamports, if any.
*/
export function findSetComputeUnitPriceInstructionIndexAndMicroLamports(
transactionMessage: TransactionMessage,
): { index: number; microLamports: MicroLamports } | null {
const index = transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);
if (index < 0) {
return null;
}
const microLamports = getU64Decoder().decode(
transactionMessage.instructions[index].data as ReadonlyUint8Array,
1,
) as MicroLamports;
return { index, microLamports };
}
/**
* Checks if the given instruction is a `SetComputeUnitPrice` instruction.
*/
function isSetComputeUnitPriceInstruction(instruction: Instruction): instruction is SetComputeUnitPriceInstruction {
return (
instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&
identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===
ComputeBudgetInstruction.SetComputeUnitPrice
);
}
import { appendTransactionMessageInstruction, TransactionMessage } from '@solana/kit';
import { PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';
import { getSetComputeUnitLimitInstruction } from './generated';
import { findSetComputeUnitLimitInstructionIndexAndUnits } from './introspect';
/**
* Appends a `SetComputeUnitLimit` instruction with a provisory
* compute unit limit to a given transaction message
* if and only if it does not already have one.
*
* @example
* ```ts
* const transactionMessage = pipe(
* createTransactionMessage({ version: 0 }),
* fillProvisorySetComputeUnitLimitInstruction,
* // ...
* );
* ```
*/
export function fillProvisorySetComputeUnitLimitInstruction<TTransactionMessage extends TransactionMessage>(
transactionMessage: TTransactionMessage,
) {
return updateOrAppendSetComputeUnitLimitInstruction(
previousUnits => (previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits),
transactionMessage,
);
}
/**
* Updates the first `SetComputeUnitLimit` instruction in a transaction message
* with the given units, or appends a new instruction if none exists.
* A function of the current value can be provided instead of a static value.
*
* @param units - The new compute unit limit, or a function that takes the previous
* compute unit limit and returns the new limit.
* @param transactionMessage - The transaction message to update.
*
* @example
* ```ts
* const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(
* // E.g. Keep the current limit if it is set, otherwise set it to the maximum.
* (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,
* transactionMessage,
* );
* ```
*/
export function updateOrAppendSetComputeUnitLimitInstruction<TTransactionMessage extends TransactionMessage>(
units: number | ((previousUnits: number | null) => number),
transactionMessage: TTransactionMessage,
): TTransactionMessage {
const getUnits = (previousUnits: number | null): number =>
typeof units === 'function' ? units(previousUnits) : units;
const instructionDetails = findSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);
if (!instructionDetails) {
return appendTransactionMessageInstruction(
getSetComputeUnitLimitInstruction({ units: getUnits(null) }),
transactionMessage,
) as TTransactionMessage;
}
const { index, units: previousUnits } = instructionDetails;
const newUnits = getUnits(previousUnits);
if (newUnits === previousUnits) {
return transactionMessage;
}
const newInstruction = getSetComputeUnitLimitInstruction({ units: newUnits });
const newInstructions = [...transactionMessage.instructions];
newInstructions.splice(index, 1, newInstruction);
return Object.freeze({
...transactionMessage,
instructions: newInstructions,
}) as TTransactionMessage;
}
import { appendTransactionMessageInstruction, TransactionMessage, MicroLamports } from '@solana/kit';
import { getSetComputeUnitPriceInstruction } from './generated';
import { findSetComputeUnitPriceInstructionIndexAndMicroLamports } from './introspect';
/**
* Sets the compute unit price of a transaction message in micro-Lamports.
*
* @example
* ```ts
* const transactionMessage = pipe(
* createTransactionMessage({ version: 0 }),
* (m) => setTransactionMessageComputeUnitPrice(10_000, m),
* // ...
* );
* ```
*/
export function setTransactionMessageComputeUnitPrice<TTransactionMessage extends TransactionMessage>(
microLamports: number | bigint,
transactionMessage: TTransactionMessage,
) {
return appendTransactionMessageInstruction(
getSetComputeUnitPriceInstruction({ microLamports }),
transactionMessage,
);
}
/**
* Updates the first `SetComputeUnitPrice` instruction in a transaction message
* with the given micro-Lamports, or appends a new instruction if none exists.
* A function of the current value can be provided instead of a static value.
*
* @param microLamports - The new compute unit price, or a function that
* takes the previous price and returns the new one.
* @param transactionMessage - The transaction message to update.
*
* @example
* ```ts
* const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(
* // E.g. double the current price or set it to 10_000 if it isn't set.
* (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,
* transactionMessage,
* );
* ```
*/
export function updateOrAppendSetComputeUnitPriceInstruction<TTransactionMessage extends TransactionMessage>(
microLamports: MicroLamports | ((previousMicroLamports: MicroLamports | null) => MicroLamports),
transactionMessage: TTransactionMessage,
): TTransactionMessage {
const getMicroLamports = (previousMicroLamports: MicroLamports | null): MicroLamports =>
typeof microLamports === 'function' ? microLamports(previousMicroLamports) : microLamports;
const instructionDetails = findSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage);
if (!instructionDetails) {
return appendTransactionMessageInstruction(
getSetComputeUnitPriceInstruction({
microLamports: getMicroLamports(null),
}),
transactionMessage,
) as TTransactionMessage;
}
const { index, microLamports: previousMicroLamports } = instructionDetails;
const newMicroLamports = getMicroLamports(previousMicroLamports);
if (newMicroLamports === previousMicroLamports) {
return transactionMessage;
}
const newInstruction = getSetComputeUnitPriceInstruction({
microLamports: newMicroLamports,
});
const newInstructions = [...transactionMessage.instructions];
newInstructions.splice(index, 1, newInstruction);
return Object.freeze({
...transactionMessage,
instructions: newInstructions,
}) as TTransactionMessage;
}
+2
-3

@@ -80,4 +80,3 @@ 'use strict';

return (client) => {
return {
...client,
return kit.extendClient(client, {
computeBudget: {

@@ -92,3 +91,3 @@ instructions: {

}
};
});
};

@@ -95,0 +94,0 @@ }

+3
-4

@@ -1,2 +0,2 @@

import { containsBytes, getU8Encoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, transformEncoder, getStructEncoder, getU32Encoder, getStructDecoder, getU8Decoder, getU32Decoder, combineCodec, getU64Encoder, getU64Decoder, appendTransactionMessageInstruction, isTransactionMessageWithDurableNonceLifetime, pipe, compileTransaction, getBase64EncodedWireTransaction, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, getSolanaErrorFromTransactionError, isSolanaError } from '@solana/kit';
import { containsBytes, getU8Encoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, extendClient, transformEncoder, getStructEncoder, getU32Encoder, getStructDecoder, getU8Decoder, getU32Decoder, combineCodec, getU64Encoder, getU64Decoder, appendTransactionMessageInstruction, isTransactionMessageWithDurableNonceLifetime, pipe, compileTransaction, getBase64EncodedWireTransaction, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, getSolanaErrorFromTransactionError, isSolanaError } from '@solana/kit';
import { addSelfPlanAndSendFunctions } from '@solana/kit/program-client-core';

@@ -78,4 +78,3 @@

return (client) => {
return {
...client,
return extendClient(client, {
computeBudget: {

@@ -90,3 +89,3 @@ instructions: {

}
};
});
};

@@ -93,0 +92,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,EACH,uCAAuC,EACvC,6CAA6C,EAChD,MAAM,gCAAgC,CAAC;AAIxC,KAAK,yDAAyD,GAAG,CAC7D,mBAAmB,SAAS,kBAAkB,GAAG,8BAA8B,EAE/E,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,6CAA6C,KACrD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC7D,wBAAwB,EAAE,uCAAuC,GAClE,yDAAyD,CAoB3D"}
{"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAGjF,OAAO,EACH,uCAAuC,EACvC,6CAA6C,EAChD,MAAM,gCAAgC,CAAC;AAIxC,KAAK,yDAAyD,GAAG,CAC7D,mBAAmB,SAAS,kBAAkB,GAAG,8BAA8B,EAE/E,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,6CAA6C,KACrD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC7D,wBAAwB,EAAE,uCAAuC,GAClE,yDAAyD,CAoB3D"}

@@ -1,1 +0,1 @@

{"version":3,"file":"estimateComputeLimitInternal.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimitInternal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAClB,UAAU,EAOV,GAAG,EAEH,sBAAsB,EACtB,IAAI,EAKJ,8BAA8B,EACjC,MAAM,aAAa,CAAC;AAIrB,MAAM,MAAM,qCAAqC,GAAG,QAAQ,CAAC;IACzD,uFAAuF;IACvF,GAAG,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,uCAAuC,GAAG,CAClD,kBAAkB,EAAE,kBAAkB,GAAG,8BAA8B,EACvE,MAAM,CAAC,EAAE,6CAA6C,KACrD,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,MAAM,6CAA6C,GAAG;IACxD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,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,kBAAkB,GAAG,8BAA8B,CAAC;CAC3E,CAAC,CAAC;AAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,wBAAwB,CAAC,EAC3C,kBAAkB,EAClB,GAAG,OAAO,EACb,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAalD"}

@@ -11,3 +11,3 @@ /**

export declare const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;
export declare function getRequestHeapFrameDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
export declare function getRequestHeapFrameDiscriminatorBytes(): ReadonlyUint8Array;
export type RequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;

@@ -14,0 +14,0 @@ export type RequestHeapFrameInstructionData = {

@@ -1,1 +0,1 @@

{"version":3,"file":"requestHeapFrame.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestHeapFrame.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,wBAAgB,qCAAqC,oCAEpD;AAED,MAAM,MAAM,2BAA2B,CACnC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9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AAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,2BAA2B,CAAC,eAAe,CAAC,CAW9C;AAED,MAAM,MAAM,iCAAiC,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAAI;IAC7G,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,+BAA+B,CAAC;CACzC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EACpE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,iCAAiC,CAAC,QAAQ,CAAC,CAK7C"}

@@ -11,3 +11,3 @@ /**

export declare const REQUEST_UNITS_DISCRIMINATOR = 0;
export declare function getRequestUnitsDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
export declare function getRequestUnitsDiscriminatorBytes(): ReadonlyUint8Array;
export type RequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;

@@ -14,0 +14,0 @@ export type RequestUnitsInstructionData = {

@@ -1,1 +0,1 @@

{"version":3,"file":"requestUnits.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestUnits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7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EF,wBAAgB,qCAAqC,IAAI,gBAAgB,CAAC,+BAA+B,CAAC,CASzG;AAED,wBAAgB,qCAAqC,IAAI,gBAAgB,CAAC,2BAA2B,CAAC,CAMrG;AAED,wBAAgB,mCAAmC,IAAI,cAAc,CACjE,+BAA+B,EAC/B,2BAA2B,CAC9B,CAEA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC5B,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAChD,aAAa,EAAE,+BAA+B,CAAC,eAAe,CAAC,CAAC;CACnE,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAC9G,KAAK,EAAE,iBAAiB,EACxB,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,uBAAuB,CAAC,eAAe,CAAC,CAW1C;AAED,MAAM,MAAM,6BAA6B,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAAI;IACzG,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,2BAA2B,CAAC;CACrC,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,QAAQ,SAAS,MAAM,EAChE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,6BAA6B,CAAC,QAAQ,CAAC,CAKzC"}

@@ -11,3 +11,3 @@ /**

export declare const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;
export declare function getSetComputeUnitLimitDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
export declare function getSetComputeUnitLimitDiscriminatorBytes(): ReadonlyUint8Array;
export type SetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;

@@ -14,0 +14,0 @@ export type SetComputeUnitLimitInstructionData = {

@@ -1,1 +0,1 @@

{"version":3,"file":"setComputeUnitLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,wBAAgB,wCAAwC,oCAEvD;AAED,MAAM,MAAM,8BAA8B,CACtC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAElH,MAAM,MAAM,kCAAkC,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACjD,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,sCAAsC,CAAC,CAQvH;AAED,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,kCAAkC,CAAC,CAKnH;AAED,wBAAgB,0CAA0C,IAAI,cAAc,CACxE,sCAAsC,EACtC,kCAAkC,CACrC,CAEA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,EAAE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ReadonlyUint8Array<ArrayBuffer>;
export declare function getSetComputeUnitPriceDiscriminatorBytes(): ReadonlyUint8Array;
export type SetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;

@@ -14,0 +14,0 @@ export type SetComputeUnitPriceInstructionData = {

@@ -1,1 +0,1 @@

{"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,wBAAgB,wCAAwC,oCAEvD;AAED,MAAM,MAAM,8BAA8B,CACtC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAElH,MAAM,MAAM,kCAAkC,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACjD,mEAAmE;IACnE,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC,CAAC;AAEF,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mC,CAAC,QAAQ,SAAS,MAAM,EACvE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,oCAAoC,CAAC,QAAQ,CAAC,CAKhD"}

@@ -11,3 +11,3 @@ /**

export declare const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): ReadonlyUint8Array;
export type SetLoadedAccountsDataSizeLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;

@@ -14,0 +14,0 @@ export type SetLoadedAccountsDataSizeLimitInstructionData = {

@@ -1,1 +0,1 @@

{"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,iDAAiD,IAAI,CAAC;AAEnE,wBAAgB,mDAAmD,oCAElE;AAED,MAAM,MAAM,yCAAyC,CACjD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAA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;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,yCAAyC,CAAC,eAAe,CAAC,CAa5D;AAED,MAAM,MAAM,+CAA+C,CACvD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC/D;IAAE,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAAC,IAAI,EAAE,6CAA6C,CAAA;CAAE,CAAC;AAE/F,wBAAgB,8CAA8C,CAAC,QAAQ,SAAS,MAAM,EAClF,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,+CAA+C,CAAC,QAAQ,CAAC,CAK3D"}

@@ -45,5 +45,5 @@ /**

export type ComputeBudgetPluginRequirements = ClientWithTransactionPlanning & ClientWithTransactionSending;
export declare function computeBudgetProgram(): <T extends ComputeBudgetPluginRequirements>(client: T) => T & {
export declare function computeBudgetProgram(): <T extends ComputeBudgetPluginRequirements>(client: T) => Omit<T, "computeBudget"> & {
computeBudget: ComputeBudgetPlugin;
};
//# sourceMappingURL=computeBudget.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"computeBudget.d.ts","sourceRoot":"","sources":["../../../../src/generated/programs/computeBudget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAMH,KAAK,OAAO,EACZ,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAA+B,KAAK,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EACH,8BAA8B,EAC9B,0BAA0B,EAC1B,iCAAiC,EACjC,iCAAiC,EACjC,4CAA4C,EAM5C,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EACzC,KAAK,+CAA+C,EACpD,KAAK,qBAAqB,EAC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CACnE,kBAAkB,EAAE,kBAAkB,GACvC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD"}
{"version":3,"file":"introspect.d.ts","sourceRoot":"","sources":["../../src/introspect.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAIlB,aAAa,EAEhB,MAAM,aAAa,CAAC;AAUrB;;;GAGG;AACH,wBAAgB,+CAA+C,CAC3D,kBAAkB,EAAE,kBAAkB,GACvC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CASzC;AAaD;;;GAGG;AACH,wBAAgB,uDAAuD,CACnE,kBAAkB,EAAE,kBAAkB,GACvC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD"}

@@ -1,1 +0,1 @@

{"version":3,"file":"setComputeLimit.d.ts","sourceRoot":"","sources":["../../src/setComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CAAC,mBAAmB,SAAS,kBAAkB,EACtG,kBAAkB,EAAE,mBAAmB,uBAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,kBAAkB,EACvG,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,EAC1D,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAyBrB"}
{"version":3,"file":"setComputeLimit.d.ts","sourceRoot":"","sources":["../../src/setComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMtF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CAAC,mBAAmB,SAAS,kBAAkB,EACtG,kBAAkB,EAAE,mBAAmB,uBAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,kBAAkB,EACvG,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,EAC1D,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAyBrB"}

@@ -1,1 +0,1 @@

{"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIrG;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CAAC,mBAAmB,SAAS,kBAAkB,EAChG,aAAa,EAAE,MAAM,GAAG,MAAM,EAC9B,kBAAkB,EAAE,mBAAmB;;UAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,kBAAkB,EACvG,aAAa,EAAE,aAAa,GAAG,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EAC/F,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CA6BrB"}
{"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKrG;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CAAC,mBAAmB,SAAS,kBAAkB,EAChG,aAAa,EAAE,MAAM,GAAG,MAAM,EAC9B,kBAAkB,EAAE,mBAAmB;;UAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,kBAAkB,EACvG,aAAa,EAAE,aAAa,GAAG,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EAC/F,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CA6BrB"}
{
"name": "@solana-program/compute-budget",
"version": "0.15.0",
"version": "0.16.0",
"description": "JavaScript client for the Compute Budget program",
"homepage": "https://github.com/solana-program/compute-budget#readme",
"bugs": {
"url": "https://github.com/solana-program/compute-budget/issues"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/solana-program/compute-budget.git"
},
"files": [
"./dist/src",
"./dist/types",
"./src/"
],
"type": "commonjs",
"sideEffects": false,
"main": "./dist/src/index.js",
"module": "./dist/src/index.mjs",
"main": "./dist/src/index.js",
"types": "./dist/types/index.d.ts",
"type": "commonjs",
"exports": {

@@ -17,6 +31,2 @@ ".": {

},
"files": [
"./dist/src",
"./dist/types"
],
"publishConfig": {

@@ -26,22 +36,11 @@ "access": "public",

},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/solana-program/compute-budget.git"
},
"bugs": {
"url": "https://github.com/solana-program/compute-budget/issues"
},
"homepage": "https://github.com/solana-program/compute-budget#readme",
"peerDependencies": {
"@solana/kit": "^6.3.0"
},
"devDependencies": {
"@solana/eslint-config-solana": "^3.0.3",
"@solana/kit": "^6.3.0",
"@solana-config/oxc": "^0.1.1",
"@solana/kit": "^6.4.0",
"@solana/kit-plugin-litesvm": "^0.10.0",
"@solana/kit-plugin-signer": "^0.10.0",
"@types/node": "^24",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^8.57.0",
"prettier": "^3.8.1",
"oxfmt": "^0.55.0",
"oxlint": "^1.70.0",
"oxlint-tsgolint": "^0.23.0",
"rimraf": "^5.0.5",

@@ -53,2 +52,8 @@ "tsup": "^8.1.2",

},
"peerDependencies": {
"@solana/kit": "^6.4.0"
},
"engines": {
"node": ">=24.0.0"
},
"scripts": {

@@ -59,7 +64,7 @@ "build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",

"test": "vitest run",
"lint": "eslint --ext js,ts,tsx src",
"lint:fix": "eslint --fix --ext js,ts,tsx src",
"format": "prettier --check src test",
"format:fix": "prettier --write src test"
"lint": "oxlint",
"lint:fix": "oxlint --fix",
"format": "oxfmt --check",
"format:fix": "oxfmt"
}
}

@@ -7,9 +7,9 @@ # JavaScript client

To build and test your JavaScript client from the root of the repository, you may use the following command.
The JS client tests use [LiteSVM](https://github.com/LiteSVM/litesvm) in-process, so no local validator is needed. To build and test your JavaScript client from the root of the repository, you may use the following command.
```sh
pnpm clients:js:test
make test-js-clients-js
```
This will start a new local validator, if one is not already running, and run the tests for your JavaScript client.
This installs dependencies, builds the client, and runs the test suite.

@@ -21,7 +21,2 @@ ## Available client scripts.

```sh
# Build your programs and start the validator.
pnpm programs:build
pnpm validator:restart
# Go into the client directory and run the tests.
cd clients/js

@@ -28,0 +23,0 @@ pnpm install

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display