Skip to content


This function allow admin user to add categories to a compatible Bcode contract. The add categories functionality support max 5 new categories per time.

To be able to handle NodeJS file the format will be blob.

The function is fully typed.


nftsArray of Nft objects
contractIdContract identifier can be found on online platform

Attributes field is not mandatory but can have this form

trait_typeShown name of teh attributeYes
typeAttribute type supported by the platformYes
valueAttribute's valueYes
privatePrivatness of the attribute, it will or not end on blockchainNo
linkExtra url for attributeNo
fileObject referring a attribute's fileNo

For type details follow the type declaration.


import { BcodeSDK } from "@bcode-tech/bcode-sdk";

const CONTRACT_ID = "ContractID";

const loadData = () => {
  const nftImage = fs.readFileSync("./nft-image.png");
  const attributeImage = fs.readFileSync("./attribute-image.png");

  const nftImageBlob = new Blob([nftImage], { type: "image/png" });
  const attributeImageBlob = new Blob([nftImage], { type: "image/png" });

  const nfts = [
      name: "Token name",
      description: "Token description",
      isUnlimited: false,
      quantity: 1,
      external_url: "",
      image: {blob, name: "nft-image.png},
      attributes: [
         trait_type: "New attribute",
         type: "image",
         value: "",
         file: {blob, name: "attribute-image.png" },

  return nfts;

const fun = () => {
 const sdk = BcodeSDK.create({
    email: "",
    password: "your-secure-password",
    config: {env: 'DEV', debugMode: true},
    version: "v1",

  await sdk.init()

  const nfts = loadData();

  const requestId =  await sdk.addCategories({
    contractId: CONTRACT_ID,