findTransactionPlanResult
Finds the first transaction plan result in the tree that matches the given predicate.
This function performs a depth-first search through the transaction plan result tree, returning the first result that satisfies the predicate. It checks the root result first, then recursively searches through nested results.
Type Parameters
| Type Parameter | Default type |
|---|---|
TContext extends TransactionPlanResultContext | TransactionPlanResultContext |
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionPlanResult | TransactionPlanResult<TContext> | The transaction plan result tree to search. |
predicate | (result) => boolean | A function that returns true for the result to find. |
Returns
| TransactionPlanResult<TContext, Readonly<{
kind: "single";
message: TransactionMessage & TransactionMessageWithFeePayer<string>;
status: TransactionPlanResultStatus<TContext>;
}>>
| undefined
The first matching transaction plan result, or undefined if no match is found.
Example
Finding a failed transaction result.