Skip to content

feat: beautifyInterpretedName helper + example usage#2050

Merged
shrugs merged 3 commits intomainfrom
fix/example-app-hotfixes
May 5, 2026
Merged

feat: beautifyInterpretedName helper + example usage#2050
shrugs merged 3 commits intomainfrom
fix/example-app-hotfixes

Conversation

@shrugs
Copy link
Copy Markdown
Member

@shrugs shrugs commented May 4, 2026

Summary

  • Adds beautifyInterpretedName(name: InterpretedName): BeautifiedName to enssdk for converting an InterpretedName into a UI-presentable Name. Each label is preserved verbatim if it's an Encoded LabelHash, otherwise passed through ens_beautify from @adraffy/ens-normalize. Example: "♾♾♾♾.eth""♾️♾️♾️♾️.eth".
  • Introduces a new branded BeautifiedName nominal type alongside InterpretedName. The branded return type prevents the result from being passed to APIs that expect an InterpretedName (navigation targets, lookups, GraphQL variables, etc.).
  • Updates the enskit-react example app (DomainView, AccountView, SearchView) so all rendered names are beautified, while link to= and lookup keys continue to use the source InterpretedName. Also a small Home tweak in App.tsx to surface the connected ENSNODE_URL.

Test plan

  • pnpm -F enssdk typecheck
  • pnpm -F @ensnode/enskit-react-example typecheck
  • pnpm -F @namehash/namehash-ui typecheck
  • pnpm test --project enssdk (256 passed, includes new beautify.test.ts)
  • pnpm lint
  • Smoke test the example app: navigate to a domain whose label benefits from beautification (e.g. ♾♾♾♾.eth) and confirm the heading/link text renders the variation-selector form while the URL still uses the InterpretedName

Copilot AI review requested due to automatic review settings May 4, 2026 14:00
@shrugs shrugs requested a review from a team as a code owner May 4, 2026 14:00
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: fa8b516

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
enssdk Major
ensadmin Major
ensapi Major
ensindexer Major
ensrainbow Major
@ensnode/enskit-react-example Patch
@namehash/ens-referrals Major
@ensnode/ensdb-sdk Major
enskit Major
@ensnode/ensnode-react Major
@ensnode/ensnode-sdk Major
@ensnode/ensrainbow-sdk Major
@namehash/namehash-ui Major
@ensnode/integration-test-env Major
fallback-ensapi Major
@docs/ensnode Major
@docs/ensrainbow Major
enscli Major
ensskills Major
@ensnode/datasources Major
@ensnode/ponder-sdk Major
@ensnode/ponder-subgraph Major
@ensnode/shared-configs Major
@ensnode/ensindexer-perf-testing Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment May 5, 2026 4:50pm
ensnode-enskit-react-example Ready Ready Preview, Comment May 5, 2026 4:50pm
ensnode.io Ready Ready Preview, Comment May 5, 2026 4:50pm
ensrainbow.io Ready Ready Preview, Comment May 5, 2026 4:50pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@shrugs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c30e8b19-6230-4aa4-b6e3-592e547745d4

📥 Commits

Reviewing files that changed from the base of the PR and between 5729ac1 and fa8b516.

📒 Files selected for processing (9)
  • .changeset/enssdk-beautify-interpreted-name.md
  • examples/enskit-react-example/src/AccountView.tsx
  • examples/enskit-react-example/src/App.tsx
  • examples/enskit-react-example/src/DomainView.tsx
  • examples/enskit-react-example/src/SearchView.tsx
  • packages/enssdk/src/lib/beautify.test.ts
  • packages/enssdk/src/lib/beautify.ts
  • packages/enssdk/src/lib/index.ts
  • packages/enssdk/src/lib/types/ens.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/example-app-hotfixes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 4, 2026

Greptile Summary

This PR adds beautifyInterpretedName(name: InterpretedName): BeautifiedName to enssdk, which splits an InterpretedName into its labels and passes each through ens_beautify (preserving EncodedLabelHash labels verbatim). It also introduces the BeautifiedName branded nominal type to prevent beautified strings from accidentally being used where an InterpretedName is required.

  • New core utility: beautify.ts implements the function with correct early-return for ENS_ROOT_NAME and per-label processing; beautify.test.ts covers root name, normalized labels, encoded label hashes, and mixed cases.
  • Type system addition: BeautifiedName is added to types/ens.ts and flows through the existing barrel exports in types/index.tsindex.ts, making it available as a public package export.
  • Example app integration (DomainView, AccountView, SearchView): All rendered names are now beautified for display while the source InterpretedName continues to be used in route to= props and GraphQL variables, correctly preserving lookup semantics.

Confidence Score: 5/5

Safe to merge — the change is additive, well-tested, and correctly scoped to UI display paths.

The core function is simple and exercised by four targeted test cases. The branded BeautifiedName return type statically prevents the result from leaking into navigation or lookup APIs, and all three example-app components consistently keep raw InterpretedName in to= props and query variables. No existing behavior is modified; no new async paths or external calls are introduced beyond the already-used ens_beautify library.

No files require special attention.

Important Files Changed

