MetaMask - Invalid amount in MetaMask app on iPhone

Hello, I am using Moralis for simple token transfer from one wallet to another. My code:

And this works great on desktop (Chrome MetaMask plugin):

But when I wanna use this on my phone - iPhone (MetaMask app), I always get error “Invalid amount”, and I don’t understand why, since I am executing same action.

Any idea?

1 Like

strange, I don’t have an idea now, you could look at view data in both cases to see if there is a difference

Try using a static amount in your options if you haven’t already.

Data Desktop (works):

image

Data Mobile (do not work):

My network settings:

image

I tried. Same result. Works only on desktop.

can you try to update metamask on mobile? in case that it is an older version

I have last version installed.

So there is no solution to that matter?

Can you try to make that transfer directly with web3 or ethers?
You could try a simpler transfer that sends only MATIC from one account to another account.

I would think that it is a problem related to metamask application.

I tried to send MATIC directly with ethers.js, and this is working on both desktop and mobile. My code:

strange, as it should to the same thing

So I guess there is problem with erc20, since its working with native matic.

Same issue on android metamask app. Works fine for native transfers. I also confirmed the raw transaction data matches.

Yes, I can send BNB on binance chain no problem, also MATIC on mumbai polygon chain, native works on desktop and mobile.

But erc20 works only on desktop. But I still dont know if this is metamask mobile problem or Moralis?

Having the exact same problem!
Did you manage to solve it somehow? Or understand why it happens ?

Nop, it’s not working. I though Moralis team would want to solve this problem, but there is no response…

did you try with ethers directly and it worked with an ERC20 token?

No, do you have example how to do it?

you can try something like this:

abi = [
{
        "constant": false,
        "inputs": [
            {
                "name": "_to",
                "type": "address"
            },
            {
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "transfer",
        "outputs": [
            {
                "name": "",
                "type": "bool"
            }
        ],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
]

ethers = Moralis.web3Library
web3 = await Moralis.enableWeb3()
signer = web3.getSigner()
contract = new ethers.Contract("0xcontract_address", abi, web3)
await contract.connect(signer).transfer("0x321314124", 100)

I didn’t test it if it really works

Ok I tried this. Had to change value to ethers.utils.parseUnits(Amount, 18).

Result is, that this also worked only on desktop, but not on mobile app :confused: