You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集成Crossmint至Thirdweb NFT Drop合约:__allowlistProof获取方法问询

解决CrossmintPayButton集成thirdweb NFT Drop合约的_allowlistProof参数问题

针对你在Mumbai测试网的NFT Drop合约(地址0xaE2150AdE811471609f6a556C38e55c2D3D7C712),允许任何人铸造但每个钱包限9个的场景,正确构造_allowlistProof参数的步骤如下:

1. 明确参数本质

你的合约采用公共铸造+钱包数量限制的条件,_allowlistProof不需要真实的白名单Merkle证明,但需要传入与合约当前活跃铸造条件匹配的结构化数据,而非单独的数量限制或全量JSON字符串。

2. 通过thirdweb SDK获取活跃铸造条件

使用thirdweb的useContract和useActiveClaimCondition hooks获取合约的当前铸造规则:

import { useContract, useActiveClaimCondition } from "@thirdweb-dev/react";

// 获取合约实例
const { contract } = useContract("0xaE2150AdE811471609f6a556C38e55c2D3D7C712");
// 获取当前生效的铸造条件
const { data: activeCondition, isLoading } = useActiveClaimCondition(contract);

3. 构造符合Crossmint要求的_allowlistProof

基于获取到的活跃条件,构造包含必填字段的对象:

const allowlistProof = activeCondition ? {
  proof: [], // 公共铸造场景下,proof为空数组
  quantityLimitPerWallet: activeCondition.maxClaimablePerWallet.toString(), // 合约设置的单钱包限铸量(此处为9)
  price: activeCondition.price.toString(), // 铸造单价(免费则为"0")
  currencyAddress: activeCondition.currencyAddress, // 支付代币地址(免费为0x0000000000000000000000000000000000000000)
} : null;

4. 传入CrossmintPayButton组件

确保在条件加载完成后传入参数:

{!isLoading && allowlistProof && (
  <CrossmintPayButton
    projectId="你的Crossmint项目ID"
    contractAddress="0xaE2150AdE811471609f6a556C38e55c2D3D7C712"
    chain="mumbai"
    mintConfig={{
      type: "erc721",
      total: 1, // 用户单次铸造的数量(需≤quantityLimitPerWallet)
      _allowlistProof: allowlistProof,
    }}
  />
)}

常见错误说明

  • 仅传入{"quantityLimitPerWallet": "1"}会因缺少proof、price等必填字段报错
  • 直接JSON.stringify整个activeCondition结果不符合Crossmint的参数结构要求,需提取指定字段构造对象

内容的提问来源于stack exchange,提问作者ken.ng

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 00:52:35