unity-web3-game-kit
unity-web3-game-kit copied to clipboard
Unity webGL - Execute Contract Function - Minting Issue (HexBigInteger - Invalid Big Number Returned (Error: invalid BigNumber string))
Please post sample code - looks like a valid error.
Here is my current code, the issue that im having is that it works in editor & on desktop platform but when i build to webGL I recieve the error;
{ public async UniTask ExecuteMinting(string metadataUrl)
long currentTime = DateTime.Now.Ticks;
Debug.Log(currentTime);
// Dummy TokenId based on current time
_currentTokenId = new BigInteger(currentTime);
object[] parameters = {
_currentTokenId.ToString("x"), // This is the format the contract expects
metadataUrl
};
// Set gas estimate
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(0);
HexBigInteger gasPrice = new HexBigInteger(0);
string resp = await Moralis.ExecuteContractFunction(ContractAddress, ContractAbi, "mintItem", parameters, value, gas, gasPrice);
return resp;
}
Okay I think we fixed an issue for this related with Nethereum which is where this is happening - are you using the latest version of the Unity Game Kit?
We also submitted an issue to the Nethereum team.
okay and yes im using version 1.2.6
interestingly by removing some code and using a different smart contract (from elden ring tutorial) it works, although a few mintues delay when compared to desktop build;
public async UniTask<string> ExecuteMinting(string metadataUrl)
{
object[] parameters = {
metadataUrl
};
// Set gas estimate
HexBigInteger value = new HexBigInteger(0);
HexBigInteger gas = new HexBigInteger(0);
HexBigInteger gasPrice = new HexBigInteger(0);
string resp = await Moralis.ExecuteContractFunction(ContractAddress, ContractAbi, "getItem", parameters, value, gas, gasPrice);
return resp;
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.