metapro
  • 🤝Welcome!
  • đź’»metapro market
    • Set your account
    • Connect wallet + web3 login
    • Side panel
      • Transfer NFT
        • Multiple transfer (Airdrop NFT)
          • Import CSV List
      • Sell NFT
        • Initial NFT Selling (INS)
          • How to setup INS auction
          • How to buy on INS auction
        • Buy Now
          • How to setup Buy Now auction
          • How to buy on Buy Now auction
        • Auction (Bidding)
          • How to setup Auction
          • How to buy on Auction
      • All NFT assets
    • Buy Crypto
    • Top Menu
      • Profile
        • Profile Marketplace
        • My games
        • My assets
          • Royalty
        • Activities
      • Referral Panel
        • Register your downline
        • Downline wallets
        • My referral link
      • Profile Settings
      • Developer Portal
      • Logout
    • Assets
      • Marketplace
        • Auction Card
      • Most favorite
      • Newest assets
        • Asset Card
    • Games
      • Show all games
    • Leaderboard
    • Create asset (minter)
      • Gaming asset specification
      • How to create (mint) asset
        • 1. Setup NFT token
        • 2. Setup metadata
        • 3. Add meta asset
        • 4. Mint meta asset
        • 5. Meta asset created
    • Developers Portal
      • Create team
      • Create game
      • Developers Portal Panel
      • Unity Plugin
      • How to list game on metapro market?
    • Creators
    • Teams
    • Users
    • Wallet App
    • Launcher
    • Market and auction component fees
  • 🚀METAPRO LAUNCHER
    • What is metapro launcher?
    • Download launcher
    • Set your account
      • Login to launcher
    • Home
    • Games
      • Game card on launcher
        • Assets in this game
      • Install game on launcher
      • Update game on launcher
    • My games
      • Installed
      • Not installed
      • Wishlist
    • My assets
      • Collected assets
      • Created assets
      • Wishlist
    • NODEs app
  • 📱metapro one
    • About non-custodial wallet
    • Download & set up
      • Create new metapro wallet
      • Import existing wallet
    • Settings
      • Avatar
      • Multiple wallets
      • Wallet name
      • Private Key
        • Protect Private Key
        • How to find my Private Key
      • Recovery Phrases
        • Protect Recovery Phrases
        • How to find my Recovery Phrases
      • Application version
    • Network switch
    • Deposit (Tokens and Collectibles)
    • Send (Tokens and Collectibles)
      • Send Tokens
      • Send Collectibles (NFT)
    • Buy (Buy and Sell Crypto)
    • Browser
    • My assets
      • Tokens
        • Asset view
        • Adding Tokens
        • Activities
      • Collectibles (NFT)
      • Game assets (NFTma)
    • Explore
      • Apps
      • Collections (NFT)
      • Game assets (NFTma)
    • How to claim Airdrop
    • How to import wallet from MetaMask to metapro
    • Supported devices
  • ⛓️metapro protocol
    • API
      • Users service
      • Teams service
      • Apps service
      • Nft service
      • Nft events service
    • Meta asset
    • Metadata structure
    • Protocole structure
    • Unity Plugin
      • About metapro Unity plugin
      • What's new
      • Guides
        • Installation
        • Requirements
        • Package samples
        • Quick start
          • 1. Editor
            • Access tool
            • Import game key
            • Download resources
            • App data object
            • Change game key
            • Use app data in script
          • 2. Play mode (PC)
            • Enable Web3 in your game
            • Choose provider
            • Connect wallet
            • Login with Web3
            • Display user data
            • Show app tokens
            • Use user and app data from script
          • 3. Play mode (Mobile)
            • Enable Web3 in Your game
            • Choose provider
            • Connect wallet
            • Login with Web3
        • AFP (Additional Features Packages)
          • 1. Safe token transfer
          • 2. Phoenix
        • Troubleshooting
      • Reference
        • MetaproAPPSetup
        • Editor Window
        • Plugin Manager
        • Web3 connection providers
          • metapro
          • Wallet Connect
          • MetaMask
        • WindowController
        • AFP (Additional Features Packages)
          • SafeTransferFrom
          • Phoenix
  • 🛠️WALLET CONNECTOR
    • Introduction
    • Basic informations
      • Next 13 integration
      • React integration
      • Manual installation
  • 👨‍💻Developer Documentation
    • Introduction to Developer Documentation
      • What is a Meta asset?
      • What are the Benefits of Using Tokens as Access Keys for the Game Application
      • Why should I Choose the Meta Assets as the Access Keys for the Game Application?
      • How Does It Work, Exactly?
    • Available Environments
    • Blockchain Communication and information retrieval
      • How can we verify/distinguish a user?
      • How can we track a user's transactions?
      • What information can we obtain?
    • Integration with the Leaderboard service
    • Integration for in-Wallet Apps
    • Integration for Telegram Mini Apps
      • Integration Architecture and Configuration
      • Authorization and Session Management
      • Example Integration and Features
      • Code Examples from the Repository
      • Summary and Appendices
    • Developer documentation for the Construct 3 Plugin
      • Construct 3 - Install plugin
      • Plugin Configuration
      • User onboarding and authorization
      • User Management
      • Score System
      • Leaderboard System
      • Referral System
      • Gameplay
      • Smart Contract Interactions
      • User NFTs
      • Error Handling
      • Additional Getters for Plugin Properties
    • Integration Web3 with Your Game
      • What is Web3
      • Blockchain Basics
      • Differences between chains
      • What is a NFT
      • Advantages of Web3 Gaming
      • Examples of Web3 Games
    • Onboarding the Web3 Player
      • Value for Players
      • Explanation of Cryptocurrency Wallet
      • Rewards for Tournament Participation
      • Reselling Owned Assets
      • Integration of Metapro Wallet Connector
      • Displaying Data for Unlogged Users
      • How to Get Authorization Data
      • User Authorization Benefits
    • Creating Your First Meta Asset
      • The Difference between NFT and Meta Asset
      • Security and Transparency
      • Concept and Value of Meta Assets
      • How and Where to Create Your Meta Asset
        • Step-by-Step Guide on How to Create Your Asset
        • Explanation of URI (Metadata structure)
        • Explanation of the Meta Asset Data taken from our Back End
    • Implementing Meta Assets into Your Game
      • Integrate your Meta Asset to your game using Unity
      • Verify User Tokens Ownership
      • Displaying All User-Owned Tokens
      • Displaying All Assets Assigned to the Game on the Metapro Market
    • Smart Contracts
      • MetaproINS
        • Read Contract
        • Write Contract
      • MetaproBuyNow
        • Read Contract
        • Write Contract
      • MetaproAuction
        • Read Contract
        • Write Contract
      • MetaproMetaAsset
        • Read Contract
        • Write Contract
      • MetaproRoyalty
        • Read Contract
        • Write Contract
      • MetaproReferral
        • Read Contract
        • Write Contract
      • MetaproAirdrop
        • Read Contract
        • Write Contract
    • Universal Links & App Links with WalletConnect
  • 🔎General information
    • Blockchain
    • Blockchain Network Fee
    • Blockchain Native Token
    • Token ERC-1155 vs ERC-721
  • đź“„Release Notes
    • Introduction to the Release Notes
    • Marketplace Updates
      • Release 07.03.2024
      • Release 06.03.2024
      • Release 04.03.2024
      • Release 19.02.2024
      • Release 24.01.2024
      • Release 09.01.2024
      • Release 03.01.2024
      • Release 21.12.2023
      • Release 18.12.2023
      • Release 13.12.2023
      • Release 12.12.2023
      • Release 02.12.2023
      • Release 30.11.2023
      • Release 24.11.2023
      • Release 22.11.2023
      • Release 17.11.2023
      • Release 13.11.2023
      • Release 09.11.2023
      • Release 08.11.2023
      • Release 07.11.2023
      • Release 31.10.2023
      • Release 26.10.2023
      • Release 25.10.2023
      • Release 24.10.2023
      • Release 18.10.2023
      • Release 05.10.2023
      • Release 03.10.2023
      • Release 29.09.2023
      • Release 18.09.2023
      • Release 14.09.2023
      • Release 12.09.2023
      • Release 06.09.2023
      • Release 25.08.2023
      • Release 17.08.2023
      • Release 04.08.2023
      • Release 31.07.2023
      • Release 21.07.2023
      • Release 18.07.2023
      • Release 13.07.2023
    • Games Launcher Updates
      • Release 13.03.2024
      • Release 24.01.2024
      • Release 04.01.2024
      • Release 22.11.2023
      • Release 03.10.2023
      • Release 31.07.2023
      • Release 27.07.2023
      • Release 20.07.2023
      • Release 13.07.2023
    • Wallet Updates
      • Release 04.03.2024
      • Release 03.10.2023
      • Release 29.09.2023
      • Release 15.09.2023
      • Release 30.08.2023
      • Release 18.07.2023
