walletconnect-monorepo
walletconnect-monorepo copied to clipboard
Wallet Connect not exposing error.data when custom error is thrown
Describe the bug
Wallet Connect does not seem to return the original error from json rpc endpoint when the smart contract throws custom error which was introduced in Solidiy 0.8.4 https://blog.soliditylang.org/2021/04/21/custom-errors/ This leads to ethersjs unable to decode custom error which ccip-read relies on showing ENS offchain record
SDK Version (if relevant)
- Version 1.7.8
To Reproduce Steps to reproduce the behavior:
- Go to https://offchainexample2.surge.sh/name/1.offchainexample.eth/details
- ENS has various record such as ETH/LTC/email/description
- Click "Connect" on the left side
- Click "Wallet Connect".
- Then all the record disappears.
- Click "Disconnect"
- Then all the record reappear.
Expected behavior
When I put the following console.log at [checkError
function of ethers js] (https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/json-rpc-provider.ts#L52), The provider via Infura (which we connect during read only mode) returned error.data
on the left side of screenshot whereas wallet connect doesn't have any data on the right side of the screenshot below.
function checkError(method: string, error: any, params: any): any {
console.log('***checkError', {
method, error, params
})
Screenshots If applicable, add screenshots to help explain your problem.
![Screenshot_2022-04-26_at_20 15 45](https://user-images.githubusercontent.com/2630/166062433-9afe3350-ef46-40ef-82e2-2b594f4704e5.png)
Hi @makoto,
Thank you for the detailed report on this issue regarding the new custom error handling introduced in Solidity v0.8.4, as well as the live reproduction which is a huge help.
@IljaDaderko will be looking into a fix for this today, in the meantime is it possible for you to share the source/repo for offchainexample2.surge.sh
with us? Being able to run it locally ourselves to validate a possible fix against this concrete example would be the fastest route to patching it.
Hi @bkrem . Thanks for taking a look. You can use https://github.com/ensdomains/ens-app/pull/1468 . The PR has lots of instruction but that's for setting up against local ganache. For pointing to public network, it should be just like this.
git clone https://github.com/ensdomains/ens-app/
cd ens-app
git checkout offchain2
yarn
yarn start
Hi @bkrem let me know if there's anything we can help
@makoto Hey, initially we thought that it was a simple addition of data field and made a PR for it here https://github.com/WalletConnect/walletconnect-monorepo/pull/1006 but after some testing it looks to be more involved. This is on our radar and once some tasks on v2 are finished, I'll get back to it 👍
Hi @bkrem just checking on the progress.
Hi @makoto,
Was great meeting you today in person!
I just had a chance to test #1151 against the ens-app
offchain branch. It looks like error.data
is being passed now and the records are visible after connecting via WalletConnect 🎉
The steps are:
- Explicitly add the
ethereum-provider
prerelease that contains this upcoming fix to theens-app
deps:yarn add @walletconnect/ethereum-provider@next
- In
web3modal.js
, replace the value forproviderOptions.walletconnect.package
with() => import('@walletconnect/ethereum-provider'),
- In
setup.js
change theprovider.removeAllListeners()
line toprovider.events.removeAllListeners()
Let us know if you're still seeing issues around error forwarding, and sorry again about the wait on this 🙏