Hi everyone, last week I had been using version 1.0.9 and this week it suddenly stopped working, the connect message is coming but the sign message never comes, is there a reason for this issue?
I tested the SceneDemo of this version (1.0.9) and it does not work too.
Ensure the value is valid for the abi type.
So I believe at contract level BigInteger is right ?
Even when I hardcode the amount with digits it result to the same error …
I am sure to have enough balance, tried with very small values and “0” and still get the same error.
On new SDK version, the two methods :
MoralisInterface.InsertContractInstance()
and
MoralisInterface.SendEvmTransactionAsync()
seem deprecated/obsolete. having new warinings there.
In the MoralisInterface, there is this line now line.535 and 575:
[Obsolete("This method is deprecated. This method will not be replaced.")]
InsertContractInstance and SendEvmTransactionAsync methods are working, don’t mind the warnings. I don’t know why they put Obsolete there in the last version for no reason.
Here is the function that I am using with no issue. Hope it helps you.
// MoralisInterface.InsertContractInstance("transfer", ABI, chainId, erc20ContractAddress);
public async void SendERC20()
{
Function f = MoralisInterface.EvmContractFunctionInstance("transfer", chainID, "transfer");
HexBigInteger gas = new HexBigInteger(80000);
string result = await f.SendTransactionAsync(fromAddress, gas, new HexBigInteger("0x0"), receiver, amount);
Debug.Log(result);
}
Basically we are trying to standardize how Web3 works in both WebGL and non-WebGL We are discussing about the merits of keeping the Contract related methods (not the two SendTransaction methods) and implementing equivalents for WebGL.
Hi there,
Could you suggest how i can make an “auto create wallet” function ?
That would generate a wallet within the game ?
I saw a few solutions out there, but wanting to know if there is a moralis solution
thanks !
I do not know if you have solved this problem, but I solved it this way:
Find 2 of your WebSockets and open them (you can use notepad)
Copy the entire text from any WebSockets and paste it at the end of the second one, saving the changes. The first WebSockets will need to be deleted later.
no error but it return a transaction hash string. not wait for transaction confirmation.
There is nothing response when the transaction have confirmed or failed.
I found that React can do this but I’m not found how to do in unity
The string resp is just a string. cannot await resp.wait()
How should I approach adding this sdk to an existing Unity 2D game?
I have a 2D game that needs to authenticate via Web3. User can be on Eth, polygon or Avax. Upon completion the user will update a contract on their respective chain.
Seems like the best way is to implement Web3 auth and use cloud functions to make the smart contract calls on level completion.
With that functionality in mind, what necessary packages should be imported and where should moralis related code live withing the Unity project? currently working with a 2D project.
You can use the Moralis Unity SDK for authentication and running contract calls. You can download the latest version here and there’s a tutorial on using it here.
object[] inputParams = new object[2];
inputParams[0] = new { internalType = "address", name = "spender", type = "address" };
inputParams[1] = new { internalType = "uint256", name = "addedValue", type = "uint256" };
// Function ABI Output parameters
object[] outputParams = new object[1];
outputParams[0] = new { internalType = "bool", name = "", type = "bool" };
// Function ABI
object[] abi = new object[1];
abi[0] = new { inputs = inputParams, name = "increaseAllowance", outputs = outputParams, stateMutability = "nonpayable", type = "function" };
// Convert token id to hex as this is what the contract call expects
object[] pars = new object[] { abi.ToString() };
// Contract address, abi, function name, pars, value, gas, gas price
string result = await MoralisInterface.ExecuteContractFunction(contractAddress, abi, functionName, pars, new HexBigInteger("0x0"), gas, gas);