manifold-nft-minting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManifold NFT Minting Skill
Manifold NFT铸造技能
Build custom NFT minting experiences using .
@manifoldxyz/client-sdk使用构建自定义NFT铸造体验。
@manifoldxyz/client-sdkReferences
参考文档
Load lazily — only when the current step needs them. Never load all at once.
| Reference | When to Load |
|---|---|
| First SDK setup in any project |
| Working with Edition vs BlindMint products |
| Implementing preparePurchase → purchase |
| Multi-step transactions, ERC-20 approvals |
| Setting up wallet + provider adapters (ethers5/viem/wagmi) |
| Querying status, allocations, inventory, rules |
| Error codes, pitfalls — always load before writing purchase code |
| Multi-chain setup or non-mainnet deployments |
| Building a React/Next.js minting page |
| RainbowKit installation, wagmi config, ConnectButton, providers |
| Setting up an RPC provider (Alchemy/Infura/QuickNode) |
| Building a headless minting bot |
| User needs to create a Manifold campaign first |
| Fallback only — 128KB complete SDK docs with TOC for grep |
按需懒加载——仅在当前步骤需要时加载。绝对不要一次性加载全部内容。
| 参考文档 | 加载时机 |
|---|---|
| 任意项目中首次进行SDK设置时 |
| 处理Edition和BlindMint产品相关开发时 |
| 实现preparePurchase → purchase流程时 |
| 处理多步交易、ERC-20授权时 |
| 配置钱包+provider适配器(ethers5/viem/wagmi)时 |
| 查询状态、分配额度、库存、规则时 |
| 处理错误码、常见坑——编写购买代码前必须加载 |
| 多链配置或非主网部署时 |
| 构建React/Next.js铸造页面时 |
| 安装RainbowKit、配置wagmi、ConnectButton、providers时 |
| 配置RPC提供商(Alchemy/Infura/QuickNode)时 |
| 构建无头铸造机器人时 |
| 用户需要先创建Manifold活动时 |
| 仅作为备用方案——128KB完整SDK文档,带目录可用于grep搜索 |
Workflow
工作流
Follow in order. Ask questions — don't assume.
请按顺序执行,有疑问及时询问,不要自行假设。
Step 1: Check if they have a Manifold campaign
步骤1:确认用户是否已有Manifold活动
Ask: "Do you already have a Manifold product/campaign deployed with an instance ID?"
- No → Read . Guide them through product type selection and Studio setup. Return when they have an instance ID.
references/studio-setup-guide.md - Yes → Continue.
询问:"你是否已经部署了带实例ID的Manifold产品/活动?"
- 否 → 读取,指导用户完成产品类型选择和Studio设置,待用户获取实例ID后再继续后续流程。
references/studio-setup-guide.md - 是 → 继续下一步。
Step 2: Determine project context
步骤2:确定项目上下文
Ask: "Do you have an existing project to add minting to, or building from scratch?"
Existing project:
- Ask their framework
- Ask if they already have a wallet connection library set up (e.g., RainbowKit, Web3Modal, ConnectKit, custom)
- Yes, already set up → Ask which library they use. Read +
references/getting-started.md. Match adapter setup to their stack — integrate, don't scaffold.references/adapters.md - No wallet connection yet → Proceed to Step 2a
- Yes, already set up → Ask which library they use. Read
- Proceed to Step 2b (RPC setup)
From scratch:
- Ask what they're building:
- Web minting page → Proceed to Step 2a (Wallet Connection), then Step 2b (RPC Setup)
- Server-side bot → Read . Proceed to Step 2b (RPC Setup)
references/minting-bot.md - Data query script → Read only. Proceed to Step 2b (RPC Setup)
references/getting-started.md
询问:"你是要在现有项目中添加铸造功能,还是从零开始构建新项目?"
现有项目:
- 询问用户使用的开发框架
- 询问用户是否已经配置了钱包连接库(例如RainbowKit、Web3Modal、ConnectKit、自定义实现等)
- 是,已配置 → 询问具体使用的库,读取+
references/getting-started.md,适配用户现有技术栈完成集成,不要重新生成项目脚手架。references/adapters.md - 未配置钱包连接 → 进入步骤2a
- 是,已配置 → 询问具体使用的库,读取
- 进入步骤2b(RPC配置)
从零开始:
- 询问用户要构建的项目类型:
- Web端铸造页面 → 进入步骤2a(钱包连接配置),之后进入步骤2b(RPC配置)
- 服务端机器人 → 读取,之后进入步骤2b(RPC配置)
references/minting-bot.md - 数据查询脚本 → 仅读取,之后进入步骤2b(RPC配置)
references/getting-started.md
Step 2a: Wallet connection (web apps only)
步骤2a:钱包连接(仅Web应用需要)
Ask: "Would you like to use RainbowKit for wallet connection? It's the most common choice for React/Next.js minting apps."
RainbowKit (yes):
- Read +
references/rainbowkit-setup.md+references/react-minting-app.md+references/getting-started.md+references/networks.mdreferences/adapters.md - Follow RainbowKit's setup patterns for wagmi config, providers, and
<ConnectButton />
Other library (no):
- Ask: "Which wallet connection library would you like to use?" (e.g., Web3Modal, ConnectKit, Dynamic, Privy, custom)
- Ask the user to describe their library's provider/config pattern, then adapt the SDK integration accordingly.
- Read +
references/getting-started.md+references/networks.mdreferences/adapters.md - Adapt the SDK integration to work with their chosen wallet library instead of RainbowKit
询问:"你是否希望使用RainbowKit实现钱包连接?它是React/Next.js铸造应用最常用的方案。"
选择RainbowKit:
- 读取+
references/rainbowkit-setup.md+references/react-minting-app.md+references/getting-started.md+references/networks.mdreferences/adapters.md - 遵循RainbowKit的配置模式完成wagmi配置、providers设置和组件引入
<ConnectButton />
选择其他库:
- 询问:"你希望使用哪个钱包连接库?"(例如Web3Modal、ConnectKit、Dynamic、Privy、自定义实现等)
- 要求用户描述对应库的provider/config配置模式,再适配完成SDK集成
- 读取+
references/getting-started.md+references/networks.mdreferences/adapters.md - 适配SDK集成逻辑,使其兼容用户选择的钱包库而非RainbowKit
Step 2b: RPC node setup
步骤2b:RPC节点配置
Ask: "Do you have an RPC node URL you can provide (e.g., from Alchemy, Infura, QuickNode)?"
Yes → Store the RPC URL in a file and reference via in configuration. Ensure includes . Proceed to Step 3.
.envprocess.env.*.gitignore.envNo, but willing to set one up → Read and guide them through creating an Alchemy account and getting an RPC endpoint. Proceed to Step 3.
references/rpc-setup-guide.mdNo, skip (use public RPC) → Use viem's built-in public transport. In code, use with no URL argument:
http()typescript
import { http } from 'viem';
// Public RPC — no URL needed
transport: http()Note: Public RPCs have rate limits and may be slower. Recommend upgrading to a dedicated RPC for production apps.
Proceed to Step 3.
询问:"你是否可以提供RPC节点URL?(例如从Alchemy、Infura、QuickNode获取的地址)"
是 → 将RPC URL存储在文件中,在配置中通过引用,确保文件包含规则,进入步骤3。
.envprocess.env.*.gitignore.env否,但愿意自行配置 → 读取,指导用户创建Alchemy账号并获取RPC端点,进入步骤3。
references/rpc-setup-guide.md否,跳过(使用公共RPC) → 使用viem内置的公共传输层,代码中使用不带URL参数的:
http()typescript
import { http } from 'viem';
// 公共RPC —— 无需提供URL
transport: http()注意: 公共RPC存在请求频率限制,速度可能较慢,建议生产环境升级为专用RPC服务。
进入步骤3。
Step 3: Implement product interaction
步骤3:实现产品交互逻辑
- Read — use type guards (
references/product-types.md,isEditionProduct)isBlindMintProduct - Read — status, allocations, metadata display
references/product-data.md - Read — two-step prepare → purchase
references/purchase-flow.md - If ERC-20 pricing → also read
references/transaction-steps.md
- 读取—— 使用类型守卫(
references/product-types.md、isEditionProduct)isBlindMintProduct - 读取—— 实现状态、分配额度、元数据展示功能
references/product-data.md - 读取—— 实现两步式prepare → purchase流程
references/purchase-flow.md - 如果使用ERC-20定价 → 额外读取
references/transaction-steps.md
Step 4: Error handling
步骤4:错误处理
Always before finalizing:
- Read — ClientSDKError handling + common pitfalls
references/error-handling.md - If multi-chain → read
references/networks.md
最终交付代码前必须执行:
- 读取—— 处理ClientSDKError + 规避常见陷阱
references/error-handling.md - 如果支持多链 → 读取
references/networks.md
Rules
规则
- When using RainbowKit, ALWAYS install — NEVER run
wagmi@^2.9.0without the version pin. The correct command isnpm install wagmi(ornpm install wagmi@^2.9.0/yarn add wagmi@^2.9.0). Runningpnpm add wagmi@^2.9.0ornpm install wagmiwill install wagmi 3.x, which is incompatible with RainbowKit and will cause build/runtime errors. This is the #1 mistake agents make — always include thenpm install wagmi@latestversion specifier.@^2.9.0 - Always use environment variables for RPC URLs and private keys — generate files for secrets and ensure
.envincludes.gitignore. Never inline credentials in source code. Reference values via.env(e.g.,process.env.*,process.env.RPC_URL!).process.env.WALLET_PRIVATE_KEY! - Always display cost and confirm before executing transactions. Before calling or
purchase(), display the total cost (step.execute()), network, and quantity to the user and ask for explicit confirmation.prepared.cost.total.native.formatted - Prefer viem over ethers for new projects. Only use ethers v5 if the user explicitly requests it or has an existing ethers codebase.
- Never fabricate SDK method signatures or field names. Verify against references.
- Always confirm wallet connection choice before scaffolding a web minting app. Never assume RainbowKit.
- Always read wallet library docs before writing integration code — read for RainbowKit, or ask the user to describe their library's config pattern for other libraries.
references/rainbowkit-setup.md - Always use type guards before accessing product-specific methods.
- Always check before purchases.
getStatus() - Use →
preparePurchasefor simple flows. Manualpurchaseonly for granular UI control.step.execute() - Never hardcode chain IDs — use configuration.
- Never commit private keys — use environment variables.
- Verify code against official docs at docs.manifold.xyz/client-sdk.
- For issues beyond SDK scope → Manifold Help or Forum.
- 使用RainbowKit时,必须安装——绝对不要不加版本号直接运行
wagmi@^2.9.0。 正确的命令是npm install wagmi(或npm install wagmi@^2.9.0/yarn add wagmi@^2.9.0)。运行pnpm add wagmi@^2.9.0或npm install wagmi会安装wagmi 3.x版本,该版本与RainbowKit不兼容,会导致构建/运行时错误。这是Agent最常犯的错误——务必加上npm install wagmi@latest版本指定符。@^2.9.0 - RPC URL和私钥必须使用环境变量存储 —— 生成文件存储敏感信息,确保
.env包含.gitignore规则,绝对不要在源码中硬编码凭证,通过.env引用对应值(例如process.env.*、process.env.RPC_URL!)。process.env.WALLET_PRIVATE_KEY! - 执行交易前必须展示费用并获取用户确认。 调用或
purchase()前,向用户展示总费用(step.execute())、所属网络、购买数量,获得用户明确确认后再执行。prepared.cost.total.native.formatted - 新项目优先选择viem而非ethers,仅当用户明确要求或现有项目基于ethers开发时才使用ethers v5。
- 绝对不要虚构SDK方法签名或字段名,请对照参考文档验证。
- 生成Web铸造应用脚手架前必须确认用户选择的钱包连接方案,不要默认使用RainbowKit。
- 编写集成代码前必须阅读钱包库文档 —— RainbowKit参考,其他库要求用户描述其配置模式。
references/rainbowkit-setup.md - 访问产品专属方法前必须使用类型守卫。
- 购买操作前必须调用校验状态。
getStatus() - 简单流程使用→
preparePurchase模式,仅当需要细粒度UI控制时才手动调用purchase。step.execute() - 绝对不要硬编码链ID,请通过配置引入。
- 绝对不要提交私钥到代码仓库,请使用环境变量存储。
- 请对照官方文档docs.manifold.xyz/client-sdk验证代码正确性。
- 超出SDK范围的问题 → 参考Manifold帮助中心或官方论坛。