assertIsMessagePackerInstructionPlan

function assertIsMessagePackerInstructionPlan(
    plan,
): asserts plan is Readonly<{
    getMessagePacker: () => MessagePacker;
    kind: 'messagePacker';
    planType: 'instructionPlan';
}>;

Asserts that the given instruction plan is a MessagePackerInstructionPlan.

Parameters

ParameterTypeDescription
planInstructionPlanThe instruction plan to assert.

Returns

asserts plan is Readonly<{ getMessagePacker: () => MessagePacker; kind: "messagePacker"; planType: "instructionPlan" }>

Throws

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

Example

const plan: InstructionPlan = getLinearMessagePackerInstructionPlan({ /* ... */ });
 
assertIsMessagePackerInstructionPlan(plan);
const packer = plan.getMessagePacker(); // TypeScript knows this is a MessagePackerInstructionPlan.

See

On this page