manifold-nft-minting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manifold NFT Minting Skill

Manifold NFT铸造技能

Build custom NFT minting experiences using
@manifoldxyz/client-sdk
.
使用
@manifoldxyz/client-sdk
构建自定义NFT铸造体验。

References

参考文档

Load lazily — only when the current step needs them. Never load all at once.
ReferenceWhen to Load
getting-started.md
First SDK setup in any project
product-types.md
Working with Edition vs BlindMint products
purchase-flow.md
Implementing preparePurchase → purchase
transaction-steps.md
Multi-step transactions, ERC-20 approvals
adapters.md
Setting up wallet + provider adapters (ethers5/viem/wagmi)
product-data.md
Querying status, allocations, inventory, rules
error-handling.md
Error codes, pitfalls — always load before writing purchase code
networks.md
Multi-chain setup or non-mainnet deployments
react-minting-app.md
Building a React/Next.js minting page
rainbowkit-setup.md
RainbowKit installation, wagmi config, ConnectButton, providers
rpc-setup-guide.md
Setting up an RPC provider (Alchemy/Infura/QuickNode)
minting-bot.md
Building a headless minting bot
studio-setup-guide.md
User needs to create a Manifold campaign first
full-docs.md
Fallback only — 128KB complete SDK docs with TOC for grep
按需懒加载——仅在当前步骤需要时加载。绝对不要一次性加载全部内容。
参考文档加载时机
getting-started.md
任意项目中首次进行SDK设置时
product-types.md
处理Edition和BlindMint产品相关开发时
purchase-flow.md
实现preparePurchase → purchase流程时
transaction-steps.md
处理多步交易、ERC-20授权时
adapters.md
配置钱包+provider适配器(ethers5/viem/wagmi)时
product-data.md
查询状态、分配额度、库存、规则时
error-handling.md
处理错误码、常见坑——编写购买代码前必须加载
networks.md
多链配置或非主网部署时
react-minting-app.md
构建React/Next.js铸造页面时
rainbowkit-setup.md
安装RainbowKit、配置wagmi、ConnectButton、providers时
rpc-setup-guide.md
配置RPC提供商(Alchemy/Infura/QuickNode)时
minting-bot.md
构建无头铸造机器人时
studio-setup-guide.md
用户需要先创建Manifold活动时
full-docs.md
仅作为备用方案——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
    references/studio-setup-guide.md
    . Guide them through product type selection and Studio setup. Return when they have an instance ID.
  • Yes → Continue.
询问:"你是否已经部署了带实例ID的Manifold产品/活动?"
  • → 读取
    references/studio-setup-guide.md
    ,指导用户完成产品类型选择和Studio设置,待用户获取实例ID后再继续后续流程。
  • → 继续下一步。

Step 2: Determine project context

步骤2:确定项目上下文

Ask: "Do you have an existing project to add minting to, or building from scratch?"
Existing project:
  1. Ask their framework
  2. 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
      +
      references/adapters.md
      . Match adapter setup to their stack — integrate, don't scaffold.
    • No wallet connection yet → Proceed to Step 2a
  3. Proceed to Step 2b (RPC setup)
From scratch:
  1. Ask what they're building:
    • Web minting page → Proceed to Step 2a (Wallet Connection), then Step 2b (RPC Setup)
    • Server-side bot → Read
      references/minting-bot.md
      . Proceed to Step 2b (RPC Setup)
    • Data query script → Read
      references/getting-started.md
      only. Proceed to Step 2b (RPC Setup)
询问:"你是要在现有项目中添加铸造功能,还是从零开始构建新项目?"
现有项目:
  1. 询问用户使用的开发框架
  2. 询问用户是否已经配置了钱包连接库(例如RainbowKit、Web3Modal、ConnectKit、自定义实现等)
    • 是,已配置 → 询问具体使用的库,读取
      references/getting-started.md
      +
      references/adapters.md
      ,适配用户现有技术栈完成集成,不要重新生成项目脚手架。
    • 未配置钱包连接 → 进入步骤2a
  3. 进入步骤2b(RPC配置)
从零开始:
  1. 询问用户要构建的项目类型:
    • Web端铸造页面 → 进入步骤2a(钱包连接配置),之后进入步骤2b(RPC配置)
    • 服务端机器人 → 读取
      references/minting-bot.md
      ,之后进入步骤2b(RPC配置)
    • 数据查询脚本 → 仅读取
      references/getting-started.md
      ,之后进入步骤2b(RPC配置)

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):
  1. Read
    references/rainbowkit-setup.md
    +
    references/react-minting-app.md
    +
    references/getting-started.md
    +
    references/networks.md
    +
    references/adapters.md
  2. Follow RainbowKit's setup patterns for wagmi config, providers, and
    <ConnectButton />
Other library (no):
  1. Ask: "Which wallet connection library would you like to use?" (e.g., Web3Modal, ConnectKit, Dynamic, Privy, custom)
  2. Ask the user to describe their library's provider/config pattern, then adapt the SDK integration accordingly.
  3. Read
    references/getting-started.md
    +
    references/networks.md
    +
    references/adapters.md
  4. Adapt the SDK integration to work with their chosen wallet library instead of RainbowKit
