Ethereum Unity3D Boilerplate Questions

I guess my first question would be “How did you get Mumbai access on Trust Wallet? I thought that was not an option with that wallet.”

I know it can be confusing since you can still use Web3Api to read transactions but these are being sync’d to the Moralis Db in the backend and then read from the DB.

Writes (such as sending) must go through the wallet, so the funds are sent on the chain the wallet is pointed to.

Next I would recommend looking at which chain your wallet is pointed to.

Trust Wallet is known for not supporting any testnets. Try Rainbow Wallet, imToken Wallet or MetaMask.

1 Like

Hi, I’ve got a question about Unity/Moralis integration when dealing with cold storage wallets like Trezor or Ledger. I’m building and IOS/Android app, how would I be able to authenticate someone who uses cold storage?

Thank you

1 Like

Makes sense now :slight_smile:
Thanks a lot !

1 Like

I am still having a wierd issue when authenticating on mobile (android):

When I authenticate, it takes me to metamask, brings me back to the app then back to metamask to sign, then back to app. It then keeps asking me to open metamask, I need to deny this request 4 times before i can be authenticated.

Any idea how to solve this ?

Thanks !

1 Like

it depends, if the wallet can be connect to something that can scan a qr code, and i know most cold wallet can connect to metamask and be used from metamask, so this should be possible

:thinking::thinking: interesting, i just did an andriod build right now and i believe it doesn’t redirect back to the app ?
if it redirects to metamask, i dont think it redirects back, typical you wait in MM to connect and then sign the message before you manually press your home button and other buttons to go back to the app and you should be connected

1 Like

Cool thanks for responding! Yea if the wallet could be connected via Metamask that would be ideal. The QR code sign in would work great. I’m just not sure how to connect it all. I understand that I would need a site where people could authenticate their metamask/wallet, but not sure how to go about creating the qr code and about Unity Mobile app reading that code and authenticating. Do you know if there’s a good resources or examples that would explain how to tie it all together with Unity? Thanks!

Android? Is it asking you to sign over and over or connect? Have you modified your authentication code or is this the demo?

This behavior is caused by Wallet Connect queuing its requests and not clearing the queue before the handler is re-triggered.

If this is your own code try adding a condition around the code in the handler so that once called it is not called again until you clear the condition.

1 Like

well, you can scan the qr code in unity (you dont need anything extra eg. a site)
you can look at the docs and take a look at the boilerplate, there should be enough info there to get you started, you can also goole how to connect your hardware wallet to metamask or if it is possible to connect it to something to scan qr code for authentication, is it for mobile ? if it is for mobile , if you can connect your hard ware wallet to metamask mobile, you can connect to metamask and then use the wallet to auth and use it

indeed ! great help ! thanks a lot !
There was indeed requests queuing !

1 Like

Oh interesting, when I was thinking about QR code I though about the example where Moralis creates the QR code, but are you referring to the QR code that comes up when you are using Metamask and click the menu and select account details? Yes, I’m looking to do a mobile app. I honestly am not too brushed up on how a coldwallet connects to Metamask mobile, but I’ll definitely look into it now.

Thank you!

No, i am talking about the first qr code, and yes you should look at how cold wallets connects to other wallets or how they can scan a qr code for connection

Hi there !
This didnt work for me.
I have selected Metamask only and still have a infinite loading screen.

What am I missing ?

Hello, i cannot currently try (test) this , but this is an issue currently been investigated

1 Like

Oh alright, any work around you could suggest ? Hardcoding it for a specific Wallet?

well, i cant really say if this would work, it would be better if you can try another platform or if you know where the problem is in the code, you can take a look at it

I have a transaction function and it works perfectly fine. The only issue is I want to get returning values from this function in the result, but the result returns me the tx hash.

// Calling method: function USER_MINT() external payable returns (bool _isSuccessful, uint256 _mintedWarriorId);
    public static async Task<bool> USER_MINT()
    {
            // MoralisInterface.InsertContractInstance("USER_MINT", ABI, chainId, contractAddr);
            Function f = MoralisInterface.EvmContractFunctionInstance("USER_MINT", chainId, "A_USER_MINT");
            HexBigInteger gas = new HexBigInteger(1000000);
            HexBigInteger value = new HexBigInteger(ethFee);
            // function returns me tx hash. I want the return _isSuccessful and _mintedWarriorId
            string result = await f.SendTransactionAsync(addr, gas, value);
            Debug.Log(result);
            return true;
    }

Hey, if this isnt possible to be gotten from the f.SendTransactionAsync you can parse the event of the transaction after it was mined to return the output,
you can take a look at the docs https://docs.moralis.io/

1 Like

Thx, sry for late reply

And how are you returning an output ?
i dont currently think this is possible ?
output can only be returned with the return keyword and the return keyword needs to be view, it looks like you have a payable in your smart contract function for that call ?
so how to you intend to return if your smart contract has a payable ?