smartcontract_template_js

1.0.3 • Public • Published

smartcontract_template_js

### a library to interact with duel smart contract

install duel sdk: npm i smartcontract_template_js --save

  • alice creates an arena with arena_id skyrim_room_1, stakes 10 COS, skyrim_admin is the referee

    const Gladiator = require('smartcontract_template_js/duel.js').Gladiator;
    const gladiator = new Gladiator("alice""herPrivKey");
    gladiator.open_arena("skyrim_admin""skyrim_room_1""10.000000");
  • bob wants to join an arena that is created by alice,

    const Gladiator = require('smartcontract_template_js/duel.js').Gladiator;
    const gladiator = new Gladiator("bob""hisPrivKey");
    gladiator.join_arena("alice""skyrim_admin""skyrim_room_1""10.000000");
  • The duel is over, the referee skyrim_admin decides bob is the winner

    const Gladiator = require('smartcontract_template_js/duel.js').Gladiator;
    const gladiator = new Gladiator("skyrim_admin""hisPrivKey");
    gladiator.close_arena("alice""bob");

Readme

Keywords

none

Package Sidebar

Install

npm i smartcontract_template_js

Weekly Downloads

6

Version

1.0.3

License

MIT

Unpacked Size

4.46 kB

Total Files

4

Last publish

Collaborators

  • zhaoguojie