SequentialTransactionPlan

type SequentialTransactionPlan = Readonly<{
  divisible: boolean;
  kind: "sequential";
  plans: TransactionPlan[];
}>;

A plan wrapping other plans that must be executed sequentially.

It also defines whether nested plans are divisible — meaning that the transaction messages inside them can be split into separate batches. When divisible is false, the transaction messages inside the plan should all be executed atomically — usually in a transaction bundle.

You may use the sequentialTransactionPlan and nonDivisibleSequentialTransactionPlan helpers to create objects of this type.

Examples

Simple sequential plan with two transaction messages.

const plan = sequentialTransactionPlan([messageA, messageB]);
plan satisfies SequentialTransactionPlan;

Non-divisible sequential plan with two transaction messages.

const plan = nonDivisibleSequentialTransactionPlan([messageA, messageB]);
plan satisfies SequentialTransactionPlan & { divisible: false };

Sequential plan with nested parallel plans. Here, messages A and B can be executed in parallel, but they must both be finalized before messages C and D can be sent — which can also be executed in parallel.

const plan = sequentialTransactionPlan([
  parallelTransactionPlan([messageA, messageB]),
  parallelTransactionPlan([messageC, messageD]),
]);

See

On this page