Miss any of our Open RFC calls?Watch the recordings here! »

@daocasino/dc-webapi

0.2.8 • Public • Published

This package stores files for DAO.Casino protocol implementation. The webapit functionality is integrated with a specific game in the SDK via an asynchronous initiatilizaton pattern:

const webapi = new DCWebapi(params)
webapi.on('ready', async instance => {
  await instance.game.createGame(gameParams)
  await instance.game.connect(connectParams)
  await instance.game.play(playParams)
  await instance.game.disconnect()
})

Example

new DCWebapi({
  platformId 'example_id',
  blockchainNetwork: 'local',
  privateKey: 'your_private_key'
}).on('ready', async instance => {
  await instance.game.createGame({
    name: manifest.slug,
    gameContractAddress: manifest.getContract(blockchainNetwork).address,
    gameLogicFunction: dapp_logic,
    rules: manifest.rules
  })
 
  await instance.game.connect({ playerDeposit: deposit })
  await instance.game.play({
    userBets: [ betAmount ],
    gameData: {
      randomRanges: [ randomRange ],
      custom: { playerNumbers: { t: 'uint256', v: [ userNum ] } }
    }
  })
 
  await instance.game.disconnect()
})

Keywords

none

Install

npm i @daocasino/dc-webapi

DownloadsWeekly Downloads

4

Version

0.2.8

License

MIT

Unpacked Size

78 kB

Total Files

55

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar