dragon-lotto-dond-sdk

The game that determine the win/lose result based on the random event.

Usage no npm install needed!

<script type="module">
  import dragonLottoDondSdk from 'https://cdn.skypack.dev/dragon-lotto-dond-sdk';
</script>

README

Dragon Lotto - DealOrNoDeal Instant Game

The game that determine the win/lose result based on the random event.

Installation

Using npm:

npm install dragon-lotto-dond-sdk

Examples

To place a bet:

import { Account, Server } from 'dragon-lotto-base-sdk';
import { Game } from 'dragon-lotto-dond-sdk';

const seed = 'user_id';
const development = true; // this is in a development environment

// const server = Server.loadProductionServer(); // production
const server = Server.loadTestServer(); // development

const account = new Account(seed, server, development);

const game = new Game(account);

// Level 1
let level = 1;

game
    .submitBet(level);
    .then(result => {
        // handle result
    })
    .catch(error => {
        // handle error
    });
    
// Other level
level = 2;

game
    .submitBet(level, game_id); // `game_id` from level 1
    .then(result => {
        // handle result
    })
    .catch(error => {
        // handle error
    });

Response:

{
    "draw": {
        "message": "xxx",
        "result": "xxx",
        "level": "xxx",
        "probability": "xxx",
        "prize": "xxx",
        "cell": "xxx",
        "winning_cell": "xxx"
    },
    "bet_id": "xxx",
    "game_id": "xxx"
}

Functional Test

To run this test, an account that was derived from the provided seed must has:

  • Trustline ready
  • Enought balance to place a bet (1 LTC / 1 Bet)

To make test-account submit bets for level 1:

node testSubmitBet.js --seed=test-account --play=10 --level=1

To play for the other levels, example level 2:

node testSubmitBet.js --seed=test-account --play=10 --level=2 --game_id=879c20ac12d05fe00c6410654699f9fcb0ea9bab7aa52b137ce3db4ca4c18c02