transformTransactionPlanResult
Transforms a transaction plan result tree using a bottom-up approach.
This function recursively traverses the transaction plan result tree, applying the transformation function to each result. The transformation is applied bottom-up, meaning nested results are transformed first, then the parent results receive the already-transformed children before being transformed themselves.
All transformed results are frozen using Object.freeze to ensure immutability.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionPlanResult | TransactionPlanResult | The transaction plan result tree to transform. |
fn | (plan) => TransactionPlanResult | A function that transforms each result and returns a new result. |
Returns
A new transformed transaction plan result tree.
Example
Converting all canceled results to failed results.