Creating NFT Inventory
After requesting the project inventory from Xerial services, the JSON response needs to be processed to create an instance of the UserData class.
Usage
using System.Collections.Generic;
using UnityEngine;
using SimpleJSON;
using Xerial;
public class NFTResponseHandler
{
public void HandleNFTResponse(string response)
{
XerialServices.instance.inventoryManager.inventory = null;
JSONArray jsonArray = JSON.Parse(response).AsArray;
if (jsonArray != null && jsonArray.Count > 0)
{
JSONNode rootNode = jsonArray[0];
//Deserialize the object array
}
}Deserializing NFTs from Project Inventory Data
To deserialize the NFTs from the JSON response within the project inventory data.
NFT
First, we retrieve the node containing NFT data from the JSON response received from the server. c
Collection
Metadata
Contract
Attributes
Token
Store the NFT inventory
Create NFT Instances: For each NFT entry in the JSON data, we add an instance of the NFT class to represent the NFT inside the inventory.
Last updated