Skip to content

Conversation

@lightwalker-eth
Copy link
Member

@lightwalker-eth lightwalker-eth commented Jan 21, 2026

Lite PR

Summary

  • Adding util function for getDefaultEnsNodeUrl

Why

  • Give a better solution for getting the ENSNode url for particular namespaces (ex: Sepolia)

Testing

  • unit test pass

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

Copilot AI review requested due to automatic review settings January 21, 2026 14:25
@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: eb7aa05

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

This PR includes changesets to release 18 packages
Name Type
@ensnode/ensnode-sdk Patch
ensadmin Patch
ensapi Patch
ensindexer Patch
ensrainbow Patch
fallback-ensapi Patch
@namehash/ens-referrals Patch
@ensnode/ensnode-react Patch
@ensnode/ensrainbow-sdk Patch
@namehash/namehash-ui Patch
@ensnode/datasources Patch
@ensnode/ponder-metadata Patch
@ensnode/ensnode-schema Patch
@ensnode/ponder-subgraph Patch
@ensnode/shared-configs Patch
@docs/ensnode Patch
@docs/ensrainbow Patch
@docs/mintlify Patch

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
Contributor

vercel bot commented Jan 21, 2026

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

Project Deployment Review Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jan 21, 2026 2:56pm
2 Skipped Deployments
Project Deployment Review Updated (UTC)
ensnode.io Skipped Skipped Jan 21, 2026 2:56pm
ensrainbow.io Skipped Skipped Jan 21, 2026 2:56pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a deployments module that exposes namespace-specific default ENSNode API URLs and a getDefaultEnsNodeUrl utility; ENSNode client and tests updated to use namespace-aware URL resolution; deployments re-exported and validated by new tests.

Changes

Cohort / File(s) Summary
Changeset Metadata
\.changeset/brown-pears-help.md
Patch release changeset documenting the new getDefaultEnsNodeUrl utility.
Deployment Utilities
packages/ensnode-sdk/src/deployments.ts
New module exporting DEFAULT_ENSNODE_API_URL_MAINNET, DEFAULT_ENSNODE_API_URL_SEPOLIA, and getDefaultEnsNodeUrl(namespace?: ENSNamespaceId): URL with namespace resolution and unsupported-namespace error.
Module Exports
packages/ensnode-sdk/src/index.ts
Re-exports deployment utilities via export * from "./deployments".
Client Implementation
packages/ensnode-sdk/src/client.ts
Removes DEFAULT_ENSNODE_API_URL; ENSNodeClient.defaultOptions() now uses getDefaultEnsNodeUrl(); imports updated to use deployment utilities.
Client Tests
packages/ensnode-sdk/src/client.test.ts
Tests updated to import/assert against DEFAULT_ENSNODE_API_URL_MAINNET and getDefaultEnsNodeUrl(ENSNamespaceIds.Mainnet); URL expectations adjusted accordingly.
Deployment Tests
packages/ensnode-sdk/src/deployments.test.ts
New Vitest tests covering default (mainnet), explicit mainnet, sepolia resolution, and unsupported-namespace error for getDefaultEnsNodeUrl.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Deployments as Deployments
    participant ENSNode as ENSNode API

    Client->>Deployments: getDefaultEnsNodeUrl(namespace?)
    Deployments-->>Client: URL (default Mainnet or namespace-specific)
    Client->>ENSNode: HTTP request to URL + endpoint (e.g., /resolve-records)
    ENSNode-->>Client: HTTP response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

ensnode-internal

Poem

🐇 I hopped through code, a tiny guide,

Namespaces chosen, URLs supplied,
Mainnet or Sepolia, paths unfurl,
Little hops to fetch the world,
A carrot cheer for each new stride 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly describes the main change: adding a new utility function named getDefaultEnsNodeUrl, which matches the core objective of the PR.
Description check ✅ Passed The description follows the template structure with Summary, Why, Testing, and Pre-Review Checklist sections completed. All required sections are present and provide adequate context for the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/getDefaultEnsNodeUrl

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

…r the default ENSNode deployment for a given ENS namespace
Copy link
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

This PR adds a utility function getDefaultEnsNodeUrl to provide a standardized way of obtaining ENSNode API URLs for different ENS namespaces (Mainnet and Sepolia). The refactoring improves code organization by consolidating deployment-related constants and logic into a dedicated module.

Changes:

  • Added new deployments.ts module with getDefaultEnsNodeUrl utility function and namespace-specific URL constants
  • Refactored client.ts to use the new utility function and removed the hardcoded default URL constant
  • Updated test imports to use the new constants and function

