WalletConnect / walletconnect-monorepo

WalletConnect Monorepo
Apache License 2.0
1.38k stars 684 forks source link

Bug related transactions through walletConnect (MetaMask Mobile) #3808

Closed hammasxd closed 11 months ago

hammasxd commented 11 months ago

Describe the bug I am using a safe mint function of my erc721 contract. it is working all fine when i safeMint an nft but when i connect the same wallet acount using my mobile meta mask application and connect it to my dApp using wallet Connect it shows this error. Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="toNumber", value="19300437843035662731941949251313492656457055567922050759773623928527117799173", code=NUMERIC_FAULT, version=bignumber/5.7.0) i am not performing such ToNumber operation and the error is catched here const functionCall=await contract?.call('safeMint',[connectedAddress,uri]).catch((err)=>{ console.log(err); //here });

I am using "@thirdweb-dev/react": "^3.14.36" and "@thirdweb-dev/sdk": "^3.10.56", for connections and contract intractions this is my minting function //// const minting = async () => { if (connectedWallet) { const contract =await sdk?.getContractFromAbi('contractAddress',erc721Abi); if (contract) { try{ const functionCall=await contract?.call('safeMint',[connectedAddress,uri]).catch((err)=>{ console.log(err); }); const sentTx=await functionCall?.receipt; console.log('receipt : ',sentTx); if (sentTx) { toast.success( "Transaction submitted successfully. Wait for confirmation." );

          }

    }catch(err){
      console.log('error in Mint: ',err)
    }

  }

}

}; ///

To Reproduce Steps to reproduce the behavior:

  1. Connect meta mask mobile using wallet connect
  2. call a safeMint function and confirm it on mobile.
  3. it will throw an error before even the transaction is completed. 4.But the transaction still confirms and minting works but it shows error in console.

Expected behavior Mint the nft and return receipt

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

ganchoradkov commented 11 months ago

@hammasxd what error is shown in your dapp?

hammasxd commented 11 months ago

@hammasxd what error is shown in your dapp?

Hi ! Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="toNumber", value="19300437843035662731941949251313492656457055567922050759773623928527117799173", code=NUMERIC_FAULT, version=bignumber/5.7.0) this error is thrown on contract call safeMint function but it works fine when i do this using metamask extension

hammasxd commented 11 months ago

@hammasxd what error is shown in your dapp?

i think you can reproduce the error on any contract call because the same error comes when i am creating a collection while it was working all fine just a month ago,I've not updated any libraries

ganchoradkov commented 11 months ago

could you provide an example repo where we could setup the exact case as you? WalletConnect v2 transports the message so chance is the reponse from MM wallet might not be correct thus causing the error

hammasxd commented 11 months ago

could you provide an example repo where we could setup the exact case as you? WalletConnect v2 transports the message so chance is the reponse from MM wallet might not be correct thus causing the error

we are currently facing this issue on our live app monex.ibanera.com/ i dont have any demo repo for now but we are using same functions for mobile and web extensions transactions so it must not be MM wallet issue because ive also tested it on Trust wallet it shows the same error.

hammasxd commented 11 months ago

could you provide an example repo where we could setup the exact case as you? WalletConnect v2 transports the message so chance is the reponse from MM wallet might not be correct thus causing the error

??

glitch-txs commented 11 months ago

i dont have any demo repo for now but we are using same functions for mobile and web extensions transactions so it must not be MM wallet issue because ive also tested it on Trust wallet it shows the same error.

Could you create one with the very minimal needed to reproduce the issue?

Fabioepb commented 11 months ago

This seems to happen with other mobile wallets as well, I've tested MetaMask mobile wallet, Trust Wallet and Fireblocks. They all experience the same NUMERIC_FAULT error.

The actual error message: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="toNumber", value="39429324759775805056870346697879527774854152784605618705975791686434047059132", code=NUMERIC_FAULT, version=bignumber/5.7.0)

Steps to reproduce:

  1. Connect any Mobile Wallet app using WalletConnect (Through thirdweb-dev/sdk)
  2. Sign any transaction
  3. Tx approval is sent to mobile wallet
  4. Approve the tx
  5. The transaction will fail after being parsed on the front end
    • note: The transaction does succesfully get submitted to the blockchain, it's just the parsing afterwards for the hash that causes the issue
glitch-txs commented 11 months ago

This is a MetaMask or ethers issue. Closing for lack of MRE. Feel free to reopen with a MRE. For Thirdweb related issues please open an issue in their repository. Thanks!