Skip to content

Types reference

All SDK types are defined and exported from the @rollerz/types package — it's the single source of truth for everything the SDK returns or accepts across all providers. @rollerz/sdk depends on it directly, so installing the SDK for IntelliSense is enough:

bash
npm install @rollerz/sdk --save-dev

If you want to reference named types in your own game code (e.g. Go3BetResult, StepperBetType, Currency), import them from @rollerz/types:

typescript
import type { Go3BetResult, StepperBetType, Currency } from '@rollerz/types';

TIP

For IntelliSense to work in VS Code, make sure your jsconfig.json / tsconfig.json (if you have one) lists "@rollerz/sdk" in compilerOptions.types. See the IntelliSense notes in Getting Started for the full rundown.


Core

InitOptions

Options passed to sdk.init().

FieldTypeExampleDescription
platformEventsRecord<string, (data?) => void>{ mute: ({ muted }) => {} }Callbacks for platform events — dispatched by data.type, invoked with the full flat message object
enableLoggingbooleantrueEnable SDK console logging

The parent-origin allowlist is build-time only (set via PLATFORM_ORIGINS env var) and is intentionally not exposed on InitOptions.

Currency

Used throughout the SDK for formatting monetary values.

FieldTypeExampleDescription
codestring'USD'Currency code
prefixstring'$'Symbol before the amount
suffixstring''Symbol after the amount
groupingstring','Thousands separator
decimalstring'.'Decimal separator
precisionnumber2Decimal places
denominationnumber100Smallest unit denominator (e.g. 100 for cents)

User

Payload returned by sdk.getUser() (and by the SDK server at POST /api/user). Amounts use the same smallest-unit convention as the rest of the SDK (e.g. cents).

typescript
import type { User } from '@rollerz/types';
FieldTypeDescription
balancenumberCurrent balance
currencyCurrencyFormatting metadata from the RGS
sessionIdstring (optional)Session identifier when present
playerAliasstring (optional)Display name from the RGS (playerAlias)
secondsnumber (optional)Session length in seconds (from GDK session)
roundsnumber (optional)Rounds played in the session
winLossnumber (optional)Session win/loss in smallest currency units

ReelsoftSessionFields

Optional fields merged from RGS responses into server-side provider session objects in TypeScript (Go3Session, GP / Stepper / Rippin Rumble sessions extend this). Games normally consume the shape via getUser() / User instead of reading these off the client session object.

FieldTypeDescription
playerAliasstring (optional)Same semantics as on User
secondsnumber (optional)Same as on User
roundsnumber (optional)Same as on User
winLossnumber (optional)Same as on User

GO3

Go3Session

Returned by sdk.go3.openGame().

FieldTypeExampleDescription
sessionIdstring'ses_xyz789'Session ID
requestCounternumber0Request counter
balancenumber10000Current balance (in smallest unit)
currencyCurrency{ code: 'USD', prefix: '$', ... }Currency formatting info
chipLevelsnumber[][100, 200, 500, 1000]Available bet amounts
minBetnumber100Minimum bet
maxBetnumber5000Maximum bet
defaultBetnumber200Default bet amount
boostedMultiplenumber2Multiplier applied to boosted bets

Go3BetResult

Returned by sdk.go3.placeBet().

FieldTypeExampleDescription
roundIdstring'rnd_abc123'Round ID (pass to collect())
balancenumber9800Balance after bet
totalBetAmountnumber200Total amount bet
totalWinAmountnumber600Total amount won
countnumber2Items hit (0–3)
multipliernumber3Win multiplier
hasBonusbooleantrueWhether a bonus was found
nextActionstring[]['collect']Valid next actions

Go3BetType

Union of the bet types Go3 supports. Passed as opts.betType to sdk.go3.placeBet() and sdk.go3.getValidBets().

typescript
type Go3BetType = 'BASE' | 'BOOSTED';

Paired constants:

ConstantValueDescription
GO3_BET_TYPESreadonly ['BASE', 'BOOSTED']Full ordered list — use with createBetSelector({ betTypes: GO3_BET_TYPES })
GO3_DEFAULT_BET_TYPE'BASE'The bet type placeBet falls through to when no opts are passed
GO3_BOOSTED_BET_TYPE'BOOSTED'The bet type the legacy { boosted: true } sugar resolves to

Stepper

StepperSession

Returned by sdk.stepper.openGame().

FieldTypeExampleDescription
sessionIdstring'ses_xyz789'Session ID
requestCounternumber0Request counter
balancenumber10000Current balance (in smallest unit)
currencyCurrency{ code: 'USD', prefix: '$', ... }Currency formatting info
chipLevelsnumber[][5, 10, 25, 50]Available bet amounts
minBetnumber5Minimum bet
maxBetnumber500Maximum bet
defaultBetnumber10Default bet amount

StepperBetResult

Returned by sdk.stepper.placeBet() and sdk.stepper.step().

FieldTypeExampleDescription
roundIdstring'rnd_def456'Round ID (pass to step() or collect())
balancenumber9990Balance after action
totalBetAmountnumber10Total amount bet
totalWinAmountnumber25Total win (0 if crashed, payout if cashed out)
difficultystring'MEDIUM'Difficulty level
currentStepnumber3Current step number (0 after placeBet)
currentPayoutnumber2.80Payout if the player cashes out now
stepsStepperStep[]See belowFull step ladder with outcomes
roundEndedbooleanfalseWhether the round has ended
nextActionstring[]['CONTINUE', 'CASH_OUT']Valid next actions

StepperStep

Individual step in the ladder.

FieldTypeExampleDescription
stepnumber1Step number (1-based)
payoutnumber2.20Payout at this step
outcomestring'SAFE''UNDECIDED', 'SAFE', 'CRASH', or 'CASH_OUT'

StepperBetType

Union of the difficulty levels Stepper supports. Each level is a separate math model on the RGS — see the difficulty cheat sheet in the API reference for step counts and max multipliers.

typescript
type StepperBetType = 'BEGINNER' | 'EASY' | 'MEDIUM' | 'HARD' | 'INSANE';

Paired constants:

ConstantValueDescription
STEPPER_BET_TYPESreadonly ['BEGINNER', 'EASY', 'MEDIUM', 'HARD', 'INSANE']Full ordered list
STEPPER_DEFAULT_BET_TYPE'MEDIUM'The bet type placeBet falls through to when no opts are passed

Stepper does not support the legacy { boosted: true } sugar — pass betType explicitly to pick a non-default difficulty.


GP (General Purpose)

GPOpenOptions

Options passed to sdk.gp.openGame().

FieldTypeExampleDescription
serverUrlstring'https://math.example.com/mock'URL of the math server (required)
internalClientCodestring'go3'Game type identifier used by the math server (required)
pathstring'/gameevent/v2'Custom endpoint path — overrides the default /gameevent

GPSession

Returned by sdk.gp.openGame().

FieldTypeExampleDescription
sessionIdstring'ses_xyz789'Session ID
requestCounternumber0Request counter
balancenumber10000Current balance (in smallest unit)
currencyCurrency{ code: 'USD', prefix: '$', ... }Currency formatting info
chipLevelsnumber[][100, 200, 500, 1000]Available bet amounts
minBetnumber100Minimum bet
maxBetnumber5000Maximum bet
defaultBetnumber200Default bet amount
serverUrlstring'https://math.example.com/mock'Echoed from request
pathstring'/gameevent'Echoed from request (if provided)

GPBetResult

Returned by sdk.gp.placeBet().

FieldTypeExampleDescription
roundIdstring'rnd_abc123'Round ID (pass to collect())
balancenumber9800Balance after bet
totalBetAmountnumber200Total amount bet
totalWinAmountnumber600Total amount won
nextActionstring[]['collect']Valid next actions
mathRecord<string, unknown>{ details: { rocksCrushed: 2 } }Raw math server response (structure varies by server)

The math payload preserves the math server's wire field names verbatim — a GO3-compatible math server still sends rocksCrushed here, even though the native Go3BetResult surface renames it to count. The rename happens in sdk-server for the native GO3 route; GP is a pure pass-through.

GP bet types

GP intentionally exports no bet type union or constants — the set of bet types a GP session understands is decided at runtime by the hosting app. Register them via sdk.gp.configureBetTypes([...]) (see the API reference). When called, betType is typed as string throughout the GP API.


Rippin Rumble

RippinRumbleSession

Returned by sdk.rippinrumble.openGame().

FieldTypeExampleDescription
sessionIdstring'ses_xyz789'Session ID
requestCounternumber0Request counter
balancenumber10000Current balance (in smallest unit)
currencyCurrency{ code: 'USD', prefix: '$', ... }Currency formatting info
chipLevelsnumber[][100, 200, 500, 1000]Available bet amounts
minBetnumber100Minimum bet
maxBetnumber5000Maximum bet
defaultBetnumber200Default bet amount
boostedMultipliernumber2Multiplier applied to boosted bets
baseBundleMultipliernumber10Multiplier applied to base-bundle bets

