JSON-RPC success response must include "result" field

Whenever I try ExecuteContractFunction in Unity I get this error:

Call to mint failed due to: JSON-RPC success response must include "result" field: eth_sendTransaction
UnityEngine.Debug:Log (object)
MoralisUnity.Moralis/<ExecuteContractFunction>d__46:MoveNext () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/Core/Moralis.cs:691)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`2<MoralisUnity.Moralis/<ExecuteContractFunction>d__46, string>:Run () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:313)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

or

Call to TestFunction failed due to: JSON-RPC success response must include "result" field: eth_sendTransaction
UnityEngine.Debug:Log (object)
MoralisUnity.Moralis/<ExecuteContractFunction>d__46:MoveNext () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/Core/Moralis.cs:691)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`2<MoralisUnity.Moralis/<ExecuteContractFunction>d__46, string>:Run () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:313)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

Unity Code:

string ABI = "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_uri\",\"type\":\"string\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]";

        string ContractAddress = "0x1676eD16cd462050396d7922fB8f912174A34B4E";

        string FunctioName = "mint";

        object[] inputParams = { "https://gateway.pinata.cloud/ipfs/bafybeics2al3bcn77kma3kvp6josv3vadmbrxzcefjztynddyczakdmqju/Data/nfts_"+NFT_ID+".json" };

        HexBigInteger value = new HexBigInteger("0x0");

        HexBigInteger gas = new HexBigInteger("8000"); //800000

        HexBigInteger gasprice = new HexBigInteger("230000");

        try

        {

            string result = await Moralis.ExecuteContractFunction(contractAddress: ContractAddress, abi: ABI, functionName: FunctioName, args: inputParams, value: value, gas: gas, gasPrice: gasprice);

            Debug.Log("Txhash :" + result);

        }

        catch (Exception error)

        {

            Debug.Log("Error :" + error);

        }

The contract works and I can do read only functions calls but it seems anytime I try to write I get this “Call to mint failed due to: JSON-RPC success response must include “result” field: eth_sendTransaction” problem. Any hints?

Thanks for your time!

1 Like