Transactions are not sent to Contract in Metamask Mobile, but calling Contract and signing messages are available

Transactions for contracts can be executed on Chrome on the desktop where the Metamask extension is installed, but from Metamask Mobile, the transaction does not proceed to the transaction confirmation screen and the transaction cannot be executed.

This issue may be related to the following topics, but we have already confirmed restarting your smartphone and reinstalling Metamask. It didn’t improve.

  • mobile-metamask-not-picking-up-transactions/17220

On the other hand, I’ve looked at other DApps like uniswap and it seems that the transaction to the contract works fine.

My DApps implementation has the following dependencies:

  • web3@1.7.3
  • @metamask/detect-provider@1.2.0
  • typechain@8.0.0
  • @typechain/web3-v1@6.0.0

Also, operate the contract with the typescript code generated by the following command.

npx typechain --target ethers-v5 --out-dir src/types/ethers-v5-contracts contract-path

The call to the contract is working and the code looks like this:

return await this.contract.methods.callName().call();

Transactions to contracts, on the other hand, only work on mobile.

    alert ("start");
    const tx = this.contract.methods.txName(xxx, xxx, xxx)
        .send({from: address, value: xxx});
    alert ("end");

In this case, we will only see an alert that says only “start”, no “end”, and no transaction confirmation screen.

Is there any solution?

1 Like

Excuse me. I made a mistake in the description of the typechain generation command. It was described as target = ethers-v5.

npx typechain --target ethers-v5 --out-dir src/types/ethers-v5-contracts contract-path 

The correct one is target=web3-v1.

npx typechain --target web3-v1 --out-dir src/types/web3-v1-contracts contract-path
2 Likes

It seems that it failed with an error just before the call because web3.utils.toBN was not explicitly called when sending the numerical value in the range of uint256.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.