2. Phoenix
Last updated
Last updated
This package allows players to interact with smart contract by reading onchain values and by calling smart contract functions to convert a set of NFT tokens into other NFTs.
Quick start:
To initialize Phoenix AFP you need to take the prefab that is in ..>Additional Features Packages>Phoenix>Prafabs called metapro_phoenix_prefab and instantiate it on the scene. Prefab is constructed in such a way that it will automatically show the initial screen and get QuestData. In our naming convention quest is a structure that has information about conversion, tokens that are taken, their amount, tokens that are given with their amount, available time and so on. To get more deep information about data structure please go to the Reference section of Phoenix AFP.
This is the initial screen that the player will see. In this stage the plugin obtains data from smart contract about set quest.
GetQuestData takes the id of the quest and saves information about that quest.
Players can click now on the Open conversion button to open the next window.
This view shows which tokens are necessary for conversion and which token player will be given. When the player clicks on the Allow conversion button, the system sends a transaction to the user wallet that allows smart contract to take control of users' NFT in order to convert them. NFTs shown in this screenshot are just an example of how conversion would look like.
In players wallet transaction confirmation will popup and the player has to sign it in order to move forward.
Second step is to actually call the conversion method in the smart contract. Player after clicking the Convert button will be again prompted in the wallet to sign a transaction. After transaction confirmation phoenix will display final screen that shows conversion.