To add to what david said, i have tested this on a physical build on android (Android 10
), and they all seem to work, checked the executing cloud function and it works properly with the correct result
you can try adding more 0
? and see if the transaction will show 0.01
eth
This does seem weird. Per https://eth-converter.com/ 10000000000000000 WEI should be 0.01 ETH.
If you debug into SendEvmTransactionASync is the value “0x2386F26FC10000” or “0x9184E72A000”?
I tried this in a app and the hex value was correct (“0x2386F26FC10000”) and the charge amount that showed in the wallet was 0.01 as expected.
Is it possible that in the wallet you are using it defined the chain as having more the decimal 18? If you just created the account for mainnet this is probably not the case. Not sure what else would cause this issue for you though.
Hello,
@Shivam this is also of interest for you.
I’ve managed to solve the problem by downgrading the Unity version I was using. It appears that the existing RestSharp.dll that exists in the boilerplate is not compatible with Unity 2021.2.10f1 …
So:
Unity 2021.2.10f1 - RestSharp not working on Android build
Unity 2020.3.30f1 LTS - works like a charm
Hope it helps in solving it on that version.
Thanks for your support, @dgoodrich
Thanks this is very important to know - I need to find a work around to using RestSharp
Thank you very much, I’ll check it.
Whenever I click the Quit button I get this error:
ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
Any help will be appreciated
Is this happening on a double click?
When you click on “Quit” it closes Wallet Connect (W.C.), Clears the W.C. session then it signs out of Moralis and closes the Moralis session. It then quits the app. However when run n the IDE ApplicationQuit does not quit the app in Unity, yu need to hit the IDE Play button to actually stop running.
If you hit Quit again before app stops running W.C. throws an error because it has already closed its connection (hence the error you see).
A fix is in the work for this.
To take care of it sooner - in MainMenuScript.cs find the Quit method.
Replace it with this:
public async void Quit()
{
try
{
Debug.Log("QUIT");
// Logout the Moralis User.
await MoralisInterface.LogOutAsync();
// Disconnect wallet subscription.
await walletConnect.Session.Disconnect();
// CLear out the session so it is re-establish on sign-in.
walletConnect.CLearSession();
}
catch (Exception exp)
{
// Send error to the log but not as an error as this is expected behavior from W.C.
Debug.Log($"Quit Error - Has quit already been called? Error: {exp.Message}");
}
// Close out the application.
Application.Quit();
}
Note the order has been changed this is on purpose.
It worked, thank you very much Sir.
I have a payable function where I send 0.5 ether + parameters to function and return variables. How can I call this using Moralis Unity?
function action(uint256 value1, bool value2, address value3) external payable returns (address a, bool b, uint256 c);
and you can scroll above to find some others similar things
It worked, now I have an issue when calling RunContractFunction. Can’t get the array. Tested with all array types. Always gives this error
JsonReaderException: Unexpected character encountered while parsing value: [. Path 'result', line 1, position 11.
I want to call this function
function GetUint256Array() external view returns (uint256[] memory variables)
Here is my unity function for calling it;
public async void GetThisArray()
{
// Function ABI input parameters
object[] inputParams = new object[0];
// Function ABI Output parameters
object[] outputParams = new object[1];
outputParams[0] = new { internalType = "uint256[]", name = "variables", type = "uint256[]" };
// Function ABI
object[] abi = new object[1];
abi[0] = new { inputs = inputParams, name = "GetUint256Array", outputs = outputParams, stateMutability = "view", type = "function" };
// Define request object
RunContractDto rcd = new RunContractDto()
{
Abi = abi,
Params = new { }
};
string resp = await MoralisInterface.GetClient().Web3Api.Native.RunContractFunction(GameControl.instance.GetAddress(0), "GetUint256Array", rcd, GameControl.instance.GetChainID());
Debug.Log(resp);
}
The Error I am getting
JsonReaderException: Unexpected character encountered while parsing value: [. Path 'result', line 1, position 11.
Newtonsoft.Json.JsonTextReader.ReadStringValue (Newtonsoft.Json.ReadType readType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonTextReader.ReadAsString () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Moralis.Web3Api.Client.ApiClient.Deserialize (System.String content, System.Type type, System.Collections.Generic.IList`1[T] headers) (at Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api/Client/ApiClient.cs:230)
Moralis.Web3Api.CloudApi.NativeApi+<RunContractFunction>d__14.MoveNext () (at Assets/MoralisWeb3ApiSdk/Moralis/Moralis.Web3Api/CloudApi/NativeApi.cs:485)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0)
TxController+<GetThisArray>d__5.MoveNext () (at Assets/Scripts/Core/TxController.cs:264)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <d3b66f0ad4e34a55b6ef91ab84878193>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
you need to pass the values of the array, and i dont think runcontractfunction can perform a write functions
look at the first link i sent
I finally find the solution! My function was correct. It is because of the 1.0.8 version. When I updated 1.0.9, the problem is solved!!
Hi guys,
Don’t know why but when I send transactions with TrustWallet mumbai testnet fails to recognize transaction:
Everything seems fine on unity though…
can you send the address that sent the transactions and the tx hash?
and does trust wallet have the ability to add test network ?
tx: 0xb73ef778e11568c9cc5ce9d97ecd2ade7b2f8bdd492b72d4203f4a8f18fd9b1b
add: 0xa284EB7402eb9D8a1B9c4951fC600F2fEfD274ed
Apparently no, but It does authenticate and show balance / address
yes, but is that on mumbai or main polygon ?
i dont think trust wallet can but used to send mumbai transactions
lol see your transaction on mainnet polygon
wow thats very odd as I have setup everything to be on mumbai.
Thx a lot