Testing

realXdeal testing with polkadot js as frontend

  1. Setup Game

To create a new round and initially set up the game, the setupGame function needs to be called through the SUDO account.This creates a new game setup and launches new collections for the new NFTs.

  1. Register new users

If an account has not yet been registered as a player, the SUDO account can register new users, which is initially awarded 100 points to be able to play the game.As a parameter the AccountId of the user is needed.

  1. Give points to user

The SUDO has the option to give points to users. This function will distribute 100 points to a user.As a parameter the AccountId of the user is needed.

  1. Play Game

For the user / player to start a game they have to call the playGame function.As a parameter the user has to select the difficulty level. There are 3 options. Practice, Player and Pro. Each option has a different time limit and gives different rewards.

The user has to make one practice round before unlocking the other options.

The property for the game is visible under that game info card.

  1. Submit Answer

To submit an answer the player has to call the submitAnswer function, which has the parameter of guess as u32, which is the price the player guesses and the gameId, which is the id of the players game.

The player has to make a guess within the time limit, otherwise the round is counted as a loss and the player (as long as it is not a practice round) loses some points.

A player can see their points and collected NFTs in their account data.

  1. Trade NFTs

To trade NFTs with other players, a player can list their NFTs for trading. It is not possible for a player to transfer their NFTs to other accounts the only way to trade NFTs is via the selected functions.

To list a NFT the player has to call the listNft function. As parameters the collectionId and the itemNft of the NFT are needed.

  1. Delist NFT

The player has the option to delist their listed NFT by calling the delist function.

This function takes the parameter listingId of the listing.

  1. Make Offer

Another player can now make an offer for the listing by offering one of their NFTs. As parameters the listingId is needed and the collectionId and itemId of their NFT.

  1. Withdraw Offer

The player who made the offer has the option to withdraw their offer, as long as the offer did not get accepted or rejected, by calling the withdrawOffer function.

This function takes the parameter offerId.

  1. Handle Offer

The owner of the listing has the option to accept the offer or reject the offer. In the first case if they reject the offer nothing happens and the offer gets deleted. In the second case if they accept the offer the two NFTs get swapped.

As a parameter this function takes the offerId and the enum with the options Accept or Reject.

Last updated