RippinRumbleBetResult

Returned by sdk.rippinrumble.placeBet().

FieldTypeExampleDescription
roundIdstring'rnd_ghi789'Round ID (pass to collect())
balancenumber9800Balance after bet
totalBetAmountnumber200Total amount bet
totalWinAmountnumber450Total amount won
nextActionstring[]['collect']Valid next actions
cardPacksCardPack[](see below)1 pack for BASE/BOOSTED, 11 for BASE_BUNDLE
storageRecord<string, string>{}Persistent game state

Card

FieldTypeExampleDescription
rarityCardRarity'RARE'One of COMMON / UNCOMMON / RARE / LEGENDARY
idnumber3Card identifier (unique within rarity)
namestring'R03'Unique card name

CardPackRaritySummary

FieldTypeExampleDescription
countnumber4Cards of this rarity in the pack
valuePerCardnumber100Base value per card (cents)
multipliernumber10Multiplier determined by count
totalValuenumber4000count * valuePerCard * multiplier

CardPack

FieldTypeDescription
cardsCard[]5 cards in the pack
commonCardPackRaritySummarySummary for COMMON tier
uncommonCardPackRaritySummarySummary for UNCOMMON tier
rareCardPackRaritySummarySummary for RARE tier
legendaryCardPackRaritySummarySummary for LEGENDARY tier
totalPayoutnumberSum of the four totalValues

RippinRumbleBetType

Union of the bet types Rippin Rumble supports. Passed as opts.betType to sdk.rippinrumble.placeBet() and sdk.rippinrumble.getValidBets().

typescript
type RippinRumbleBetType = 'BASE' | 'BOOSTED' | 'BASE_BUNDLE';

Paired constants:

ConstantValueDescription
RIPPINRUMBLE_BET_TYPESreadonly ['BASE', 'BOOSTED', 'BASE_BUNDLE']Full ordered list
RIPPINRUMBLE_DEFAULT_BET_TYPE'BASE'The bet type placeBet falls through to when no opts are passed
RIPPINRUMBLE_BOOSTED_BET_TYPE'BOOSTED'The bet type the legacy { boosted: true } sugar resolves to
RIPPINRUMBLE_BASE_BUNDLE_BET_TYPE'BASE_BUNDLE'The bet type for bundle buys (11 packs per round)

Dev

DevControl

Union type for dev panel controls. Created via the devControl helper from @rollerz/types.

TypeFieldsDescription
radiokey, label, options: string[]Single-select radio buttons
sliderkey, label, min, max, step?Numeric slider
checkboxkey, labelBoolean toggle
textkey, label, placeholder?Free-text input
multiselectkey, label, options: string[]Multi-select checkboxes
typescript
import { devControl } from '@rollerz/types';

devControl.radio('size', 'Size', ['small', 'medium', 'large']);
devControl.slider('speed', 'Speed', 1, 10, 0.5);
devControl.checkbox('debug', 'Debug Mode');
devControl.multiselect('tags', 'Tags', ['a', 'b', 'c']);

DevProviderConfig

Defines a provider's dev mode behavior.

typescript
interface DevProviderConfig<TDevState, TBetResult> {
  controls: DevControl[];
  defaultState: TDevState;
  generateBetResponse(
    betAmount: number,
    betType: string,
    devState: TDevState,
  ): TBetResult;
}

Constants

PROVIDER_NAMES

typescript
const PROVIDER_NAMES = {
  GO3: 'go3',
  RIPPINRUMBLE: 'rippinrumble',
  STEPPER: 'stepper',
  GP: 'gp',
} as const;

Bet type constants

Each predefined provider exports its bet type union + matching constants. They're documented inline in the per-provider sections above: Go3BetType, StepperBetType, RippinRumbleBetType. GP has none by design.

typescript
import {
  GO3_BET_TYPES, GO3_DEFAULT_BET_TYPE, GO3_BOOSTED_BET_TYPE, type Go3BetType,
  STEPPER_BET_TYPES, STEPPER_DEFAULT_BET_TYPE, type StepperBetType,
  RIPPINRUMBLE_BET_TYPES, RIPPINRUMBLE_DEFAULT_BET_TYPE, RIPPINRUMBLE_BOOSTED_BET_TYPE, type RippinRumbleBetType,
} from '@rollerz/types';

MessageType

Enum for bridge message types.

ValueDescription
GAME_LOADEDGame has loaded
GAME_LOADED_ACKServer acknowledged game load
BRIDGE_READYBridge iframe is ready
API_CALLOutgoing API request
API_RESULTIncoming API response
ERRORError message