Description

The record_battle method is part of the SiriusnetSDK class in the Siriusnet Blockchain SDK. Its purpose is to record the result of a battle for a specific player in a specific game. This information is stored on the Siriusnet Blockchain, allowing for transparent and immutable record-keeping.

The method requires three parameters: player_id, game_id, and result.

  • player_id is a string that uniquely identifies a player.

  • game_id is a string that uniquely identifies a game.

  • result is a string that indicates the outcome of the battle, expected to be either 'win' or 'lose'.

When the record_battle method is called, it sends a request to the Siriusnet Blockchain API to record the battle result. The API processes the request and, if successful, returns a dictionary containing information about the recorded battle. This dictionary typically includes the player ID, game ID, result, and timestamp of the battle.

It's important to note that this method may raise exceptions if there's an issue with the request. For instance, if the API key is invalid, the player ID or game ID doesn't exist, or there's a network error, an exception will be raised. Therefore, it's recommended to wrap calls to this method in a try/except block to handle potential exceptions.

Last updated