assertIsSingleInstructionPlan

function assertIsSingleInstructionPlan(
    plan,
): asserts plan is Readonly<{
    instruction: Instruction;
    kind: 'single';
    planType: 'instructionPlan';
}>;

Asserts that the given instruction plan is a SingleInstructionPlan.

Parameters

ParameterTypeDescription
planInstructionPlanThe instruction plan to assert.

Returns

asserts plan is Readonly<{ instruction: Instruction; kind: "single"; planType: "instructionPlan" }>

Throws

Throws a SolanaError with code SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN if the plan is not a single instruction plan.

Example

const plan: InstructionPlan = singleInstructionPlan(myInstruction);
 
assertIsSingleInstructionPlan(plan);
console.log(plan.instruction); // TypeScript knows this is a SingleInstructionPlan.

See

On this page