询问:"你是否希望使用RainbowKit实现钱包连接?它是React/Next.js铸造应用最常用的方案。"
选择RainbowKit:
  1. 读取
    references/rainbowkit-setup.md
    +
    references/react-minting-app.md
    +
    references/getting-started.md
    +
    references/networks.md
    +
    references/adapters.md
  2. 遵循RainbowKit的配置模式完成wagmi配置、providers设置和
    <ConnectButton />
    组件引入
选择其他库:
  1. 询问:"你希望使用哪个钱包连接库?"(例如Web3Modal、ConnectKit、Dynamic、Privy、自定义实现等)
  2. 要求用户描述对应库的provider/config配置模式,再适配完成SDK集成
  3. 读取
    references/getting-started.md
    +
    references/networks.md
    +
    references/adapters.md
  4. 适配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
.env
file and reference via
process.env.*
in configuration. Ensure
.gitignore
includes
.env
. Proceed to Step 3.
No, but willing to set one up → Read
references/rpc-setup-guide.md
and guide them through creating an Alchemy account and getting an RPC endpoint. Proceed to Step 3.
No, skip (use public RPC) → Use viem's built-in public transport. In code, use
http()
with no URL argument:
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存储在
.env
文件中,在配置中通过
process.env.*
引用,确保
.gitignore
文件包含
.env
规则,进入步骤3。
否,但愿意自行配置 → 读取
references/rpc-setup-guide.md
,指导用户创建Alchemy账号并获取RPC端点,进入步骤3。
否,跳过(使用公共RPC) → 使用viem内置的公共传输层,代码中使用不带URL参数的
http()
typescript
import { http } from 'viem';
// 公共RPC —— 无需提供URL
transport: http()
注意: 公共RPC存在请求频率限制,速度可能较慢,建议生产环境升级为专用RPC服务。
进入步骤3。

Step 3: Implement product interaction

步骤3:实现产品交互逻辑

  1. Read
    references/product-types.md
    — use type guards (
    isEditionProduct
    ,
    isBlindMintProduct
    )
  2. Read
    references/product-data.md
    — status, allocations, metadata display
  3. Read
    references/purchase-flow.md
    — two-step prepare → purchase
  4. If ERC-20 pricing → also read
    references/transaction-steps.md
  1. 读取
    references/product-types.md
    —— 使用类型守卫(
    isEditionProduct
    isBlindMintProduct
  2. 读取
    references/product-data.md
    —— 实现状态、分配额度、元数据展示功能
  3. 读取
    references/purchase-flow.md
    —— 实现两步式prepare → purchase流程
  4. 如果使用ERC-20定价 → 额外读取
    references/transaction-steps.md

Step 4: Error handling

步骤4:错误处理

Always before finalizing:
  1. Read
    references/error-handling.md
    — ClientSDKError handling + common pitfalls
  2. If multi-chain → read
    references/networks.md
最终交付代码前必须执行:
  1. 读取
    references/error-handling.md
    —— 处理ClientSDKError + 规避常见陷阱
  2. 如果支持多链 → 读取
    references/networks.md

Rules

规则

  • When using RainbowKit, ALWAYS install
    wagmi@^2.9.0
    — NEVER run
    npm install wagmi
    without the version pin.
    The correct command is
    npm install wagmi@^2.9.0
    (or
    yarn add wagmi@^2.9.0
    /
    pnpm add wagmi@^2.9.0
    ). Running
    npm install wagmi
    or
    npm install wagmi@latest
    will install wagmi 3.x, which is incompatible with RainbowKit and will cause build/runtime errors. This is the #1 mistake agents make — always include the
    @^2.9.0
    version specifier.
  • Always use environment variables for RPC URLs and private keys — generate
    .env
    files for secrets and ensure
    .gitignore
    includes
    .env
    . Never inline credentials in source code. Reference values via
    process.env.*
    (e.g.,
    process.env.RPC_URL!
    ,
    process.env.WALLET_PRIVATE_KEY!
    ).
  • Always display cost and confirm before executing transactions. Before calling
    purchase()
    or
    step.execute()
    , display the total cost (
    prepared.cost.total.native.formatted
    ), network, and quantity to the user and ask for explicit confirmation.
  • 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
    references/rainbowkit-setup.md
    for RainbowKit, or ask the user to describe their library's config pattern for other libraries.
  • Always use type guards before accessing product-specific methods.
  • Always check
    getStatus()
    before purchases.
  • Use
    preparePurchase
    purchase
    for simple flows. Manual
    step.execute()
    only for granular UI control.
  • 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
    npm install wagmi@latest
    会安装wagmi 3.x版本,该版本与RainbowKit不兼容,会导致构建/运行时错误。这是Agent最常犯的错误——务必加上
    @^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
    purchase
    模式
    ,仅当需要细粒度UI控制时才手动调用
    step.execute()
  • 绝对不要硬编码链ID,请通过配置引入。
  • 绝对不要提交私钥到代码仓库,请使用环境变量存储。
  • 请对照官方文档docs.manifold.xyz/client-sdk验证代码正确性。
  • 超出SDK范围的问题 → 参考Manifold帮助中心官方论坛