isTransactionPlanResult

function isTransactionPlanResult(
    value,
): value is TransactionPlanResult<
    TransactionPlanResultContext,
    TransactionMessage & TransactionMessageWithFeePayer<string>,
    SingleTransactionPlanResult<
        TransactionPlanResultContext,
        TransactionMessage & TransactionMessageWithFeePayer<string>
    >
>;

Checks if the given value is a TransactionPlanResult.

This type guard checks the planType property to determine if the value is a transaction plan result. This is useful when you have a value that could be an InstructionPlan, TransactionPlan, or TransactionPlanResult and need to narrow the type.

Parameters

ParameterTypeDescription
valueunknownThe value to check.

Returns

value is TransactionPlanResult<TransactionPlanResultContext, TransactionMessage & TransactionMessageWithFeePayer<string>, SingleTransactionPlanResult<TransactionPlanResultContext, TransactionMessage & TransactionMessageWithFeePayer<string>>>

true if the value is a transaction plan result, false otherwise.

Example

function processItem(item: InstructionPlan | TransactionPlan | TransactionPlanResult) {
  if (isTransactionPlanResult(item)) {
    // item is narrowed to TransactionPlanResult
    console.log(item.kind);
  }
}

See

On this page