@public/client-core
    Preparing search index...

    @public/client-core

    Client Core

    npm i @public/client-core mobx
    
    import { createStore } from '@public/client-core';
    import { autorun } from 'mobx';

    const store = createStore({
    gameType: 'chicken-road',
    });

    autorun(() => {
    console.log(store.isReady);
    });

    URL клиента должен содержать обязательные параметры.

    store.bet
    store.game
    store.user
    store.wallet

    Подробная информация о типах и методах доступна в typebook.

    // Установить ставку в активной валюте
    store.bet.amount = '25.0';
    // Запустить игру
    store.game
    .play({
    difficulty: 'MEDIUM', // game-specific запрос
    })
    .then(result => console.log(result));

    store.game.state будет обновляться автоматически при вызовах игровых методов. Сами методы возвращают Promise.

    // Сделать шаг для step-based игр
    store.game
    .step()
    .then(result => console.log(result));
    // Забрать текущий выигрыш
    store.game
    .payout()
    .then(result => console.log(result));

    Также доступны служебные методы (возвращают Promise):

    store.game
    .getGameHistory()
    .then(result => console.log(result));
    store.game
    .getGameSeeds()
    .then(result => console.log(result));