Esempio n. 1
0
        public Request MintNonFungibleItem(int senderID, string[] addresses, string itemID)
        {
            _query = @"mutation mintNFToken{request:CreateEnjinRequest(identity_id:$senderID^,type:MINT,mint_token_data:{token_id:""$itemID^"",recipient_address_array:$addresses^}){id,encoded_data,state}}";
            GraphQuery.variable["senderID"]  = senderID.ToString();
            GraphQuery.variable["addresses"] = EnjinHelpers <string> .ConvertToJSONArrayString(addresses);

            GraphQuery.variable["itemID"] = itemID;
            GraphQuery.POST(_query);

            return(JsonUtility.FromJson <Request>(EnjinHelpers.GetJSONString(GraphQuery.queryReturn, 2)));
        }
Esempio n. 2
0
        public Request MintFungibleItem(int senderID, string[] addresses, string itemID, int value)
        {
            _query = @"mutation mintFToken{request:CreateEnjinRequest(identity_id:$senderID^,type:MINT,mint_token_data:{token_id:""$itemID^"",recipient_address_array:$addresses^,value:$value^}){id,encoded_data,state}}";
            GraphQuery.variable["senderID"]  = senderID.ToString();
            GraphQuery.variable["addresses"] = EnjinHelpers <string> .ConvertToJSONArrayString(addresses);

            GraphQuery.variable["itemID"] = itemID;
            GraphQuery.variable["value"]  = value.ToString(); // EnjinHelpers<int>.ConvertToJSONArrayString(value); <- Use this for sending multiple mint values when using multiple addresses
            GraphQuery.POST(_query);

            return(JsonUtility.FromJson <Request>(EnjinHelpers.GetJSONString(GraphQuery.queryReturn, 2)));
        }
Esempio n. 3
0
        public Request MintNonFungibleItem(int senderID, string[] addresses, string itemID,
                                           System.Action <string> handler, bool async = false)
        {
            _query =
                @"mutation mintNFToken{request:CreateEnjinRequest(appId:$appId^,identityId:$senderID^,type:MINT,mint_token_data:{token_id:""$itemID^"",recipient_address_array:$addresses^}){id,encodedData,state}}";
            GraphQuery.variable["appId"]     = Enjin.AppID.ToString();
            GraphQuery.variable["senderID"]  = senderID.ToString();
            GraphQuery.variable["addresses"] = EnjinHelpers <string> .ConvertToJSONArrayString(addresses);

            GraphQuery.variable["itemID"] = itemID;
            GraphQuery.POST(_query, "", async, (queryReturn) => { handler?.Invoke(queryReturn); });

            if (GraphQuery.queryStatus == GraphQuery.Status.Complete)
            {
                return(JsonUtility.FromJson <Request>(EnjinHelpers.GetJSONString(GraphQuery.queryReturn, 2)));
            }

            return(null);
        }