Powered by GitBook
On this page
  1. metapro protocol
  2. Unity Plugin
  3. Reference
  4. AFP (Additional Features Packages)

Phoenix

This AFP contains a call for the Phoenix functions from smart contract. Most important code is in Phoenix, PhoenixOutputParser, PhoenixDecoder and PhoenixQuest classes.

This package also offers scripts that deal with showing player the UI screen (PhoenixQuestPopup).

All scripts are in namespace metaproSDK.Scripts.AFP.Phoenix.

In Phoenix.cs you will find all data about connection to smart contract - contract address, ABI, token address. There’re also connections to dev and prod systems of metapromarket.

By calling function GetQuestData AFP make request to smart contract to read from onchain data by method “getQuestById”. In Phoenix we have to decode that data so PhoenixDecoder saves data into an object and PhoenixOutputParser parse data to proper type.

Phoenix.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using metaproSDK.Scripts.AFP.Phoenix.Serialization;
using metaproSDK.Scripts.AFP.Phoenix.UI;
using metaproSDK.Scripts.AFP.SafeTransferFrom;
using metaproSDK.Scripts.AFP.SafeTransferFrom.Serialization;
using metaproSDK.Scripts.Serialization;
using Nethereum.Web3;
using Newtonsoft.Json;
using Serialization;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
using WalletConnectSharp.Core.Models.Ethereum;
using WalletConnectSharp.Unity;

namespace metaproSDK.Scripts.AFP.Phoenix
{
    public class Phoenix : MonoBehaviour
    {
        [SerializeField] private PhoenixQuestPopup questPopup;

        private string _tokenContractAddressTest = "0x91945DCD15b44eB33dE4D00897843C1Ee524fA88"; //testnet

        private string _phoenixAddressTest = "0xd3a4912f174b7904b1Dc00d39842E5CFB22B6112";
        
        // we don’t include here whole ABI
        private string _phoenixABITest =
            @"[{""inputs"":[], … ""outputs"":[],""stateMutability"":""nonpayable"",""type"":""function""}]";

        private const string _functionSignature = "setApprovalForAll(address,bool)";
        private const string _completeQuestSignature = "completeQuest(uint256,bytes)";
        
        private PhoenixQuest _selectedQuest;

        private List<PhoenixQuestToken> _inputTokens = new();
        private List<PhoenixQuestToken> _outputTokens = new();

        private string TEST_SERVER_URL = "https://test-api.metaproprotocol.com";
        private string PROD_SERVER_URL = "https://api.metaproprotocol.com";
        public string ServerRequestUrl => TEST_SERVER_URL; // PROD_SERVER_URL;
        public PhoenixQuest SelectedQuest => _selectedQuest;
        
        public List<PhoenixQuestToken> InputTokens => _inputTokens;
        public List<PhoenixQuestToken> OutputTokens => _outputTokens;
        //example of BSC API Key
        private string bscApiKey = "N3DZJ2U62UJER17AXJZKD24FS8VS68F93U";
        
        public void OpenQuestPopup()
        {
            StartCoroutine(DownloadTokenData(_selectedQuest.InputTokenIds, true));
            StartCoroutine(DownloadTokenData(_selectedQuest.OutputTokenIds, false));
            questPopup.OpenInitialScreen();
        }
        
        private void Start()
        {
            GetQuestData(3);
        }

        private async void GetQuestData(int questId)
        {
            var web3Test = new Web3("https://data-seed-prebsc-1-s1.binance.org:8545");
            var contract = web3Test.Eth.GetContract(_phoenixABITest, _phoenixAddressTest);
            var function = contract.GetFunction("getQuestById");
            var result = await function.CallDecodingToDefaultAsync(questId);

            var phoenixQuest = PhoenixDecoder.DecodePhoenixQuest(result);
            Debug.Log(phoenixQuest);
            _selectedQuest = phoenixQuest;
            OpenQuestPopup();
        }

        

