private void Update() { // Sequence lock to wait for a successful callback on linking a wallet. if (sequenceOne) { sequenceOne = false; Debug.Log("(5/8) Sending an item from the developer account to the testing account ... "); Enjin.AccessToken = DEVELOPER_TOKEN; // Mint a new token directly from the developer wallet. CryptoItem item = Enjin.GetCryptoItem(TESTING_ITEM_ID); string reserveCount = item.reserve; int developerBalance = Enjin.GetCryptoItemBalance(DEVELOPER_IDENTITY_ID, TESTING_ITEM_ID); if (!reserveCount.Equals("0")) { Enjin.MintFungibleItem(DEVELOPER_IDENTITY_ID, new string[] { USER_ADDRESS }, TESTING_ITEM_ID, 1, (requestEvent) => { if (requestEvent.event_type.Equals("tx_executed")) { Debug.Log(" ... PASSED: MINTED."); sequenceTwo = true; } }); } // If the developer wallet is unable to mint reward tokens from the reserve, try to send it from the developer wallet. else if (developerBalance > 0) { Enjin.SendCryptoItemRequest(DEVELOPER_IDENTITY_ID, TESTING_ITEM_ID, testingIdentityID, 1, sendData => { if (sendData.event_type.Equals("tx_executed")) { Debug.Log(" ... PASSED: SENT."); sequenceTwo = true; } }); } // Otherwise there really is nothing of this token left for the developer to give out. else { Debug.Log(" ... FAILED: NO RESERVE TO MINT OR BALANCE TO SEND."); } } // Sequence lock to wait for a successful callback on sending an item. if (sequenceTwo) { sequenceTwo = false; Debug.Log("(6/8) Trading an item from the testing account to the developer account ... "); Enjin.AccessToken = TESTER_TOKEN; CryptoItem tradeToItem = new CryptoItem { token_id = TESTING_ITEM_ID, nonFungible = false }; CryptoItem tradeFromItem = new CryptoItem { token_id = TESTING_ITEM_ID, nonFungible = false }; testingIdentity = Enjin.GetIdentity(testingIdentityID); Identity developerIdentity = Enjin.GetIdentity(DEVELOPER_IDENTITY_ID); Enjin.CreateTradeRequest(testingIdentityID, new CryptoItem[] { tradeToItem }, new int[] { 1 }, DEVELOPER_IDENTITY_ID, new CryptoItem[] { tradeFromItem }, new int[] { 1 }, tradeData => { tradeId = tradeData.request_id; Debug.Log(" ... PASSED."); sequenceThree = true; }); } // Sequence lock to wait for successful trade creation before completion. if (sequenceThree) { sequenceThree = false; Debug.Log("(7/8) Completing trade from the testing account to the developer account ... "); Enjin.AccessToken = DEVELOPER_TOKEN; Enjin.CompleteTradeRequest(DEVELOPER_IDENTITY_ID, "" + tradeId, tradeData => { Debug.Log(" ... PASSED."); sequenceFour = true; }); } // Sequence lock to wait for successful trade of item before melting. if (sequenceFour) { sequenceFour = false; Debug.Log("(8/8) Melting an item on the testing account ... "); Enjin.AccessToken = TESTER_TOKEN; Enjin.MeltTokens(testingIdentityID, TESTING_ITEM_ID, 1, meltData => { Debug.Log(" ... PASSED."); sequenceFive = true; }); } // Sequence lock to wait for successful completion of all tests before running static suite. if (sequenceFive) { sequenceFive = false; // Execute additional tests for non-runtime SDK calls. TestStaticEndpoints(); Debug.Log("=== All tests executed successfully. ==="); } }