Documentation
¶
Overview ¶
Package computebudget provides typed instruction builders for the Solana ComputeBudget program.
ComputeBudget instructions do not take account inputs; they are metadata instructions that tune the compute unit limit, the priority fee per compute unit, and the program heap size for the containing transaction. Include one or more at the start of your instruction list to control your transaction's resource budget.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProgramID = solana.MustPublicKey("ComputeBudget111111111111111111111111111111")
ProgramID is the canonical address of the Solana ComputeBudget program: ComputeBudget111111111111111111111111111111.
Functions ¶
func NewRequestHeapFrame ¶
func NewRequestHeapFrame(bytes uint32) solana.Instruction
NewRequestHeapFrame builds an instruction that requests a larger program heap. The size must be a multiple of 1024 and is capped at 256 KiB by the runtime. Most programs do not need this.
func NewSetComputeUnitLimit ¶
func NewSetComputeUnitLimit(units uint32) solana.Instruction
NewSetComputeUnitLimit builds an instruction that sets the compute unit limit for the containing transaction. Transactions that omit this instruction get Solana's default limit (200,000 CUs as of late 2024). Specifying a tighter limit reduces the priority fee you pay at a given per-CU price and makes your transaction more competitive.
func NewSetComputeUnitPrice ¶
func NewSetComputeUnitPrice(microLamports uint64) solana.Instruction
NewSetComputeUnitPrice builds an instruction that sets the price the caller is willing to pay per compute unit, in micro-lamports (1 lamport = 1,000,000 micro-lamports). This is the Solana equivalent of an EVM priority fee. Pick a reasonable value by calling Client.GetRecentPrioritizationFees and summarising with helpers.PriorityFeeStatsFromFees.
Types ¶
This section is empty.