assertIsSingleTransactionPlan

function assertIsSingleTransactionPlan(
    plan,
): asserts plan is Readonly<{
    kind: 'single';
    message: TransactionMessage &
        TransactionMessageWithFeePayer<string>;
    planType: 'transactionPlan';
}>;

Asserts that the given transaction plan is a SingleTransactionPlan.

Parameters

ParameterTypeDescription
planTransactionPlanThe transaction plan to assert.

Returns

asserts plan is Readonly<{ kind: "single"; message: TransactionMessage & TransactionMessageWithFeePayer<string>; planType: "transactionPlan" }>

Throws

Throws a SolanaError with code SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN if the plan is not a single transaction plan.

Example

const plan: TransactionPlan = singleTransactionPlan(transactionMessage);
 
assertIsSingleTransactionPlan(plan);
console.log(plan.message); // TypeScript knows this is a SingleTransactionPlan.

See

On this page