-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: add space id web3 name sdk to tools #508
base: main
Are you sure you want to change the base?
Conversation
@minghuipei is attempting to deploy a commit to the Zeta Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe changes include the addition of a new entry for "space-id" in the JSON metadata file and the introduction of a new documentation file for the SPACE ID Web3 Name SDK. The JSON entry specifies the title and description of the SDK, while the documentation outlines its functionalities, setup instructions, and usage examples, focusing on domain name resolution and reverse resolution of conventional addresses. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant SDK
participant Blockchain
Developer->>SDK: Install SDK
SDK->>Developer: Provide setup instructions
Developer->>SDK: Resolve web3 domain name
SDK->>Blockchain: Query domain information
Blockchain-->>SDK: Return domain details
SDK-->>Developer: Provide domain information
Developer->>SDK: Reverse resolve conventional address
SDK->>Blockchain: Query reverse resolution
Blockchain-->>SDK: Return primary domain name
SDK-->>Developer: Provide primary domain name
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (4)
src/pages/reference/_meta.json (1)
17-17
: Consider enhancing the description for better clarity.The current description "SPACE ID Web3 Name SDK" could be more informative about the SDK's purpose and capabilities.
- "description": "SPACE ID Web3 Name SDK" + "description": "Tools and utilities for Web3 domain name resolution using SPACE ID SDK"src/pages/reference/space-id/setup.mdx (3)
34-34
: Consider relaxing the viem version constraintThe current installation command specifies a strict version requirement for viem (
^1.20
). Consider using a more flexible version range to allow for compatible updates.-npm install @web3-name-sdk/core viem@^1.20 +npm install @web3-name-sdk/core viem@^1
36-42
: Enhance Next.js configuration documentationThe Next.js configuration section would benefit from explaining why transpilation is necessary and potential implications.
Add context about the transpilation requirement:
If you are using next.js, please add the following configuration in your next.config.js in order to transpile commonjs dependencies: +// This configuration is required because @web3-name-sdk/core is distributed as CommonJS, +// and Next.js needs to transpile it to ensure compatibility with its module system. const nextConfig = { transpilePackages: ["@web3-name-sdk/core"], };
104-104
: Consider adding additional documentation sectionsThe documentation would benefit from the following additional sections:
- Error handling and troubleshooting guide
- TypeScript type definitions and interfaces
- Advanced usage scenarios and best practices
- Rate limiting and performance considerations
Would you like me to help draft content for these sections?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
src/pages/reference/_meta.json
(1 hunks)src/pages/reference/space-id/_meta.json
(1 hunks)src/pages/reference/space-id/setup.mdx
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/pages/reference/space-id/_meta.json
🧰 Additional context used
🪛 LanguageTool
src/pages/reference/space-id/setup.mdx
[style] ~17-~17: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...gy: TLD Primary Name: - Every address is able to set TLD Primary Name to configure a rev...
(BE_ABLE_TO)
[uncategorized] ~54-~54: You might be missing the article “an” here.
Context: ... 2. Resolve a domain name You can get address from domain name with a single request:...
(AI_EN_LECTOR_MISSING_DETERMINER_AN)
[uncategorized] ~54-~54: You might be missing the article “a” here.
Context: ... domain name You can get address from domain name with a single request: ```typescr...
(AI_EN_LECTOR_MISSING_DETERMINER_A)
🔇 Additional comments (1)
src/pages/reference/_meta.json (1)
15-17
: LGTM! The structure and integration are well-implemented.
The new "space-id" section follows the established pattern and maintains consistency with existing entries.
--- | ||
title: SPACE ID Web3 Name SDK | ||
description: | ||
--- |
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.
Add missing description in frontmatter metadata
The description field in the frontmatter metadata is empty. This could affect documentation generation and SEO.
Add a concise description, for example:
---
title: SPACE ID Web3 Name SDK
description:
+description: "A comprehensive SDK for resolving Web3 domain names and performing reverse address resolution across different blockchains and TLDs"
---
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
--- | |
title: SPACE ID Web3 Name SDK | |
description: | |
--- | |
--- | |
title: SPACE ID Web3 Name SDK | |
description: "A comprehensive SDK for resolving Web3 domain names and performing reverse address resolution across different blockchains and TLDs" | |
--- |
const record = await sid.getDomainRecord({ | ||
name: "zeta.zeta", | ||
key: "avatar", | ||
}); | ||
``` |
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.
Fix inconsistent variable naming in examples
The variable sid
is used here, but web3name
was used in previous examples. This inconsistency could confuse users.
-const record = await sid.getDomainRecord({
+const record = await web3name.getDomainRecord({
name: "zeta.zeta",
key: "avatar",
});
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const record = await sid.getDomainRecord({ | |
name: "zeta.zeta", | |
key: "avatar", | |
}); | |
``` | |
const record = await web3name.getDomainRecord({ | |
name: "zeta.zeta", | |
key: "avatar", | |
}); |
// requesting | ||
const metadata = await web3Name.getMetadata({ name: "public.zeta" }); | ||
``` |
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.
🛠️ Refactor suggestion
Enhance metadata example with error handling and response structure
The metadata example would benefit from error handling and showing the expected response structure.
-// requesting
-const metadata = await web3Name.getMetadata({ name: "public.zeta" });
+try {
+ const metadata = await web3name.getMetadata({ name: "public.zeta" });
+ // Example response structure:
+ // {
+ // name: string;
+ // tokenId: string;
+ // chainId: number;
+ // owner: string;
+ // resolver: string;
+ // // ... other metadata fields
+ // }
+} catch (error) {
+ console.error('Failed to fetch metadata:', error);
+}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// requesting | |
const metadata = await web3Name.getMetadata({ name: "public.zeta" }); | |
``` | |
try { | |
const metadata = await web3name.getMetadata({ name: "public.zeta" }); | |
// Example response structure: | |
// { | |
// name: string; | |
// tokenId: string; | |
// chainId: number; | |
// owner: string; | |
// resolver: string; | |
// // ... other metadata fields | |
// } | |
} catch (error) { | |
console.error('Failed to fetch metadata:', error); | |
} |
@minghuipei the doc looks good, but can you, please, move it to https://github.com/zeta-chain/docs/tree/main/src/pages/developers/services ? This is where all our third-party tutorials are. Thanks! |
1bf6f94
to
535ad3f
Compare
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (6)
src/pages/developers/services/_meta.json (1)
30-32
: Consider maintaining alphabetical ordering of entries.For better maintainability and easier navigation, consider moving the "space-id" entry before "subquery" to maintain alphabetical ordering.
"pyth": { "title": "Pyth", "description": "Price and VRF Oracle" }, + "space-id": { + "title": "Web3 Name SDK", + "description": "SPACE ID Web3 Name SDK" + }, "subquery": { "title": "SubQuery", "description": "Open-source, flexible, multi-chain data indexer" }, "goldrush": { "title": "GoldRush", "description": "Historical blockchain data API" - }, - "space-id": { - "title": "Web3 Name SDK", - "description": "SPACE ID Web3 Name SDK" }src/pages/developers/services/space-id.mdx (5)
1-4
: Consider enhancing frontmatter with additional metadata.Consider adding helpful metadata fields such as:
sidebar_label
: For navigation menu displaytags
: For documentation categorizationkeywords
: For search optimization--- title: SPACE ID Web3 Name SDK description: Resolve web3 domain name or reverse resolve conventional address +sidebar_label: SPACE ID +tags: ['web3', 'domain', 'sdk'] +keywords: ['space id', 'web3 name', 'domain resolution'] ---
17-17
: Improve readability with concise wording.Consider rephrasing for clarity and conciseness.
-Every address is able to set TLD Primary Name to configure +Every address can set TLD Primary Name to configure🧰 Tools
🪛 LanguageTool
[style] ~17-~17: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...gy: TLD Primary Name: - Every address is able to set TLD Primary Name to configure a rev...(BE_ABLE_TO)
8-11
: Enhance list formatting for better readability.Consider using consistent formatting for the capability descriptions.
The primary capabilities of the SDK include: -Domain Name Resolution: It resolves domain names to obtain essential information about the domain, including its associated conventional address, various records (such as avatars, IPFS links, social data), and metadata, etc. +1. Domain Name Resolution + - Resolves domain names to obtain essential information + - Retrieves associated conventional addresses + - Fetches various records (avatars, IPFS links, social data) + - Provides domain metadata
34-34
: Consider specifying version ranges for dependencies.The installation command should specify compatible version ranges for better dependency management.
-npm install @web3-name-sdk/core viem@^1.20 +npm install @web3-name-sdk/core@^1.0.0 viem@^1.20.0
69-74
: Add TypeScript type annotations for better code documentation.Consider adding type information to improve code clarity and IDE support.
// Resolve an address from Zeta Chain -const name = await web3name.getDomainName({ +interface ResolutionParams { + address: string; + queryChainIdList?: number[]; +} + +const name: string = await web3name.getDomainName({ address: "0x253a4ee0acb7c89bab7c20097200ea240119049a", queryChainIdList: [7000], }); // expect: karlyshka.zeta
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/pages/developers/services/_meta.json
(1 hunks)src/pages/developers/services/space-id.mdx
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/services/space-id.mdx
[style] ~17-~17: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...gy: TLD Primary Name: - Every address is able to set TLD Primary Name to configure a rev...
(BE_ABLE_TO)
🔇 Additional comments (2)
src/pages/developers/services/_meta.json (1)
29-32
: LGTM! Entry structure is consistent with existing patterns.
The new "space-id" entry maintains proper JSON formatting and follows the established pattern of title and description fields.
src/pages/developers/services/space-id.mdx (1)
1-104
: Documentation placement looks good.
The file is correctly placed in the /developers/services
directory as requested by the reviewer fadeev.
🧰 Tools
🪛 LanguageTool
[style] ~17-~17: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...gy: TLD Primary Name: - Every address is able to set TLD Primary Name to configure a rev...
(BE_ABLE_TO)
const address = await web3name.getAddress("zeta.zeta"); | ||
const address = await web3name.getAddress("bts_official.lens"); | ||
const address = await web3name.getAddress("beresnev.crypto"); | ||
const address = await web3name.getAddress("registry.zeta"); | ||
``` |
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.
🛠️ Refactor suggestion
Add error handling to resolution examples.
Consider demonstrating proper error handling for failed resolutions.
const address = await web3name.getAddress("zeta.zeta");
+
+// Example with error handling
+try {
+ const address = await web3name.getAddress("nonexistent.zeta");
+} catch (error) {
+ if (error.code === 'DOMAIN_NOT_FOUND') {
+ console.error('Domain does not exist');
+ } else {
+ console.error('Resolution failed:', error.message);
+ }
+}
Committable suggestion skipped: line range outside the PR's diff.
@fadeev I have updated, please review it one more. Thanks~ |
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.
Looks good 👍
Summary by CodeRabbit
New Features
Documentation