Skip to content

Messages sent by the GUI

Daria edited this page Feb 10, 2021 · 8 revisions

Messages GUI -> player node

Game

Game

Sent by the dealer (through GUI interface) to start the game.

https://github.com/chips-blockchain/bet/blob/master/docs/method_game.md

{ method: "game" }

Player join

The method is sent when the user chooses a seat.

There is also an inconsistency between Ids on the frontend and on the backend. Ids on the backend start with 0, ids on the frontend start with 1.

{ 
      method: "player_join", 
      gui_playerID: id 
}

GUI_playerID: the seat the user has chosen to seat at. (potentially we could change the naming so it is more consistent).

Response

When the player clicks SIT_HERE and the backend is ready

{
      method: "info", 
      playerid: 1, 
      seat_taken: 0
}

When the player clicks SIT_HERE and the backend is not ready

{
      method: "info", 
      response_to: "player_join", 
      backend_status: 0
}

Seats

https://github.com/chips-blockchain/bet/blob/master/docs/method_seats.md

Reset

Sent by the dealer (through GUI interface) to reset the game.

{ method: "reset" }

System messages

Backend Status

{ method: "backend_status" }

Response

{ 
      method: "backend_status", 
      backend_status: 1 
} 

Backend sends the response when it is ready (transaction has been mined, cards shuffled, etc) to respond to player_join request.

Wallet

Withdraw

Used to withdraw CHIPS from the players wallet to an address specified by the player.

{
      method: "withdraw",
      addr: string,
      amount: number
}

WalletInfo

WalletInfo is sent in the beginning of the game, when the user joins the table. This method should be renamed or rearranged since it has information in it which has nothing to do with the wallet, like table_id and max_players

{ method: "walletInfo" }

Response

{ 
      method: "walletInfo", 
      addr: "bCrYjDLNgY4Vo5roWTsEshLhPd6Rsk8Jg3", 
      balance: 0.340755, 
      backend_status: 1,
      max_players: 2,
      table_id: "12313123213",
      table_stack_in_chips: 10
}

addr: CHIPS address

balance: current CHIPS balance

backend_status: whether the backend is prepared to receive requests

max_players: maximum number of players at this table, how many seats GUI is supposed to show

table_id: current table id

table_stack_in_chips: the number of chips that each player should have in order to play the game.