useDApp icon indicating copy to clipboard operation
useDApp copied to clipboard

Transaction Status error message is blank using WalletConnect

Open jhirn opened this issue 4 years ago • 4 comments

Hello. I've ben able to get WalletConnect adapter connecting after following a few examples. The problem I'm having is that useContractFunction doesn't seem to catch and populate the errors on TransactionStatus correctly. I've been using TransactionStatus in a useEffect hook to notify if the transaction fails/errors/suceeded. It's working perfectly fine with Metamask, but when using WalletConnect it comes back without any of the error details.

2nd console.log here is from when using WalletConnect as the Connection.

Screen Shot 2021-10-31 at 10 09 20 PM

I can confirm I'm getting back the same error message from WalletConnect's RPC call, however it's not making its way to TransactionStatus. I'm trying to trace this on my own as well but figured I'd open a ticket.

Screen Shot 2021-10-31 at 10 29 15 PM

jhirn avatar Nov 01 '21 03:11 jhirn

I've narrowed this down to usePromiseTransaction expecting an error object, but it seems that we're only getting a string from WalletConnect. I'm not sure if this is a problem with the connector or if we should just use the error message itself in usePromiseTransaction when it's not an error object. I really thought Typescript was supposed to save us from these types of problems haha.

https://github.com/EthWorks/useDApp/blob/be1875b4f70523b79f8724ce57611fc470db2570/packages/core/src/hooks/usePromiseTransaction.ts#L29

With Metamask:

Screen Shot 2021-10-31 at 10 52 46 PM

With WalletConnect:

Screen Shot 2021-10-31 at 11 01 21 PM

Edit:

I traced it far enough in WalletConnect that JsonRpc-http-connection#send is where the payload is returned, but despite it being an error the response code is 200. This does bubble up as an error so at some point they raise an exception but it's not wrapped in an error object.

I'm using WalletConnect 1.6.1 because that's the only version supported by web3-react. I will continue digging as I need this fixed.

jhirn avatar Nov 01 '21 04:11 jhirn

@jhirn how far did you go with this? also, how did you make it activate?

flatmapeth avatar Nov 09 '21 23:11 flatmapeth

I followed this codepen by the author of react-web3 to get it to activate. https://codesandbox.io/s/8rg3h

I have not made any progress on this error but I'm guessing I'll have to fork and fix. Not a lot of activity for fixing bugs on this or react-web3.

jhirn avatar Nov 10 '21 01:11 jhirn

I have tested it out on useDApp 1.1.5 and WalletConnect

I have been testing it in our WalletConnect docs page, adding an erroring transaction. I'm connecting MetaMask mobile on iOS through Wallet Connect. We use @walletconnect/web3-provider version 1.7.5.

Seems to be working properly, and the error is actually an error object in usePromiseTransaction:

Screenshot 2022-08-23 at 13 36 35


And, the Transaction State is properly populated with the error message:

Screenshot 2022-08-23 at 13 37 24

rzadp avatar Aug 23 '22 11:08 rzadp