Skip to Content
API ReferenceProps Reference

Props Reference

All game SDK components (React) share the same props interface. The Vanilla JS API uses an equivalent options object.

React Props

Every <*GameSDK> component accepts these props:

PropTypeRequiredDefaultDescription
accessTokenstring | nullJWT authentication token from the session endpoint
userGameUserCurrent user state
updateBalance(balance: number) => voidCalled whenever the balance changes (on mount and after each bet) with the new balance in the user’s local currency. Sync this back to your UI state.
onAuthRequired() => voidCalled when an unauthenticated user tries to perform an action that requires login
currencyGameCurrency{ code: 'USD', prefix: '$', rate: 1 }Currency display configuration
languagestring'en'Locale code for UI translations
logoReactNodeundefinedCustom logo element displayed in the game header
onToast(toast: ToastData) => voidundefinedCallback for displaying toast notifications from the game
isDemobooleanfalseRun the game in demo mode with local bets, no backend session needed

Types

GameUser

type GameUser = { betCount: number isAuthenticated: boolean }
FieldTypeDescription
betCountnumberTotal number of bets the user has placed
isAuthenticatedbooleanWhether the user is currently logged in

Note: Balance is managed internally by the SDK. It is fetched from the server on mount and updated automatically after each bet. The updateBalance callback notifies your app of changes.

GameCurrency

type GameCurrency = { code: string prefix: string rate: number }
FieldTypeDescription
codestringISO currency code or crypto symbol (e.g. 'USD', 'BTC')
prefixstringDisplay prefix shown before amounts (e.g. '$', '₿')
ratenumberConversion rate relative to your base currency

All amounts in the SDK are stored in USD internally. The rate multiplies those amounts for display. For example, if a bet is worth $10 USD and rate is 5.5, the UI displays R$55.00.

Examples

// US Dollar (default — no conversion) currency={{ code: 'USD', prefix: '$', rate: 1 }} // Brazilian Real (1 USD = 5.50 BRL) currency={{ code: 'BRL', prefix: 'R$', rate: 5.5 }} // Euro (1 USD = 0.92 EUR) currency={{ code: 'EUR', prefix: '€', rate: 0.92 }} // Bitcoin (1 USD = 0.000016 BTC) currency={{ code: 'BTC', prefix: '₿', rate: 0.000016 }} // Custom token (1 USD = 100 tokens) currency={{ code: 'TOKENS', prefix: '🪙', rate: 100 }}

Tip: Your app is responsible for providing the correct rate. The SDK does not fetch exchange rates — it only applies the given multiplier.

ToastData

type ToastData = { title: string description?: string type?: 'info' | 'error' | 'success' | 'loading' }
FieldTypeDescription
titlestringMain toast message
descriptionstring?Optional secondary message
type'info' | 'error' | 'success' | 'loading'Toast variant for styling

Per-Game Prop Types

Each game exports its own typed props interface. They are all identical in shape:

GameProps Type
DiceDiceGameSDKProps
KenoKenoGameSDKProps
PlinkoPlinkoGameSDKProps
LimboLimboGameSDKProps
MinesMinesGameSDKProps
RouletteRouletteGameSDKProps
WheelWheelGameSDKProps
Coin FlipCoinflipGameSDKProps
BlackjackBlackjackGameSDKProps
Hi-LoHiLoGameSDKProps
TowerTowerGameSDKProps
BaccaratBaccaratGameSDKProps
DiamondsDiamondsGameSDKProps
ChickenChickenGameSDKProps
CrashCrashGameSDKProps

Import example:

import type { DiceGameSDKProps } from '@maktubbet/sdk/dice' import type { GameUser, GameCurrency, ToastData } from '@maktubbet/sdk'

Vanilla JS Options

The Vanilla JS API uses GameSDKOptions which mirrors the React props but without ReactNode types:

interface GameSDKOptions { accessToken: string | null user: { betCount: number; isAuthenticated: boolean } updateBalance: (balance: number) => void onAuthRequired: () => void currency?: { code: string; prefix: string; rate: number } language?: string logo?: any onToast?: (toast: { title: string; description?: string }) => void }

The logo field accepts any value in Vanilla JS (since there’s no JSX). In practice, it’s typically not used in the Vanilla API.

Vanilla JS Return Type

interface GameInstance { update(props: Partial<GameSDKOptions>): void destroy(): void }
MethodDescription
update(props)Merges partial options into the current configuration and re-renders
destroy()Unmounts the game and cleans up all resources
Last updated on