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:
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
accessToken | string | null | ✅ | — | JWT authentication token from the session endpoint |
user | GameUser | ✅ | — | Current user state |
updateBalance | (balance: number) => void | ✅ | — | Called 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 | () => void | ✅ | — | Called when an unauthenticated user tries to perform an action that requires login |
currency | GameCurrency | — | { code: 'USD', prefix: '$', rate: 1 } | Currency display configuration |
language | string | — | 'en' | Locale code for UI translations |
logo | ReactNode | — | undefined | Custom logo element displayed in the game header |
onToast | (toast: ToastData) => void | — | undefined | Callback for displaying toast notifications from the game |
isDemo | boolean | — | false | Run the game in demo mode with local bets, no backend session needed |
Types
GameUser
type GameUser = {
betCount: number
isAuthenticated: boolean
}| Field | Type | Description |
|---|---|---|
betCount | number | Total number of bets the user has placed |
isAuthenticated | boolean | Whether 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
updateBalancecallback notifies your app of changes.
GameCurrency
type GameCurrency = {
code: string
prefix: string
rate: number
}| Field | Type | Description |
|---|---|---|
code | string | ISO currency code or crypto symbol (e.g. 'USD', 'BTC') |
prefix | string | Display prefix shown before amounts (e.g. '$', '₿') |
rate | number | Conversion 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'
}| Field | Type | Description |
|---|---|---|
title | string | Main toast message |
description | string? | 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:
| Game | Props Type |
|---|---|
| Dice | DiceGameSDKProps |
| Keno | KenoGameSDKProps |
| Plinko | PlinkoGameSDKProps |
| Limbo | LimboGameSDKProps |
| Mines | MinesGameSDKProps |
| Roulette | RouletteGameSDKProps |
| Wheel | WheelGameSDKProps |
| Coin Flip | CoinflipGameSDKProps |
| Blackjack | BlackjackGameSDKProps |
| Hi-Lo | HiLoGameSDKProps |
| Tower | TowerGameSDKProps |
| Baccarat | BaccaratGameSDKProps |
| Diamonds | DiamondsGameSDKProps |
| Chicken | ChickenGameSDKProps |
| Crash | CrashGameSDKProps |
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
}| Method | Description |
|---|---|
update(props) | Merges partial options into the current configuration and re-renders |
destroy() | Unmounts the game and cleans up all resources |