TransactionPlannerConfig

type TransactionPlannerConfig = object;

Configuration object for creating a new transaction planner.

See

createTransactionPlanner

Properties

createTransactionMessage

createTransactionMessage: CreateTransactionMessage;

Called whenever a new transaction message is needed.


maxInstructionsPerTransaction?

maxInstructionsPerTransaction?: number;

Maximum number of instructions allowed in each planned transaction.

This includes any instructions already present in messages returned by createTransactionMessage and any instructions added by onTransactionMessageUpdated.

Must be a positive integer no greater than 64 — the number of top-level instructions the transaction format can encode. Larger values throw SOLANA_ERROR__INSTRUCTION_PLANS__INVALID_MAX_INSTRUCTIONS_PER_TRANSACTION. Defaults to 16.


onTransactionMessageUpdated?

onTransactionMessageUpdated?: OnTransactionMessageUpdated;

Called whenever a transaction message is updated — e.g. new instructions were added. This function must return the updated transaction message back — even if no changes were made.

Note that it may be called several times on the same message, including on candidate messages that the planner later discards because they do not fit. It should therefore be idempotent, e.g. only adding an instruction if the message does not already contain it.

On this page