calling ExecuteContractFunction and passing single argument or array of arguments isnt a problem, they work fine.
but when i try to pass a json string as an argument, it throws the following error
Call to MyFunction failed due to: Internal JSON-RPC error.: eth_sendTransaction
code that lets single argument and array of arguments pass through
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(0);
HexBigInteger gasPrice = new HexBigInteger(0);
but when i use above values for json argument function, i get JSON-RPC error
so i tried following values
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(3000000);
HexBigInteger gasPrice = new HexBigInteger(3000000);
this time on my metamask wallet, the transaction went through, but when i checked on polygonScan, it shows transaction failed.
following code i use to call execute contract function and pass json as an argument
public static async Task<string> ExecuteContractFuction()
{
newArg neArg = new newArg();
neArg.testId = 1;
neArg.testNumber = 210;
string jsonArg = JsonUtility.ToJson(neArg);
Debug.Log("zuzu jsonArg = " + jsonArg);
object[] newArgs =
{
jsonArg
};
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(0);
HexBigInteger gasPrice = new HexBigInteger(0);
string resp = "";
try
{
resp = await Moralis.ExecuteContractFunction(address, abi, TestContract.Function.testFunctionTwo, newArgs, value, gas, gasPrice);
}
catch (Exception exception)
{
resp = exception.ToString();
}
return resp;
}
public class newArg
{
public int testId, testNumber;
}
following is the log in code above
zuzu jsonArg = {"testId":1,"testNumber":210}
so what am i doing wrong here ?