ens-components
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese@thenamespace/ens-components
@thenamespace/ens-components
React UI kit for ENS and Namespace flows. Built on wagmi; no wallet UI library is required.
用于ENS和Namespace流程的React UI工具包。基于wagmi构建;无需钱包UI库。
Which One To Use
如何选择组件
| Need | Use |
|---|---|
Register a | |
| Edit records on an ENS name the user already owns | |
| Embed the records UI inside a custom flow | |
| Mint a subname from a Namespace onchain listing | |
| Create or update gasless subnames through Namespace | |
Routing rules:
- Default to when the user asks for a general quickstart.
EnsNameRegistrationForm - Use only when the user already has an ENS name and wants to edit records.
EnsRecordsForm - Use only for custom or controlled UIs.
SelectRecordsForm - Use for onchain subname listings.
SubnameMintForm - Use for gasless Namespace subnames.
OffchainSubnameForm - If the user wants direct offchain-manager SDK CRUD, filtering, or record queries instead of the UI component, use the skill.
offchain-ens-subname-sdk
| 需求 | 使用组件 |
|---|---|
注册 | |
| 编辑用户已拥有的ENS域名记录 | |
| 在自定义流程中嵌入记录UI | |
| 从Namespace链上列表铸造子域名 | |
| 通过Namespace创建或更新无gas费的链下子域名 | |
路由规则:
- 当用户询问通用快速入门时,默认使用 。
EnsNameRegistrationForm - 仅当用户已拥有ENS域名并想要编辑记录时,才使用 。
EnsRecordsForm - 仅在自定义或受控UI场景下使用 。
SelectRecordsForm - 链上子域名列表场景使用 。
SubnameMintForm - 无gas费的Namespace子域名场景使用 。
OffchainSubnameForm - 如果用户需要的是链下管理器SDK的CRUD、过滤或记录查询功能,而非UI组件,请使用技能。
offchain-ens-subname-sdk
Read Next
后续阅读
- Read for records flows, onchain subnames, offchain subnames, theming, callback-driven customization, exact props, and common issues.
advanced.md
- 阅读了解记录流程、链上子域名、链下子域名、主题定制、回调驱动的自定义配置、详细属性及常见问题。
advanced.md
ENS Quickstart
ENS快速入门
Use this as the default first answer unless the user clearly asked for records or subnames.
除非用户明确询问记录或子域名相关内容,否则默认以此作为首次回复。
0. Prerequisites
0. 前置条件
Assume these are already present in the app:
wagmiviem@tanstack/react-query
假设应用中已存在以下依赖:
wagmiviem@tanstack/react-query
1. Install
1. 安装
bash
npm install @thenamespace/ens-componentsImport the stylesheet once at the app root:
tsx
import "@thenamespace/ens-components/styles.css";bash
npm install @thenamespace/ens-components在应用根目录导入样式表一次:
tsx
import "@thenamespace/ens-components/styles.css";2. Render The ENS Form
2. 渲染ENS表单
In the default quickstart, include . Treat it as required for the quickstart because image upload and SIWE signing should use the app's own hostname, not the fallback Namespace domain.
avatarUploadDomaintsx
import { EnsNameRegistrationForm } from "@thenamespace/ens-components";
<EnsNameRegistrationForm
isTestnet={false}
avatarUploadDomain="app.example.com"
onRegistrationSuccess={result => {
console.log(result.total, result.expiryDate);
}}
/>;Rules for :
avatarUploadDomain- Pass the bare hostname only, for example .
app.example.com - Do not include or a trailing slash.
https://
在默认快速入门中,请包含。在快速入门中需将其视为必填项,因为图片上传和SIWE签名应使用应用自身的主机名,而非默认的Namespace域名。
avatarUploadDomaintsx
import { EnsNameRegistrationForm } from "@thenamespace/ens-components";
<EnsNameRegistrationForm
isTestnet={false}
avatarUploadDomain="app.example.com"
onRegistrationSuccess={result => {
console.log(result.total, result.expiryDate);
}}
/>;avatarUploadDomain- 仅传入裸主机名,例如。
app.example.com - 请勿包含或末尾斜杠。
https://
3. Explain What The Component Handles
3. 说明组件处理的流程
Call out that already handles the normal ENS flow:
EnsNameRegistrationForm- commit transaction
- wait period
- register transaction
- success screen
需要指出已处理常规ENS流程:
EnsNameRegistrationForm- 提交交易
- 等待期
- 注册交易
- 成功页面
4. Add Extras Only When Asked
4. 仅在被询问时添加额外配置
Common follow-ups:
- if they want reward attribution
referrer - for Sepolia
isTestnet={true} - custom connect flow through
onConnectWallet - banner copy and styling tweaks
常见后续需求:
- 若需要奖励归因,添加
referrer - 针对Sepolia测试网,设置
isTestnet={true} - 通过实现自定义连接流程
onConnectWallet - 横幅文案和样式调整