1.1.2 • Published 5 years ago

dragon-lotto-dod-sdk v1.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

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-dod-sdk

Examples

To place a bet:

import { Account, Server } from 'dragon-lotto-base-sdk';
import { Game } from 'dragon-lotto-dod-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);

// an `amount` to place bet
// min: 1
// max: 1000
const amount = 5;

const game = new Game(account, amount);

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

Response:

{
    "draw": {
        "message": "xxx",
        "result": "xxx"
    },
    "transaction_hash": "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)

Running the following command will submit 1000 bets to the server for test-account.

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