api3dao / api3-dao-dashboard

API3 DAO dashboard
api3.eth/
14 stars 14 forks source link

Update wallet connect and use custom RPC #431

Closed Siegrift closed 10 months ago

Siegrift commented 10 months ago

Based on user reported issue and internal communication.

Rationale

The failure was caused by CloudFlare problems. Because the public RPC URL is CLoudFlare ETH it was down as well.

One of the first issues I encountered was that regular MM connection was failing on localhost. The reason was a check which used public RPC provider instead of the provider bundled with MM on localhost. It's better to remove this special (localhost) handling.

I tried using wagmi multiple providers configuration with or without ranking, but both options produced error notifications. The site usually loaded, but I don't trust their fallback transport implementation. Ultimately, I suggest using only our alchemy provider URL.

I tested the implementation with Alchemy and whitelisted only API3 contracts and the site worked fine, except MM mobile which does some multicalls and I needed to whitelist this contract as well. I tested Wallet Connect on Trust Wallet and MetaMask.

Since I spent a lot of time fixing these issues I took the time and upgraded to wallet connect v3. The migration was quite simple because there is a guide to follow, but I needed to come up with metadata (used for display purposes in the mobile wallets when using wallet connect).

bbenligiray commented 10 months ago

https://etherscan.io/address/0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62 seems to be the UniversalResolver contract for ENS, I whitelisted that as well. ~Oddly enough I can't find any reference to this address in ethers so I suspect that it may change if we bump the ethers version at some point.~

Never mind, it's here https://github.com/wagmi-dev/viem/blob/main/src/chains/definitions/mainnet.ts#L39

Siegrift commented 10 months ago

FYI I think there is some more whitelisting to do, because I just ran this locally on mainnet and got some 403s from the provider:

Mhh, strange. I only have the same whitelisting set as Burak and I do not see any errors. I tried clicking a bunch of things and also proposals created by Burak and his ENS name shows correctly. What wallet/app-page did you reproduce that?

mcoetzee commented 10 months ago

Mhh, strange. I only have the same whitelisting set as Burak and I do not see any errors.

It's no longer an issue because Burak has added 0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62 to the whitelist 👍

Siegrift commented 10 months ago

It's no longer an issue because Burak has added 0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62 to the whitelist 👍

But I am using my alchemy instance and I don't have the contract whitelisted. I am just wondering, why I wasn't able to reproduce that error.

image
mcoetzee commented 10 months ago

But I am using my alchemy instance and I don't have the contract whitelisted. I am just wondering, why I wasn't able to reproduce that error.

I'm guessing those ENS names were already cached for you locally. Try clearing your local storage.

Siegrift commented 10 months ago

I'm guessing those ENS names were already cached for you locally. Try clearing your local storage.

Tried on incognito with both MM and TrustWallet and didn't see those errors.