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 | Description |
|---|---|---|
TContext extends TransactionPlanResultContext | TransactionPlanResultContext | The type of the context object that may be passed along with results |
TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer<string> | TransactionMessage & TransactionMessageWithFeePayer<string> | The type of the transaction message |
TSingle extends SingleTransactionPlanResult<TContext, TTransactionMessage> | SingleTransactionPlanResult<TContext, TTransactionMessage> | The type of single transaction plan results in this tree |
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionPlanResult | TransactionPlanResult<TContext, TTransactionMessage, TSingle> | The transaction plan result tree to search. |
predicate | (result) => boolean | A function that returns true for the result to find. |
Returns
| TransactionPlanResult<TContext, TTransactionMessage, TSingle>
| undefined
The first matching transaction plan result, or undefined if no match is found.
Example
Finding a failed transaction result.