SequentialInstructionPlan

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

A plan wrapping other plans that must be executed sequentially.

It also defines whether nested plans are divisible — meaning that the instructions inside them can be split into separate transactions. When divisible is false, the instructions inside the plan should all be executed atomicly — either in a single transaction or in a transaction bundle.

You may use the sequentialInstructionPlan and nonDivisibleSequentialInstructionPlan helpers to create objects of this type.

Examples

const plan = sequentialInstructionPlan([instructionA, instructionB]);
plan satisfies SequentialInstructionPlan;
const plan = nonDivisibleSequentialInstructionPlan([instructionA, instructionB]);
plan satisfies SequentialInstructionPlan & { divisible: false };

Here, instructions A and B can be executed in parallel, but they must both be finalized before instructions C and D can be sent — which can also be executed in parallel.

const plan = sequentialInstructionPlan([
  parallelInstructionPlan([instructionA, instructionB]),
  parallelInstructionPlan([instructionC, instructionD]),
]);
plan satisfies SequentialInstructionPlan & { divisible: false };

See

On this page