0.0.3 • Published 2 years ago

@strandgeek/chestbox-sdk v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ChestBox NodeJS SDK

Quick Start

Installing

npm i @strandgeek/chestbox-sdk

Example

Usage

const chestbox = new ChestBoxSDK({
  algodClient: <YOUR_ALGO_CLIENT>,
  apiToken: <YOUR_CHESTBOX_PROJECT_TOKEN>,
  minterAccount: algosdk.mnemonicToSecretKey(<MINTER_MNEMONIC>)
})

Note: Make sure your minter account has enough algorands to pay the fees

Claim an Asset to a Player

When you want to give an asset to the player in the game, you call this command

const { assetID } = await chestbox.claimAsset({
  slug: 'super-sword',
  to: <PLAYER_WALLET_ADDRESS>,
})

Complete Claim

After the player opt-in step, you can complete the claim (transfer the token from minter to player wallet)

const result = await chestbox.completeClaimAsset({
  assetID,
})