transformTransactionPlan
Transforms a transaction plan tree using a bottom-up approach.
This function recursively traverses the transaction plan tree, applying the transformation function to each plan. The transformation is applied bottom-up, meaning nested plans are transformed first, then the parent plans receive the already-transformed children before being transformed themselves.
All transformed plans are frozen using Object.freeze to ensure immutability.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionPlan | TransactionPlan | The transaction plan tree to transform. |
fn | (plan) => TransactionPlan | A function that transforms each plan and returns a new plan. |
Returns
A new transformed transaction plan tree.
Examples
Removing parallelism by converting parallel plans to sequential.
Updating the fee payer on all transaction messages.