createTransactionPlanner

function createTransactionPlanner(config): TransactionPlanner;

Creates a new transaction planner based on the provided configuration.

At the very least, the createTransactionMessage function must be provided. This function is used to create new transaction messages whenever needed.

Additionally, the onTransactionMessageUpdated function can be provided to update transaction messages during the planning process. This function will be called whenever a transaction message is updated, e.g. when new instructions are added to a transaction message. It accepts the updated transaction message and must return a transaction message back, even if no changes were made.

Parameters

ParameterType
configTransactionPlannerConfig

Returns

TransactionPlanner

Example

const transactionPlanner = createTransactionPlanner({
  createTransactionMessage: () => pipe(
    createTransactionMessage({ version: 0 }),
    message => setTransactionMessageFeePayerSigner(mySigner, message),
  )
});

See

TransactionPlannerConfig

On this page