Stackr provides a comprehensive way to interact with your state. The state transition function is the only way to change the state.
It is a pure function that takes the current state and an action as arguments and returns the new state.
Do not perform any side effects or network calls in the state transition
function. It is a pure function.
These are inputs to the STF, the inputs from user are also similar though
Stackr calls transactions as Actions because it does not limit you to the type of transactions you can build.
You are in-charge. You can define any custom action types you want.Fun-fact - “Actions” were called “UserIntents” in the initial versions of Stackr but then another definition of “Intents” came out.
oof, the big one. This is where you define how your state changes when an action is performed.Stackr-JS comes with a STF interface that can be extended.
import { STF } from "@stackr/stackr-js/execution";export const veryEfficientSTF: STF<RollupState, ActionInput>;
You need to pass the state and action input types to the STF interface.
Currently the SDK only supports a single STF and the various types are handled using a switch statement,
However in the future, the Micro-rollups will be able to accept multiple different STFs