Thanks, I’ve been looking at this git, but the functions they’re using are deprecated. It’s the ExecuteContractFunction method you’re supposed to use from what I understand.
Unfortunatly there are no examples in C# I can find, and translating from JS is above my skill-level.
The below code is where I am now and this only generates this error:
Call to createBasicProton failed due to: Object reference not set to an instance of an object
UnityEngine.Debug:Log (object)
Any pointers would be super appriciated!
const string ABI = @"
[
{
""inputs"": [
{
""internalType"": ""address"",
""name"": ""creator"",
""type"": ""address""
},
{
""internalType"": ""address"",
""name"": ""receiver"",
""type"": ""address""
},
{
""internalType"": ""string"",
""name"": ""tokenMetaUri"",
""type"": ""string""
}
],
""name"": ""createBasicProton"",
""outputs"": [
{
""internalType"": ""uint256"",
""name"": ""newTokenId"",
""type"": ""uint256""
}
],
""stateMutability"": ""nonpayable"",
""type"": ""function""
}
]";
public async void MintBasicProton()
{
MoralisUser user = await MoralisInterface.GetUserAsync();
string addr = user.authData["moralisEth"]["id"].ToString();
string recieverAddress = addr;
string creatorAddress = addr;
string contractAddress = "0xe2a9b15E283456894246499Fb912CCe717f83319";
string metaURI = @"https://firebasestorage.googleapis.com/XXXXXXXXXX";
object[] pars = { creatorAddress, recieverAddress, metaURI };
HexBigInteger val = new HexBigInteger("0x0");
HexBigInteger gas = new HexBigInteger("0x0");
HexBigInteger price = new HexBigInteger("0x0");
try
{
string resp = await MoralisInterface.ExecuteContractFunction(contractAddress, ABI, "createBasicProton", pars, val, gas, price);
Debug.Log($"$Send Transaction respo: {resp}");
}
catch (Exception exp)
{
Debug.Log($"Send transaction failed: {exp.Message}");
}
}