Skip to main content

Gameplay

Initialize

The Game Client MUST initialize Kalamba SDK, so the wrapper can be correctly set up.

import { KalambaSdk } from '@kalamba/sdk'
const sdk = new KalambaSdk({ messagePort: window.parent })

Configure wrapper

The Game Client MUST configure Kalamba SDK Wrapper

sdk.configure({
gameName: 'MY GAME',
gameVersion: '1.2.1',
showErrors: true,
showFreeRounds: true,
showRealityCheck: true,
showBars: true,
skipErrors: [],
})

Open Game

The Game Client MUST open the game before playing.

const openGameResponse = await sdk.openGame()

It will connect to RGS and fetch configuration. After "Open Game", sdk.config is available to use.

Play

const playResponse = await sdk.play(contractPlayPayload)

It will make play request and can be done multiple times.

It is possible to send extra parameters if needed:

const playResponse = await sdk.play(contractPlayPayload, extraPlayPayload)

or even define custom action type:

const playResponse = await sdk.play(contractPlayPayload, extraPlayPayload, actionType)

in some cases game client may want to communicate with RGS without making a bet, then it can be done by setting bet in contract payload to null:

const playResponse = await sdk.play({ bet: null }, extraPlayPayload, actionType)