RollupsMachine
Interface
The RollupsMachine interface provides the main methods for interacting with a Cartesi rollup machine. It exposes generator-based methods for advance and inspect requests, as well as methods for shutting down and storing the machine state.
interface RollupsMachine {
advance(input: Uint8Array): IterableIterator<AdvanceYield>;
inspect(query: Uint8Array): IterableIterator<Uint8Array>;
shutdown(): void;
store(dir: string): RollupsMachine;
}advance
Sends an advance request to the machine. Yields outputs, reports, and progress updates as they are produced.
advance(input: Uint8Array): IterableIterator<AdvanceYield>
type AdvanceYield =
| { type: "output"; data: Uint8Array }
| { type: "report"; data: Uint8Array }
| { type: "progress"; data: number };- Throws
RollupsInputRejectedErrorif the input is rejected. - Throws
RollupsFatalErrorfor fatal machine errors.
inspect
Sends an inspect request to the machine. Yields each report (as a Uint8Array) produced by the inspect request.
inspect(query: Uint8Array): IterableIterator<Uint8Array>- Throws
RollupsInputRejectedErrorif the query is rejected. - Throws
RollupsFatalErrorfor fatal machine errors.
shutdown
Shuts down the underlying machine/server.
shutdown(): voidstore
Stores the current machine state to the specified directory.
store(dir: string): RollupsMachine