reown-com / web-examples

Wallet and dapp examples implementing WalletConnect v2
https://walletconnect.com
Apache License 2.0
395 stars 331 forks source link

[dApp] Problem with smart contract wallet integration #117

Closed basheerAudteye closed 1 year ago

basheerAudteye commented 1 year ago

We have an NFT renting product, rntd.io ,This product is still under development. We are still in the alpha version, we used walletConnect V1 to integrate our smart contract wallet with projects. In V1, we did not face any problems with the integration with other projects, we used to authenticate personal_sign and typed_data to our smart contract with no effort due to verifySignature function that checks if the address is EOA address or smart contract address https://github.com/WalletConnect/walletconnect-example-dapp/blob/master/src/helpers/utilities.ts#L181

But in V2, the provided dApp examples use verifyEip155MessageSignature, which is only valid for EOA wallets, not for smart contract wallets that rely on the concept of erc1271. https://github.com/WalletConnect/web-examples/blob/main/dapps/react-dapp-v2-with-ethers/src/pages/index.tsx#L69 When the function recovers the address of the wallet that signed the message, which owns the smart contract wallet, and compare it to the smart contract address, the validation will fail. As a result, we can not verify the personal message. My question is, what are we missing, or what can we do to overcome this problem

basheerAudteye commented 1 year ago

I made a pull request trying to fix the problem https://github.com/WalletConnect/web-examples/pull/140