assertIsSingleTransactionPlanResult

function assertIsSingleTransactionPlanResult(
    plan,
): asserts plan is Readonly<{
    kind: 'single';
    message: TransactionMessage &
        TransactionMessageWithFeePayer<string>;
    status: TransactionPlanResultStatus<TransactionPlanResultContext>;
}>;

Asserts that the given transaction plan result is a SingleTransactionPlanResult.

Parameters

ParameterTypeDescription
planTransactionPlanResultThe transaction plan result to assert.

Returns

asserts plan is Readonly<{ kind: "single"; message: TransactionMessage & TransactionMessageWithFeePayer<string>; status: TransactionPlanResultStatus<TransactionPlanResultContext> }>

Throws

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

Example

const result: TransactionPlanResult = successfulSingleTransactionPlanResult(message, transaction);
 
assertIsSingleTransactionPlanResult(result);
console.log(result.status.kind); // TypeScript knows this is a SingleTransactionPlanResult.

See

On this page