        public void AllowTokenControlBySC()
        {
            questPopup.ShowTransactionProcessingScreen();
            var transactionHash = "";
            transactionHash += TransactionEncoder.EncodeFunction(_functionSignature);
            var fromWalletAddress = new WalletAddress();
            fromWalletAddress.value = _phoenixAddressTest;
            transactionHash += TransactionEncoder.EncodeParam(fromWalletAddress);
            transactionHash += TransactionEncoder.EncodeParam(true);
            StartCoroutine(TransactionRequest(transactionHash));
        }

        
         private IEnumerator TransactionRequest(string transactionHashData)
        {
            TransactionData data = new TransactionData();

            data.from = WalletConnect.ActiveSession.Accounts[0];
            data.to = _tokenContractAddressTest;
            data.data = transactionHashData;

            var task = Task.Run(async () => await WalletConnect.ActiveSession.EthSendTransaction(data));
            
            yield return new WaitUntil(() => task.IsCompleted);
            if (task.IsFaulted)
            {
                foreach (var innerException in task.Exception.InnerExceptions)
                {
                    Debug.LogWarning(innerException.Message);
                }
                questPopup.HideTransactionProcessingScreen();
                yield break;
            }
            Debug.Log(task.Result);

            if (bscApiKey == "")
            {
                Debug.LogWarning("BSC api key not found");
                questPopup.HideTransactionProcessingScreen();
                yield break;
            }
            
            var txHash = task.Result;

            var bscApi = PluginManager.Instance.IsTestnetSelected ? "https://api-testnet.bscscan.com" : "https://api.bscscan.com";
            
            var requestUrl = $"{bscApi}/api?module=transaction" +
                             $"&action=getstatus" +
                             $"&txhash={txHash}" +
                             $"&apikey={bscApiKey}";
            var request = UnityWebRequest.Get(requestUrl);
            yield return request.SendWebRequest();
            
            Debug.Log($"Transaction hash: {request.result}");
            var apiResponse = JsonConvert.DeserializeObject<BSCApiRespone>(request.downloadHandler.text);

            if (apiResponse != null && apiResponse.result.isError == "1")
            {
                Debug.LogWarning("Transaction occured an error");
                Debug.LogWarning(apiResponse.result.errDescription);
            }
            
            questPopup.EnableSecondStage();
            questPopup.HideTransactionProcessingScreen();
        }
         
         
         public void CompleteQuest()
         {
             questPopup.ShowTransactionProcessingScreen();
             var transactionHash = "";
             transactionHash += TransactionEncoder.EncodeFunction(_completeQuestSignature);
             transactionHash += TransactionEncoder.EncodeParam(_selectedQuest.QuestId);
             transactionHash += TransactionEncoder.EncodeLastCompleteQuestBytes();
             StartCoroutine(CompleteQuestTransactionRequest(transactionHash));
         }
         
         
         private IEnumerator CompleteQuestTransactionRequest(string transactionHashData)
         {
             TransactionData data = new TransactionData();

             data.from = WalletConnect.ActiveSession.Accounts[0];
             data.to = _phoenixAddressTest;
             data.data = transactionHashData;

             var task = Task.Run(async () => await WalletConnect.ActiveSession.EthSendTransaction(data));
            
             yield return new WaitUntil(() => task.IsCompleted);
             if (task.IsFaulted)
             {
                 foreach (var innerException in task.Exception.InnerExceptions)
                 {
                     Debug.LogWarning(innerException.Message);
                 }
                 questPopup.HideTransactionProcessingScreen();
                 yield break;
             }
             Debug.Log(task.Result);

             if (bscApiKey == "")
             {
                 Debug.LogWarning("BSC api key not found");
                 questPopup.HideTransactionProcessingScreen();
                 yield break;
             }
            
             var txHash = task.Result;

             var bscApi = PluginManager.Instance.IsTestnetSelected ? "https://api-testnet.bscscan.com" : "https://api.bscscan.com";
            
             var requestUrl = $"{bscApi}/api?module=transaction" +
                              $"&action=getstatus" +
                              $"&txhash={txHash}" +
                              $"&apikey={bscApiKey}";
             var request = UnityWebRequest.Get(requestUrl);
             yield return request.SendWebRequest();
            
             Debug.Log($"Transaction hash: {request.result}");
             var apiResponse = JsonConvert.DeserializeObject<BSCApiRespone>(request.downloadHandler.text);

             if (apiResponse != null && apiResponse.result.isError == "1")
             {
                 Debug.LogWarning("Transaction occured an error");
                 Debug.LogWarning(apiResponse.result.errDescription);
             }
             questPopup.HideTransactionProcessingScreen();
             questPopup.ShowScreen(PhoenixScreenType.Success);
         }
        
