Skip to content

Micro-Rollup

The star of the show

The micro-rollup utility is the hero of the Stackr framework

A micro-rollup is initialized this -

index.ts
import { MicroRollup } from "@stackr/sdk";
/* ... other imports ... */
 
const rollup = await MicroRollup({
  config: stackrConfig,
  stateMachines: [machine],
});
 
await rollup.init();

The Micro-rollup object takes in 2 main parameters -

  1. config - The stackr configuration object

all the details that you set in the stackr.config.ts file is passed to the micro-rollup like this. It uses this configuration to set up the environment for the rollup and instantiate the Sequencer, Executor and Syncer.

  1. stateMachines - The state machine

The state machine is the heart of the rollup. It defines the state transition rules and the actions that can be performed in each state.

Optional parameters

The Micro-Rollup object also takes in 1 optional parameter -

  1. blockHooks - An object containing two keys pre and post both being ordered array of names of the hooks to execute with each block.