Tokens
Last updated
Was this helpful?
Last updated
Was this helpful?
Make sure to use your X-Auth-Token when making a POST request. Your X-Auth-Token is the private key associated to your ERC-20 wallet.
It is strongly not recommended to use Mint/Clone/Burn in any game as it can cause uncontrolled access to your studio wallet and expose the private key. Mint/Clone/Burn should be done via the Vessel dashboard.
You need to upload the image somewhere and post the URL when you use /tokens/manage/create
API. Once it is created, we store image data in our DB.
On the other hand, you can post the image binary directly to us if you use /tokens/manage/create-multipart
API.
You can create new tokens specified by fqTn and give it to the user wallet.
You can clone and create new tokens from a parent token specified by fqTn. Cloned tokens have different fqTn from the parent token.
You can consume tokens. Consumed tokens will be removed from the user wallet.
You can consume tokens and create new tokens.
If you use Mint API, the token created has the identical fqTn as the original one. If you Mint com.studio.sword.greatsword
, the user will get com.studio.sword.greatsword
in the wallet. On the other hand, If you Clone com.studio.sword.greatsword
, a new token com.studio.sword.greatsword:1
is created and added to the user wallet. In short, Clone API will create a variation of the original token.
Here's the side-by-side comparison for both APIs.
fqTn
identical
:N
is appended
Display Name
identical
#N
is appended
Description
identical
identical
Immutable Properties
identical
identical
Mutable Properties
identical
new values can be set
If you just need to give a specific item to a user and all those items share the same properties in your app, our Mint API is recommended. If each token has different mutable parameter that can be changed in the gameplay (e.g. level) , you need to use Clone API.
displayName
string
Display name of the token
fqTn
string
totalSupply
number
Total number of minted tokens
displayName
string
Display name of the token
description
string
Token description
imageUrl
string
URL that points to the token image
fqTn
string
collectionAddress
string
Blockchain address of the collection this token belongs to
totalSupply
number
Total number of minted tokens
properties
object
An object that contains the token’s immutable properties
mutableProperties
object
An object that contains the token’s mutable properties
createdAt
number
Unix timestamp of the token’s creation time
Minted tokens can have multiple mutable properties. These properties persist outside of Vessel’s blockchain.
The properties object maps property keys to their values. For example:
In this example, favorite_weapon
is the property key which maps to its current value along with the display name.
There's rate limit for API calls and it's 5,000/hour. If you want to increase the threshold, please reach out to your Vessel account manager.
Once you hit the rate limit, API returns http response code 429
. In that case, you can retry to call the API after several minutes.
There are two APIs for creating and giving a new token to a user, and .
token name
token name
Fully qualified game name
com.studio.game
Collection qualified name
armor01
Fully Qualified Game Name
com.studio.game
Qualified Collection Name
armor01
Qualified Token Name
shield
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Fully Qualified Token Name
com.studio.game.cards.1
Pattern: ^[a-z]{2,6}\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,20}\b)(:[1-9][0-9]{0,10})?
NFT display name
Card #1
NFT description
Card #1 increases your luck
The amount of tokens to mint
To address
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
The flag that controls display in the Discovery
true
Example: true
NFT image
jpg, png
Pattern: ^(http|https)://[-a-zA-Z0-9+&@#/%?=~_|,!:.;]*[-a-zA-Z0-9+@#/%=&_|]\.(?:jpg|jpeg|png)$
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Fully Qualified Token Name
com.studio.game.cards.1
Pattern: ^[a-z]{2,6}\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,20}\b)(:[1-9][0-9]{0,10})?
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Address of the token receiver
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
The amount of tokens to mint
Fully qualified token name
com.studio.app.collection.token
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Address of the token receiver
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
Should mutable properties of parent token be clonned as well
The flag that controls display in the Discovery
true
Example: true
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Owner address who approved the game for manage tokens
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
Fully Qualified Token Name
com.studio.game.cards.1
Pattern: ^[a-z]{2,6}\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,59}\b)\.(\b[a-z0-9-]{1,20}\b)(:[1-9][0-9]{0,10})?
The quantity of tokens to burn
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
Player address
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
Fully Qualified Collection Name
com.studio.game.cards
Fully Qualified Collection Name
com.studio.game.collection
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
New display name
New description
New image URL
No content
Fully Qualified Collection Name
com.studio.game.collection
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
No content
Fully qualified token name
com.studio.app.collection.token
Auth token
abcdefghijk
Pattern: [0-9a-fA-F]{64}
Name/key of mutable property
additionalProperty
Fully qualified token name
com.studio.app.collection.token
Auth token
abcdefghijk
Pattern: [0-9a-fA-F]{64}
ababa71162175e6867058b271eea7b5b279326eaf646188ab5e37365f32bb353
Pattern: [0-9a-fA-F]{64}
Unique Request Id that makes APIs idempotent. If two requests have the same ID, one of them will fail.
ab62663d-1645-4026-ba2d-d888b9634de9
To Player address
0xcafe000102030405060708090a0b0c0d0e0fbeef
Pattern: ^0x[a-fA-F0-9]{40}$
Fully Qualified Collection Name
com.studio.game.cards