        private IEnumerator DownloadTokenData(int[] tokenIds, bool inputTokens)
        {
            var nftParams = String.Join('&', tokenIds.Select(p => "tokenIds=" + p).ToList());
            var requestUrl = ServerRequestUrl + "/ms/nft/v1/tokens?" + nftParams;

            UnityWebRequest getNfts = UnityWebRequest.Get(requestUrl);

            yield return getNfts.SendWebRequest();

            if (getNfts.result == UnityWebRequest.Result.ConnectionError)
            {
                Debug.LogError(getNfts.error);
                yield break;
            }

            Debug.Log(getNfts.downloadHandler.text);

            var appNftResult = JsonConvert.DeserializeObject<Results<NftUserTokenResultTest>>(getNfts.downloadHandler.text);

            foreach (var nftTokensResult in appNftResult.results)
            {
                var phoenixQuestToken = new PhoenixQuestToken();
                phoenixQuestToken.imageUrl = nftTokensResult.token.image;
                phoenixQuestToken.tokenId = nftTokensResult.token._tokenId;
                if (inputTokens)
                {
                    phoenixQuestToken.amount = _selectedQuest.InputTokenQuantities[Array.IndexOf(tokenIds, phoenixQuestToken.tokenId)];
                    _inputTokens.Add(phoenixQuestToken);
                }
                else
                {
                    phoenixQuestToken.amount = _selectedQuest.OutputTokenQuantity[Array.IndexOf(tokenIds, phoenixQuestToken.tokenId)];
                    phoenixQuestToken.available = true;
                    _outputTokens.Add(phoenixQuestToken);
                }
            }

            foreach (var questToken in _inputTokens)
            {
                StartCoroutine(GetTokenTexture(questToken));
            }
            foreach (var questToken in _outputTokens)
            {
                StartCoroutine(GetTokenTexture(questToken));
            }

        }

        private IEnumerator GetTokenTexture(PhoenixQuestToken phoenixQuestToken)
        {
            UnityWebRequest www = UnityWebRequestTexture.GetTexture(phoenixQuestToken.imageUrl);
            yield return www.SendWebRequest();
            if (www.result != UnityWebRequest.Result.Success)
            {
                Debug.Log(www.error);
                Debug.Log(www.downloadHandler.error);
                StartCoroutine(GetGifData(phoenixQuestToken));
            }
            else
            {
                Debug.Log("Downloaded Texture");
                Texture texture = ((DownloadHandlerTexture)www.downloadHandler).texture;
                phoenixQuestToken.texture = texture;
            }
        }

        private IEnumerator GetGifData(PhoenixQuestToken phoenixQuestToken)
        {
            UnityWebRequest www = UnityWebRequest.Get(phoenixQuestToken.imageUrl);
            yield return www.SendWebRequest();
            if (www.result != UnityWebRequest.Result.Success)
            {
                Debug.Log(www.error);
                Debug.Log(www.downloadHandler.error);
            }
            else
            {
#if UNITY_EDITOR
                Debug.Log("Downloaded GIF texture");
                var relativePath = "Assets/downloadedGif" + phoenixQuestToken.tokenId + ".gif";
                ByteArrayToFile(relativePath, www.downloadHandler.data);
                AssetDatabase.ImportAsset(relativePath);
                AssetDatabase.Refresh();
                TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(relativePath);

                importer.isReadable = true;
                importer.textureType = TextureImporterType.Sprite;

                TextureImporterSettings importerSettings = new TextureImporterSettings();
                importer.ReadTextureSettings(importerSettings);
                importerSettings.textureType = TextureImporterType.Sprite;
                importerSettings.spriteExtrude = 0;
                importerSettings.spriteGenerateFallbackPhysicsShape = false;
                importerSettings.spriteMeshType = SpriteMeshType.FullRect;
                importerSettings.spriteMode = (int)SpriteImportMode.Single;
                importer.SetTextureSettings(importerSettings);
                importer.spriteImportMode = SpriteImportMode.Single;
                importer.maxTextureSize = 1024; // or whatever
                importer.alphaIsTransparency = true;
                importer.textureCompression = TextureImporterCompression.Uncompressed;
                importer.alphaSource = TextureImporterAlphaSource.FromInput;
                EditorUtility.SetDirty(importer);

                importer.SaveAndReimport();
                Sprite spriteImage = (Sprite)AssetDatabase.LoadAssetAtPath(relativePath, typeof(Sprite));
                phoenixQuestToken.texture = spriteImage.texture;
#endif
            }
        }

