2

Metamask Confirm button not working, couldn't confirm transaction for a smart contract.

I use JS and WalletConnectProvider (website project). Connecting to Metamask by WalletConnect, then call transfer function for custom token contract. I use the same code on desktop and it works and transferring token. Exactly the same code doesn't work on mobile (for Metamask Mobile app). Checked IOS and also Android - the same issue. Please tell me what is wrong with my code:


<script src="https://cdn.jsdelivr.net/npm/@walletconnect/web3-provider@1.8.0/dist/umd/index.min.js"></script>
<script src="https://[mywebsitescriptspath]/web3.min.js"></script> // 1.8.0



<script type="text/javascript">

var contract
var accountFrom
const ABI = "... abi here....."

var provider = new WalletConnectProvider.default({
                        
infuraId: 'my infura id',
            
rpc: {
    1: "https://mainnet.infura.io/v3/[myinfuraid]",
    56: "https://bsc-dataseed.binance.org/"
    },
                
})


const contractAddress = '0xcontraddresshere'
const receiver = '0xreceiveraddresshere'

var connect = async () => {


await provider.enable()

var web3 = new Web3(provider)
                    
web3.givenProvider = web3.currentProvider
web3.eth.givenProvider = web3.currentProvider
web3.eth.accounts.givenProvider = web3.currentProvider



window.w3 = web3
        
contract = new w3.eth.Contract(ABI, contractAddress)



await w3.eth.getAccounts().then(accounts => {
                
    accountFrom = accounts[0]

    })

}

connect()

// function called after the button click
var sendtransaction = async () => {


let vall = 100
let calcAmount = w3.utils.toWei(vall.toString())

let transfer =  await contract.methods.transfer(receiver, calcAmount);

await transfer.send({from: accountFrom})
.on('transactionHash', function(hash){

   console.log(hash)

})



}


</script>

enter image description here

I tried many different things but it doesn't work.

Tested on wifi, on 4g, on different mobile browsers, on different smartphones (android and IOS). no success.

The problem started from 5.9.0 Metamask app version.

UPDATE: Now at 5.10.0 version it doesn't recognize custom contract token. For example when I want to transfer 1 token, it shows 1 BNB. Last version was better :))

There are open issues on github:

  1. https://github.com/MetaMask/metamask-mobile/issues/5193
  2. https://github.com/MetaMask/metamask-mobile/issues/5235
  3. https://github.com/MetaMask/metamask-mobile/issues/5260

No solution till now - after 14 days.

Stef Man
  • 21
  • 4

3 Answers3

0

Change version metamask, working me version - 5.7.0

Maandraj
  • 1
  • 1
  • Dear @Maandraj, thanks for your reply.Does this mean that everyone who uses the new versions of the Metamask mobile application also has a problem? I think it's not a solution, downgrade the app. I also contacted Metamask support. Once they answered me with a standard text, then there is no answer for 10 days, and also there is no new update of the application. – Stef Man Nov 10 '22 at 04:56
  • The problem of the application itself (meta mask) is mainly used through the browser and therefore a little-known bug – Maandraj Nov 16 '22 at 19:41
0

This issue was solved with the Metamask 5.11.0 updated for IOS 16.1.1. Update your Metamask app to 5.11.0.

Reference: https://github.com/MetaMask/metamask-mobile/issues/5260

wesley scholl
  • 21
  • 2
  • 9
  • Dear Wesley, thank you for your answer. As You see the issue re-opened at github, because actually it is not solved. I have 5.11.0 on my phone and also ios16.11 as well, but the problem still exists. It's not only iOS problem. the same is on Android. – Stef Man Nov 27 '22 at 08:18
0

Yes, actually they didn't resolve the issue.

In my case, different ERC20 tokens have different result.

On this token, the blue confirm button doesn't work. https://etherscan.io/token/0x377e0c5d3738FAcd2D4c1CA192c774e978E8e95b#writeContract

But on USDC (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) It works well.

iOS ver 16.1.2 MetaMask v5.12.0

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33367677) – ahuemmer Dec 14 '22 at 10:02