isSuccessfulTransactionPlanResult

function isSuccessfulTransactionPlanResult(
    plan,
): plan is SuccessfulTransactionPlanResult<TransactionPlanResultContext>;

Checks if the given transaction plan result is a SuccessfulTransactionPlanResult.

This function verifies that the entire transaction plan result tree contains only successful single transaction results. It recursively checks all nested results to ensure every SingleTransactionPlanResult has a 'successful' status.

Note: This is different from isSuccessfulSingleTransactionPlanResult which checks if a single result is successful. This function checks that the entire plan result tree (including all nested parallel/sequential structures) contains only successful transactions.

Parameters

ParameterTypeDescription
planTransactionPlanResultThe transaction plan result to check.

Returns

plan is SuccessfulTransactionPlanResult<TransactionPlanResultContext>

true if all single transaction results in the tree are successful, false otherwise.

Example

const result: TransactionPlanResult = parallelTransactionPlanResult([
  successfulSingleTransactionPlanResult(messageA, transactionA),
  successfulSingleTransactionPlanResult(messageB, transactionB),
]);
 
if (isSuccessfulTransactionPlanResult(result)) {
  // All transactions were successful.
  result satisfies SuccessfulTransactionPlanResult;
}

See

On this page