Upload JSON Uri Data To IPFS

Request

In order to create token uri for NFT or registry uri for data registry, SDK provides you with a uploadJSONUriInfo endpoint to do so

try {
  const apiProtocol = nft2Client.getAPIService();
 
  const uriList = await apiProtocol.uploadJSONUriInfo({
    items: [
      {
        name: "NFT 1 name",
        description: "NFT 1 desc",
        image: "ipfs://XXX",
        attributes: [
          { trait_type: "Level", value: 8 },
          { trait_type: "Type", value: "Monster" }
        ]
      },
      ...
    ]
  });
 
  console.log(uriList)
} catch (e) {
  console.error(e);
}

Parameters

  • Params type: JsonUriMetadata

  • items (Array): Array of Json metadata.

(!) To ensure IPFS service performance and avoid rate limit, size of array items must be <= 100.

Response

[
  { tokenUri: "https://clouflare-ipfs.com/ipfs/XXX" },
  { tokenUri: "https://clouflare-ipfs.com/ipfs/YYY" },
  ...
]
 // with `XXX` and `YYY` is CID of URI data file store on IPFS

Last updated