        public bool ByteArrayToFile(string fileName, byte[] byteArray)
        {
            try
            {
                using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
                {
                    fs.Write(byteArray, 0, byteArray.Length);
                    return true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception caught in process: {0}", ex);
                return false;
            }
        }
    }
}

ParameterOutputParser.cs

using Nethereum.ABI.FunctionEncoding;
using UnityEngine;

namespace metaproSDK.Scripts.AFP.Phoenix
{
    public static class ParameterOutputParser<T>
    {
        public static T ParseParameter(ParameterOutput parameterOutput)
        {
            if (parameterOutput.Parameter.DecodedType == typeof(T))
            {
                return (T)parameterOutput.Result;
            }

            Debug.LogError($"Parsing error: {parameterOutput.Parameter.DecodedType} can't be parsed to {typeof(T)}. Value: {parameterOutput.Result}");
            return default;
        }
        
    }
}

PhoenixDecoder.cs

using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using metaproSDK.Scripts.AFP.Phoenix.Serialization;
using Nethereum.ABI.FunctionEncoding;

namespace metaproSDK.Scripts.AFP.Phoenix
{
    public static class PhoenixDecoder
    {
        public static PhoenixQuest DecodePhoenixQuest(List<ParameterOutput> parameterOutputs)
        {
            var phoenixQuest = new PhoenixQuest();

            phoenixQuest.QuestId = (int)ParameterOutputParser<BigInteger>.ParseParameter(parameterOutputs[0]);
            phoenixQuest.TokenContractAddress = ParameterOutputParser<string>.ParseParameter(parameterOutputs[1]);
            phoenixQuest.TotalNumberOfQuests = (int)ParameterOutputParser<BigInteger>.ParseParameter(parameterOutputs[2]);
            phoenixQuest.NumberOfQuestsCompleted = (int)ParameterOutputParser<BigInteger>.ParseParameter(parameterOutputs[3]);
            phoenixQuest.InputTokenIds = ParameterOutputParser<List<BigInteger>>.ParseParameter(parameterOutputs[4]).Select(p => (int)p).ToArray();
            phoenixQuest.OutputTokenIds = ParameterOutputParser<List<BigInteger>>.ParseParameter(parameterOutputs[5]).Select(p => (int)p).ToArray();
            phoenixQuest.InputTokenQuantities = ParameterOutputParser<List<BigInteger>>.ParseParameter(parameterOutputs[6]).Select(p => (int)p).ToArray();
            phoenixQuest.OutputTokenQuantity = ParameterOutputParser<List<BigInteger>>.ParseParameter(parameterOutputs[7]).Select(p => (int)p).ToArray();
            phoenixQuest.OperatorAddress = ParameterOutputParser<string>.ParseParameter(parameterOutputs[8]);
            phoenixQuest.MultipleParticipation = ParameterOutputParser<bool>.ParseParameter(parameterOutputs[9]);
            phoenixQuest.StartBlock = ParameterOutputParser<BigInteger>.ParseParameter(parameterOutputs[10]);
            phoenixQuest.EndBlock = ParameterOutputParser<BigInteger>.ParseParameter(parameterOutputs[11]);
            phoenixQuest.Valid = ParameterOutputParser<bool>.ParseParameter(parameterOutputs[12]);
            
            return phoenixQuest;
        }
    }
}

PhoenixQuest.cs

using System.Numerics;

namespace metaproSDK.Scripts.AFP.Phoenix.Serialization
{
    public class PhoenixQuest
    {
        public int QuestId;
        public string TokenContractAddress;
        public int TotalNumberOfQuests;
        public int NumberOfQuestsCompleted;
        public int[] InputTokenIds;
        public int[] OutputTokenIds;
        public int[] InputTokenQuantities;
        public int[] OutputTokenQuantity;
        public string OperatorAddress;
        public bool MultipleParticipation;
        public BigInteger StartBlock;
        public BigInteger EndBlock;
        public bool Valid;

        public override string ToString()
        {
            return $"Phoenix quest: {QuestId}, {TokenContractAddress}, {Valid}, {StartBlock} - {EndBlock}";
        }
    }
}

PreviousSafeTransferFromNextIntroduction

Last updated 7 months ago

⛓️