Reviewed changes

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

File Description
packages/ensnode-sdk/src/index.ts Exports the new deployments module
packages/ensnode-sdk/src/deployments.ts Introduces utility function and constants for ENSNode API URLs by namespace
packages/ensnode-sdk/src/client.ts Refactors to use new utility function, removes old constant, and updates documentation with usage examples
packages/ensnode-sdk/src/client.test.ts Updates imports and test expectations to use new constants and functions

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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR adds a getDefaultEnsNodeUrl utility function that provides a centralized way to get the default ENSNode API URL for a given ENS namespace (Mainnet or Sepolia). The implementation:

  • Creates a new deployments.ts module with constants for Mainnet and Sepolia URLs
  • Exports a getDefaultEnsNodeUrl() function that takes an ENSNamespaceId and returns the appropriate URL
  • Refactors ENSNodeClient to use this utility instead of a hardcoded constant
  • Updates all tests to use the new constants and function
  • Includes proper JSDoc documentation with usage examples
  • Adds a changeset for versioning

The changes are well-structured and improve maintainability by centralizing deployment URL configuration. The function properly handles the two public ENS namespaces (Mainnet and Sepolia) and throws an error for unsupported namespaces.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward refactoring with no breaking changes - the default behavior remains identical (Mainnet URL), all existing tests pass with updated references, and the new utility function has proper error handling for unsupported namespaces. The implementation is clean, well-documented, and follows existing patterns in the codebase.
  • No files require special attention

Important Files Changed

Filename Overview
packages/ensnode-sdk/src/deployments.ts New module exports constants for Mainnet/Sepolia ENSNode URLs and utility function to get URL by namespace
packages/ensnode-sdk/src/client.ts Refactored to use getDefaultEnsNodeUrl() instead of hardcoded constant, added usage examples in JSDoc
packages/ensnode-sdk/src/client.test.ts Updated all test references from old DEFAULT_ENSNODE_API_URL constant to new DEFAULT_ENSNODE_API_URL_MAINNET and getDefaultEnsNodeUrl()

Sequence Diagram

sequenceDiagram
    participant User
    participant ENSNodeClient
    participant getDefaultEnsNodeUrl
    participant URL

    User->>ENSNodeClient: new ENSNodeClient()
    ENSNodeClient->>ENSNodeClient: defaultOptions()
    ENSNodeClient->>getDefaultEnsNodeUrl: getDefaultEnsNodeUrl(ENSNamespaceIds.Mainnet)
    alt Mainnet namespace
        getDefaultEnsNodeUrl->>URL: new URL("https://api.alpha.ensnode.io")
    else Sepolia namespace
        getDefaultEnsNodeUrl->>URL: new URL("https://api.alpha-sepolia.ensnode.io")
    else Unknown namespace
        getDefaultEnsNodeUrl-->>ENSNodeClient: throw Error
    end
    URL-->>getDefaultEnsNodeUrl: URL object
    getDefaultEnsNodeUrl-->>ENSNodeClient: URL object
    ENSNodeClient-->>User: ENSNodeClient instance

    Note over User,URL: Alternative: User provides specific namespace
    User->>ENSNodeClient: new ENSNodeClient({ url: getDefaultEnsNodeUrl(ENSNamespaceIds.Sepolia) })
    ENSNodeClient->>getDefaultEnsNodeUrl: getDefaultEnsNodeUrl(ENSNamespaceIds.Sepolia)
    getDefaultEnsNodeUrl->>URL: new URL("https://api.alpha-sepolia.ensnode.io")
    URL-->>getDefaultEnsNodeUrl: URL object
    getDefaultEnsNodeUrl-->>ENSNodeClient: URL object
    ENSNodeClient-->>User: ENSNodeClient instance
Loading

Copy link
Member Author

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

Self-review completed 👍

Copy link
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 6 out of 6 changed files in this pull request and generated 2 comments.


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

@vercel vercel bot temporarily deployed to Preview – ensrainbow.io January 21, 2026 14:55 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io January 21, 2026 14:55 Inactive
@lightwalker-eth lightwalker-eth merged commit 220b71f into main Jan 21, 2026
15 of 16 checks passed
@lightwalker-eth lightwalker-eth deleted the feat/getDefaultEnsNodeUrl branch January 21, 2026 15:38
@github-actions github-actions bot mentioned this pull request Jan 21, 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.

3 participants