Skip to content

Function: getJobsInstructionComputeUnits()

ts
function getJobsInstructionComputeUnits(instruction): number;

Resolve the compute-unit cost of a jobs instruction by matching its 8-byte Anchor discriminator against the generated JOBS_COMPUTE_UNITS table.

Works on any raw Instruction regardless of how it was built, so it can price a mixed batch. Returns a default value for instructions that are not jobs instructions (or whose cost has not been measured), letting the caller apply a fallback.

Parameters

ParameterTypeDescription
instructionInstructionThe instruction to price.

Returns

number

The estimated compute units, or a default value if unknown.