@exodus/solana-web3.js
Version:
Solana Javascript API
78 lines (77 loc) • 3 kB
TypeScript
import { PublicKey } from '../publickey.js';
import { TransactionInstruction } from '../transaction/index.js';
/**
* Compute Budget Instruction class
*/
export declare class ComputeBudgetInstruction {
/**
* Decode a compute budget instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): ComputeBudgetInstructionType;
/**
* Decode request units compute budget instruction and retrieve the instruction params.
*/
static decodeRequestUnits(instruction: TransactionInstruction): RequestUnitsParams;
/**
* Decode request heap frame compute budget instruction and retrieve the instruction params.
*/
static decodeRequestHeapFrame(instruction: TransactionInstruction): RequestHeapFrameParams;
/**
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
*/
static decodeSetComputeUnitLimit(instruction: TransactionInstruction): SetComputeUnitLimitParams;
/**
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
*/
static decodeSetComputeUnitPrice(instruction: TransactionInstruction): SetComputeUnitPriceParams;
}
/**
* An enumeration of valid ComputeBudgetInstructionType's
*/
export declare type ComputeBudgetInstructionType = 'RequestUnits' | 'RequestHeapFrame' | 'SetComputeUnitLimit' | 'SetComputeUnitPrice';
/**
* Request units instruction params
*/
export interface RequestUnitsParams {
/** Units to request for transaction-wide compute */
units: number;
/** Prioritization fee lamports */
additionalFee: number;
}
/**
* Request heap frame instruction params
*/
export declare type RequestHeapFrameParams = {
/** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
bytes: number;
};
/**
* Set compute unit limit instruction params
*/
export interface SetComputeUnitLimitParams {
/** Transaction-wide compute unit limit */
units: number;
}
/**
* Set compute unit price instruction params
*/
export interface SetComputeUnitPriceParams {
/** Transaction compute unit price used for prioritization fees */
microLamports: number | bigint;
}
/**
* Factory class for transaction instructions to interact with the Compute Budget program
*/
export declare class ComputeBudgetProgram {
/**
* Public key that identifies the Compute Budget program
*/
static programId: PublicKey;
/**
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
*/
static requestUnits(params: RequestUnitsParams): TransactionInstruction;
static requestHeapFrame(params: RequestHeapFrameParams): TransactionInstruction;
static setComputeUnitLimit(params: SetComputeUnitLimitParams): TransactionInstruction;
static setComputeUnitPrice(params: SetComputeUnitPriceParams): TransactionInstruction;
}