web3modal
web3modal copied to clipboard
[bug] Alternate ENS name resolution is completely ignored if you have an ENS identity
Link to minimal reproducible example
https://web3modal.justfixit.dev/
Summary
Alternate ENS name resolution is completely ignored if you have an ENS identity
Reproduction Steps:
- Obtain and set a primary ens name onENS Domains
- Obtain and set a primary ens name onAvvy Domains
- Click the chain button
- Switch to Avalanche chain by clicking it
- Close the modal
- Observe the profile name in the account button not respecting the chain ensResolver
Traced issue: Your profile name and image are managed by AccountController here: https://github.com/WalletConnect/web3modal/blob/8eeae0f948c05449aa3f10f435dec2e66b55939c/packages/core/src/controllers/AccountController.ts#L54-L60 setProfileName is called in syncProfile here: https://github.com/WalletConnect/web3modal/blob/8eeae0f948c05449aa3f10f435dec2e66b55939c/packages/wagmi/src/client.ts#L291-L309 which calls fetchIdentity here: https://github.com/WalletConnect/web3modal/blob/8eeae0f948c05449aa3f10f435dec2e66b55939c/packages/core/src/controllers/BlockchainApiController.ts#L15-L23
Doing this completely disrespects the ensResolver set in the chain config. It would be infinitely less opinionated if you had additional checks prior like... "am i on chainId 1", "If im on chainId 1, is the ensResolver config different from default wagmi?" etc.
List of related npm package versions
https://github.com/dirtycajunrice/web3modal-bug-examples-2023-10-21/blob/9269c51dfe95d7ec2a5e0efebd3fb3923c9b79f1/package.json#L11-L19
"dependencies": {
"@web3modal/wagmi": "^3.1.0",
"next": "13.5.6",
"react": "^18",
"react-code-blocks": "^0.1.4",
"react-dom": "^18",
"viem": "^1.16.6",
"wagmi": "^1.4.5"
},
@enesozturk This was not completed. It removed showing the ENS name on other networks other than main, but now literally just drops all ENS resolution on other chains because of the main chain check for syncProfile.
Hey @dirtycajunrice, oh, isn't expected to not show profile data from the ENS when the active chain is not Ethereum? Since the ENS is on Ethereum chain? Wouldn't showing ENS profiles on different chains be wrong?
@enesozturk No it is not expected. MANY other chains have ENS Resolvers native to their chain.
import { avalanche } from "wagmi/chains";
const avvyDomainsResolver: Address = "0x40b0DC99681Db9703939bd62D76F4D448ab0fdE";
const chains = [
{
...avalanche,
contracts: {
...avalanche.contracts,
ensUniversalResolver: {
address: avvyDomainsResolver,
},
},
},
];
This configuration using wagmi directly works exactly as intended for avalanche.
I'll reopen it as feature requests since this wasn't integrated yet
@enesozturk @glitch-txs if we submit a PR that fixes this would you be willing to review and merge?