record_battle method

Method: record_battle

The record_battle method is a part of the SiriusnetSDK class and is used to record a battle result for a player in a specific game on the Siriusnet Blockchain.

Signature

def record_battle(self, player_id: str, game_id: str, result: str) -> dict:

Parameters

  • player_id (str): The ID of the player. This is a unique identifier for each player.

  • game_id (str): The ID of the game. This is a unique identifier for each game.

  • result (str): The result of the battle. This should be either 'win' or 'lose'.

Returns

A dictionary with information about the recorded battle. The exact structure of this dictionary depends on the Siriusnet Blockchain API, but it typically includes information such as the player ID, game ID, result, and timestamp of the battle.

Example

sdk = SiriusnetSDK(api_key='your_api_key')
battle_info = sdk.record_battle('player123', 'game456', 'win')
print(battle_info)

In this example, we're recording a win for the player with ID 'player123' in the game with ID 'game456'. The record_battle method returns a dictionary with information about the recorded battle, which we then print.

Last updated