Hello,
I implemented my contract functions in my Unity project using the ExecuteContractFunction method and they work great when I build for WebGL using Metamask Chrome extension. However, in Android build I always get the āInternal JSON-RPC errorā in my Metamask Mobile app. The authentication works flawlessly, Iām connected to the wallet.
Is there a way to properly debug the issue and identify whatās wrong?
Could there be any specific problem with ExecuteContractFunction method on Android? Is there any other method I could use for running a write contract function? I tried using this one: Moralis.Web3Api.Native.RunContractFunction but it fails since apparently itās only for read functions.
This is my method:
public static async UniTask<string> ApproveToken()
{
var spender = GameManagerAddress;
#if UNITY_WEBGL
string amount = (BigInteger.Pow(2, 256) - 1).ToString();
#else
BigInteger amount = BigInteger.Pow(2, 256) - 1;
#endif
object[] parameters = {
spender,
amount
};
// Set gas estimate
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(0);
HexBigInteger gasPrice = new HexBigInteger(0);
var result = await Moralis.ExecuteContractFunction(TokenAddress, TokenAbi, "approve", parameters, value, gas, gasPrice);
return result;
}
And hereās the contract: https://testnet.bscscan.com/address/0x6c139f04a9382b7fb394834dd75a609f64d8ac3b#code
Note: I tried speedy nodesā RPC URL for Binance Testnet in my Metamask Mobile app but with the same result.