4

我正在将nft资产上传到 Solana 网络并收到此错误。

TypeError: Cannot read properties of undefined (reading 'map')

尽管我参考了许多教程,但我不确定要调整什么。以下是metaplex上传脚本中的代码片段:

if (i === 0 && !cacheContent.program.uuid) {
        // initialize config
        log.info(`initializing config`);
        try {
          const res = await createConfig(anchorProgram, walletKeyPair, {
            maxNumberOfLines: new BN(totalNFTs),
            symbol: manifest.symbol,
            sellerFeeBasisPoints: manifest.seller_fee_basis_points,
            isMutable: mutable,
            maxSupply: new BN(0),
            retainAuthority: retainAuthority,
            creators: manifest.properties.creators.map(creator => {
              return {
                address: new PublicKey(creator.address),
                verified: true,
                share: creator.share,
              };
            }),
          });
          cacheContent.program.uuid = res.uuid;
          cacheContent.program.config = res.config.toBase58();
          config = res.config;

          log.info(
            `initialized config for a candy machine with publickey: ${res.config.toBase58()}`,
          );

          saveCache(cacheName, env, cacheContent);
        } catch (exx) {
          log.error('Error deploying config to Solana network.', exx);
          throw exx;
        }
      }

我正在使用以下命令通过 CLI 上传资产:

ts-node ~/metaplex-master/js/packages/cli/src/candy-machine-cli.ts upload /nft-assets --env devnet --keypair ~/.config/solana/devnet.json
4

3 回答 3

2

再次检查*.json文件assets夹中的文件。确保创建者属性遵循正确的结构,如https://docs.metaplex.com/nft-standard#json-structure

{
...
    "creators": [
      {
        "address": "SOLFLR15asd9d21325bsadythp547912501b",
        "share": 100
      }
    ]
}

虽然它不是一个普通的公钥数组

于 2021-11-26T03:54:21.173 回答
1

这个问题缺少回溯,这使得很难判断问题到底出在哪里。

就我而言,我错过properties.creators了元数据中的 。要修复它,请验证您是否缺少所需条目之一。

于 2021-11-14T20:48:06.440 回答
0

就我而言,我在图像元数据文件中缺少 ¸"seller_fee_basis_points" 属性。(0.json,1.json,2.json .....)。将它添加到所有元数据文件中解决了我的问题。

(我正在使用糖果机 v2)

确保在准备资产和配置之前检查此文档: https ://docs.metaplex.com/candy-machine-v2/preparing-assets

- -编辑

检查此配置元数据规则和标准!https://docs.metaplex.com/nft-standard 有一些必需的属性,确保你有!

对我来说,添加“seller_fee_basis_points”和“symbol”属性解决了我的问题!

{
  "name": "1",
->"symbol": "",
  "image": "0.png",
  "properties": {
    "files": [{ "uri": "0.png", "type": "image/png" }],
    "category": "image",
    "creators": [...]
  },
  "description": "",
->"seller_fee_basis_points": 500,
  "attributes": [...],
  "collection": {}
}
于 2022-01-10T05:18:22.350 回答