我无法让我铸造的 NFT 显示在我创建的收藏中。我在 ERC1155 合约上运行,所以我无法通过构造函数创建集合。因此,我提到 ChatGPT 使用字段数组“集合”。它似乎完全无法识别,因为其余 NFT 内容显示但不在任何集合(Unspecified Contract)下。请参考下面的代码,了解我在 JSON 中可能遇到的任何错误,或者如果需要在其中创建合同/连接到在 Opensea 中制作的收集合同地址,请参考合同。我特别需要 ERC1155 格式,因为我需要为同一成就 NFT 显示多个数量。感谢您的阅读。
JSON
{
"name": "Early Access 2023 Badge",
"image": "ipfs://bafybeihfqrahtuozvxk4omqcqiqxza5gdnce2joqsevpyfeqhw76q7kjiu",
"description": "Rewarded to all players who participated in the Early Access version released in the first quarter of 2023!",
"attributes": [{
"trait_type": "Rarity",
"value": "Retired"
}],
"designer": "DeviantCare",
"external_url": "https://DeviantCare.com",
"collection": [{
"name": "Artifact: Achievements",
"family": "Achievement Badges",
"description": "All achievements in our game Artifact is listed here. Complete the requirements for any listed NFT and earn one yourself! These are non-tradable and serve specifically as a connection point to other applications whether they be personal vr rooms or other game applications."
}]
}
SOL 合约
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
//Not Tradable
contract ArtifactSBTs is ERC1155URIStorage {
address owner;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC1155("") {
owner = msg.sender;
}
function claimAchievement(string memory tokenURI, address addr) public {
_setURI(10000000, tokenURI);
_mint(addr, 10000000, 2, bytes(tokenURI));
}
}
这是一个重复的问题。原始问题/解决方案可在以下位置找到:How to fix "Unidentified contract"? OpenSea 无法“理解”ERC1155
为了快速回答这篇文章,Opensea 期望在 ERC-1155 合约上有 2 个公开声明的变量“name”和“symbol”。只需设置这些变量即可。