Filename Overview
packages/enssdk/src/lib/beautify.ts New file implementing beautifyInterpretedName; correctly handles ENS Root Name early-return, splits by label, preserves EncodedLabelHash labels verbatim, and applies ens_beautify to normalized labels.
packages/enssdk/src/lib/beautify.test.ts New test file; covers root name, normalized-label beautification, verbatim EncodedLabelHash preservation, and a mixed-label case.
packages/enssdk/src/lib/types/ens.ts Adds BeautifiedName branded type with clear documentation distinguishing it from InterpretedName; the placement and barrel-export chain ensure it is publicly accessible from the package.
packages/enssdk/src/lib/index.ts Adds export * from "./beautify" in alphabetical order; both beautifyInterpretedName and BeautifiedName (via the types barrel) are now public package exports.
examples/enskit-react-example/src/DomainView.tsx Correctly applies beautifyInterpretedName for all display paths while keeping raw InterpretedName in route to= props and query variables.
examples/enskit-react-example/src/AccountView.tsx Correctly wraps displayed domain name in beautifyInterpretedName inside an existing truthy guard; navigation to= uses the unbeautified edge.node.name.
examples/enskit-react-example/src/SearchView.tsx Adds beautifyInterpretedName for the displayed link text inside a null guard; removes a now-stale comment.
examples/enskit-react-example/src/App.tsx Minor: wraps Home content in a <div> and adds a connected ENSNode URL line for developer orientation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[InterpretedName] --> B{name === ENS_ROOT_NAME?}
    B -- Yes --> C[return as BeautifiedName verbatim]
    B -- No --> D[interpretedNameToInterpretedLabels\nsplit by '.']
    D --> E{For each label}
    E --> F{isEncodedLabelHash?}
    F -- Yes --> G[preserve label verbatim]
    F -- No --> H[ens_beautify label\ne.g. ♾ → ♾️]
    G --> I[join with '.']
    H --> I
    I --> J[BeautifiedName]
    J --> K[UI Display only]
    A --> L[Navigation / Lookups\nInterpretedName kept unchanged]
Loading

Reviews (4): Last reviewed commit: "fix: bot notes (loop 3) — drop stale can..." | Re-trigger Greptile

Comment thread examples/enskit-react-example/src/SearchView.tsx
Comment thread packages/enssdk/src/lib/beautify.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new enssdk helper for converting InterpretedName values into UI-facing beautified names, and updates the React example app to render those beautified labels while keeping canonical names in navigation targets.

Changes:

  • Added BeautifiedName and beautifyInterpretedName() to enssdk, plus unit tests and a changeset.
  • Exported the new helper from the package root.
  • Updated the example app’s domain/account/search views to display beautified names, and surfaced ENSNODE_URL on the home page.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/enssdk/src/lib/types/ens.ts Adds the new branded BeautifiedName type and its docs.
packages/enssdk/src/lib/index.ts Re-exports the new beautify helper from the public library entrypoint.
packages/enssdk/src/lib/beautify.ts Implements beautifyInterpretedName() for InterpretedName inputs.
packages/enssdk/src/lib/beautify.test.ts Adds unit tests for root, normalized labels, and encoded labelhash handling.
examples/enskit-react-example/src/SearchView.tsx Beautifies rendered search results in the example search UI.
examples/enskit-react-example/src/DomainView.tsx Beautifies displayed domain names and makes owner addresses clickable.
examples/enskit-react-example/src/App.tsx Shows the configured ENSNODE_URL on the example home page.
examples/enskit-react-example/src/AccountView.tsx Beautifies owned-domain labels in the account view.
.changeset/enssdk-beautify-interpreted-name.md Records the enssdk minor release note for the new helper/type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/enskit-react-example/src/SearchView.tsx
@vercel vercel Bot temporarily deployed to Preview – ensnode.io May 4, 2026 14:20 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io May 4, 2026 14:20 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io May 4, 2026 14:20 Inactive
Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Comment states that canonical: true guarantees non-null node.name, but the GraphQL schema defines name as nullable and the code includes a defensive null guard

Fix on Vercel

Comment thread examples/enskit-react-example/src/SearchView.tsx
Copilot AI review requested due to automatic review settings May 4, 2026 14:43
@vercel vercel Bot temporarily deployed to Preview – ensnode.io May 4, 2026 14:43 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io May 4, 2026 14:43 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io May 4, 2026 14:43 Inactive
@shrugs
Copy link
Copy Markdown
Member Author

shrugs commented May 4, 2026

@greptile review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/enskit-react-example/src/SearchView.tsx
Comment thread examples/enskit-react-example/src/DomainView.tsx
Comment thread packages/enssdk/src/lib/beautify.ts
Base automatically changed from feat/eliminate-zero-address-placeholders to main May 5, 2026 16:45
@shrugs shrugs force-pushed the fix/example-app-hotfixes branch from fea4346 to fa8b516 Compare May 5, 2026 16:49
@shrugs
Copy link
Copy Markdown
Member Author

shrugs commented May 5, 2026

@greptileai review

@shrugs shrugs merged commit 92ca54f into main May 5, 2026
21 checks passed
@shrugs shrugs deleted the fix/example-app-hotfixes branch May 5, 2026 16:55
@github-actions github-actions Bot mentioned this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants