Gaming sdk
Scores

Overview

Score is an number of game points or amount of game resource

Scores

Each score has it's own NFT

To create your own game resource, deploy the game resource NFT

  contract MyGameDiamond is GameResourceNFT {
      string public override name = "Diamond";
      string public override description = "Earn diamonds in battles with bosses";
      string public override imageUrl = "http://example.com/diamind.webp";
  }

After contract deployment you can mint game resources for user

  await gamingSdk.user.resources.mint(user_address, MY_GAME_DIAMOND_ADDRESS, 10);

Get user resources

const score = await gamingSdk.user.current.score.get([MY_GAME_DIAMOND_ADDRESS]);

Request leaderboard for a specific game resource

const topDiamondHolders = await gamingSdk.user.score.getLeaderboard(MY_GAME_DIAMOND_ADDRESS);

Watch new game resource minted

  await gamingSdk.user.current.score.watch([MY_GAME_DIAMOND_ADDRESS], (newAmount) => {...});