fix: resolve ENS reverse records via viem Universal Resolver#679
Conversation
ethers v5 lookupAddress only reads the legacy addr.reverse node, so orchestrators who set their ENS primary name via the modern (ENSIP-19/L2) flow showed no name/avatar on their profile. Switch getEnsForAddress and getEnsForVotes to viem getEnsName/getEnsText, whose Universal Resolver honors both legacy and modern reverse records. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates ENS reverse resolution in the Explorer API to support modern ENS primary names (ENSIP-19 / L2 primary names) by switching from ethers v5 reverse lookup to viem’s Universal Resolver-backed ENS helpers.
Changes:
- Replace
etherslookupAddressusage withl1PublicClient.getEnsNamefor reverse resolution. - Fetch ENS text records (description, url, socials, avatar) via
l1PublicClient.getEnsTextusing a normalized name. - Update avatar presence logic to rely on the
avatartext record.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| url, | ||
| twitter, | ||
| github, | ||
| avatar: avatar?.url ? `/api/ens-data/image/${name}` : null, | ||
| avatar: avatar ? `/api/ens-data/image/${name}` : null, | ||
| }; |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ENS module migrates name resolution from the deprecated ChangesENS API Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Orchestrators who set their ENS primary name via the current ENS flow (ENSIP-19 / L2 primary names) show only their address on the profile — no ENS name or avatar.
Cause
Reverse resolution used ethers v5
lookupAddress, which only reads the legacyaddr.reverseregistry node. Names set through the modern flow live elsewhere, so resolution returnednull.Fix
Switch
getEnsForAddress/getEnsForVotesto viem'sgetEnsName/getEnsTexton the existingl1PublicClient, whose Universal Resolver resolves both legacy and modern reverse records. Avatar presence now uses theavatartext record (the image proxy already resolves the image).Summary by CodeRabbit