-
Notifications
You must be signed in to change notification settings - Fork 16
Add getDefaultEnsNodeUrl #1553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getDefaultEnsNodeUrl #1553
Conversation
🦋 Changeset detectedLatest commit: eb7aa05 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughWalkthroughAdds 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
…r the default ENSNode deployment for a given ENS namespace
There was a problem hiding this 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.tsmodule withgetDefaultEnsNodeUrlutility function and namespace-specific URL constants - Refactored
client.tsto 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 SummaryThis PR adds a
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
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
lightwalker-eth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review completed 👍
There was a problem hiding this 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.
Lite PR
Summary
getDefaultEnsNodeUrlWhy
Testing
Pre-Review Checklist (Blocking)