Skip to main content

StatefulGameHelper

@totemsdk/core


@totemsdk/core / StatefulGameHelper

Class: StatefulGameHelper

Stateful Game Helper

Creates multi-round stateful contracts (like coin flip).

Constructors

Constructor

new StatefulGameHelper(): StatefulGameHelper

Returns

StatefulGameHelper

Methods

buildNextRoundState()

static buildNextRoundState(currentRound, preservedPorts, newStates): StateValue[]

Build state for next round.

Parameters

currentRound

number

preservedPorts

number[]

newStates

StateValue[]

Returns

StateValue[]


createRoundCheck()

static createRoundCheck(): string

Create a round increment assertion.

Returns

string


validateRound()

static validateRound(previousRound, currentRound): boolean

Validate round progression.

Parameters

previousRound

number

currentRound

number

Returns

boolean