Stackable Assets
GameShift now supports interactions with Stackable Assets, which are Semi-Fungible Tokens (SFTs) on the Solana blockchain. You can set up Stackable Assets, issue them to users or your development wallet, view balances, and initiate transfers between users or from your development wallet to users.
Setting up
To set up a new Stackable Asset in GameShift, make a POST request to https://api.gameshift.dev/v2/sfts/create.
curl -X 'POST'
'https://api.gameshift.dev/nx/stackable-assets'
-H 'accept: application/json'
-H 'x-api-key: <api_key>'
-H 'Content-Type: application/json'
-d '{
"attributes": [
{
"traitType": "string",
"value": "string"
}
],
"collectionId": "3cdf417c-fcc7-4fa1-9257-47abd95fc34a",
"description": "string",
"imageUrl": "<https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1LkL-UpJ4ZHWeaAEEVhobaxvUNyPYxsgofQ&s">,
"name": "Boots",
"symbol": "BOOT"
}'
The response will include details about the SFT you just created, including an id for use in other API requests.
{
"id": "c1b6d69b-4cb3-4d88-8369-0a5329adac7e",
"collection": {
"id": "3cdf417c-fcc7-4fa1-9257-47abd95fc34a",
"name": "collection",
"description": "desc",
"environment": "Development",
"imageUrl": "https://crossmint.myfilebase.com/ipfs/QmcuF9AetzMMFX1h2eGh6u9ZmtP3wXuggzKuFpeg4geUi9",
"imported": false,
"mintAddress": "",
"created": 1720659969799
},
"attributes": [
{
"value": "string",
"traitType": "string"
}
],
"created": 1721401752333,
"name": "Boots",
"symbol": "BOOT",
"description": "string",
"environment": "Development",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1LkL-UpJ4ZHWeaAEEVhobaxvUNyPYxsgofQ&s",
"status": "Processing",
"mintAddress": ""
}
Listing All SFTs in a Project
To view all Stackable Assets in your project, make a GET request to https://api.gameshift.dev/nx/items.
curl -X 'GET' \
'https://api.gameshift.dev/nx/items?types=StackableAsset&forSale=false' \
-H 'accept: application/json' \
-H 'x-api-key: <api_key>'
The response will include a paginated list of Stackable Assets in your project.
{
"data": [
{
"type": "StackableAsset",
"item": {
"id": "c1b6d69b-4cb3-4d88-8369-0a5329adac7e",
"collection": {
"id": "3cdf417c-fcc7-4fa1-9257-47abd95fc34a",
"name": "collection",
"description": "desc",
"environment": "Development",
"imageUrl": "https://crossmint.myfilebase.com/ipfs/QmcuF9AetzMMFX1h2eGh6u9ZmtP3wXuggzKuFpeg4geUi9",
"imported": false,
"mintAddress": "",
"created": 1720659969799
},
"attributes": [
{
"value": "string",
"traitType": "string"
}
],
"created": 1721401752333,
"name": "Boots",
"symbol": "BOOT",
"description": "string",
"environment": "Development",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1LkL-UpJ4ZHWeaAEEVhobaxvUNyPYxsgofQ&s",
"status": "Committed",
"mintAddress": ""
}
}
],
"meta": {
"page": 1,
"perPage": 50,
"totalPages": 1,
"totalResults": 1
}
}
Issuing SFTs to Users
To issue an SFT to a user, make a POST request to https://api.gameshift.dev/nx/stackable-assets/{itemId}.
curl -X 'POST' \
'https://api.gameshift.dev/nx/stackable-assets/c1b6d69b-4cb3-4d88-8369-0a5329adac7e' \
-H 'accept: application/json' \
-H 'x-api-key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"destinationUserReferenceId": "userId",
"amount": 1
}'
The response will consist of the Stackable Asset info, along with the user's current balance and pending balance.
{
"type": "StackableAsset",
"item": {
"id": "7b6b8eec-6606-459e-9afa-83a80c088d81",
"collection": {
"id": "3cdf417c-fcc7-4fa1-9257-47abd95fc34a",
"name": "collection",
"description": "desc",
"environment": "Development",
"imageUrl": "https://crossmint.myfilebase.com/ipfs/QmcuF9AetzMMFX1h2eGh6u9ZmtP3wXuggzKuFpeg4geUi9",
"imported": false,
"mintAddress": "",
"created": 1720659969799
},
"attributes": [
{
"value": "string",
"traitType": "string"
}
],
"created": 1721675683075,
"name": "shoe",
"symbol": "sho",
"description": "string",
"environment": "Development",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1LkL-UpJ4ZHWeaAEEVhobaxvUNyPYxsgofQ&s",
"status": "Committed",
"mintAddress": "G2nqfMpJga8CLoLuhzpCkeeA7UkLuodk7p3ysT9rmFQq"
},
"quantity": "1",
"pendingIssue": "1",
"pendingQuantity": "2"
}
Issuing SFTs to Development Wallet
To issue an SFT to your development wallet, use the same endpoint as above, but specify the "self" reference ID for your development wallet.
curl -X 'POST' \
'https://api.gameshift.dev/nx/stackable-assets/c1b6d69b-4cb3-4d88-8369-0a5329adac7e' \
-H 'accept: application/json' \
-H 'x-api-key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"destinationUserReferenceId": "self",
"amount": 1
}'
Transferring SFTs Between Users
To transfer SFTs between users, make a POST request to https://api.gameshift.dev/nx/users/{referenceId/items/{itemId}/transfer.
curl -X 'POST' \
'https://api.gameshift.dev/nx/users/harsha1/items/c1b6d69b-4cb3-4d88-8369-0a5329adac7e/transfer' \
-H 'accept: application/json' \
-H 'x-api-key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"destinationUserReferenceId": "userId",
"quantity": "1"
}'
The response is a consent url the user can then sign:
{
"transactionId": "5f7055b8-645d-43b9-b099-fd78bfbb829e",
"consentUrl": "http://localhost:8080/consent?transaction=5f7055b8-645d-43b9-b099-fd78bfbb829e"
}
Transferring SFTs from Development Wallet to User
To transfer SFTs from your development wallet to a user, use the same endpoint as above, but specify your development wallet as the sender.
curl -X 'POST' \
'https://api.gameshift.dev/nx/developer-wallet/items/c1b6d69b-4cb3-4d88-8369-0a5329adac7e/transfer' \
-H 'accept: application/json' \
-H 'x-api-key: <api_key>' \
-H 'x-wallet-key: <wallet_key>' \
-H 'Content-Type: application/json' \
-d '{
"destinationUserReferenceId": "userId",
"quantity": "1"
}'
Response:
{
"id": "a02b7c98-3baa-45e5-a3f2-a1218afe244b",
"created": "2024-07-19T15:49:30.684Z",
"status": {
"status": "Pending"
},
"details": {
"type": "TransferStackableAssetFromDeveloper",
"item": {
"id": "c1b6d69b-4cb3-4d88-8369-0a5329adac7e",
"collection": {
"id": "3cdf417c-fcc7-4fa1-9257-47abd95fc34a",
"name": "collection",
"description": "desc",
"environment": "Development",
"imageUrl": "https://crossmint.myfilebase.com/ipfs/QmcuF9AetzMMFX1h2eGh6u9ZmtP3wXuggzKuFpeg4geUi9",
"imported": false,
"mintAddress": "",
"created": 1720659969799
},
"attributes": [
{
"value": "string",
"traitType": "string"
}
],
"created": 1721401752333,
"name": "Boots",
"symbol": "BOOT",
"description": "string",
"environment": "Development",
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1LkL-UpJ4ZHWeaAEEVhobaxvUNyPYxsgofQ&s",
"status": "Committed",
"mintAddress": "DEmqbSGv6puAetbLXnMiBAeAqR4SCFTpboVauiHxNdh8"
}
}
}
Fees
Coming soon
Updated 5 months ago