Approve function keeps glitching on mobile with walletconnect

hi, please why do my approve function button keep glitching at the frontend of my project, it will work and then suddenly stop working. And connecting to trust wallet through walletconnect sometimes show error message like 'walletconnect failed to connect", please help.

you have issues only with walletconnect? with metamask works fine on desktop?

yes, metamask works fine on desktop

And please why is my approve function frontend button keeps glitching?
it will work for now, then stop connecting with the user wallet?

I don’t know, you may have to provide more info about the code that you use.

async function approve() {

const options = {

  contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  // contractAddress: "0xd......",

  functionName: "approve",

  abi: [

    {"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}

  ],

  // abi: [

  //   {"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}

  // ],

  params: {

    _spender: "0x2.......",

    _value: 20,

  }

}

await Moralis.executeFunction(options);

};

return (
Get It!
);

please here is my codes.
return(
<Button ml="4" colorScheme="yellow" onClick={approve}>Get It!</Button> 
);

the rest of it

you can see here how to post code on forum:

this is the code that calls Moralis.executeFunction, any error when it doesn’t work?

No error, it just keeps freezing with no response on calling the wallet

That code should be ok. Have you tried using another mobile device? You can share a demo or repo of the project.

Thanks for your reply, I have tested it on other devices, it works…

1 Like