🔃Evolve NFTs

Generate multiple NFTs for an existing SmartContract.

Endpoint

POST /v1/nft/generate-nft/:smartContractId?evolveNFT=true

Authentication

API key is required in the headers.

Path Parameters

Parameter
Type
Description

smartContractId

string

The unique identifier of the SmartContract.

Request Body

The request body should be an array of objects, each containing the following parameters: Note that at least one of those fields userWallet or email should be present in the request.

Parameter
Type
Description
Required

metadata

object[]

An array of NFT metadata objects containing image, name, description, and attributes.

NFT Metadata Object:

Parameter
Type
Description
Required

image

string

The image URL for the NFT.

name

string

The name of the NFT.

idToEnvolve

string

Id (0,1,2...) Of NFT

description

string

The description of the NFT.

attributes

object[]

An array of attribute objects containing key-value pairs describing the NFT.

Attribute Object:

Parameter
Type
Description

key

string

The key or name of the attribute.

value

string

The value or description of the attribute.

Example

RAW

POST /v1/nft/generate-nft/12345?evolveNFT=true

Headers:
API_KEY: YOUR_API_KEY
Content-Type: application/json

Body:
[
  {
    "metadata": [
      {
        "image": "<SOME_IMAGE URL>", // imageName (if use upload-image)
        "name": "First NFT evolved",
        "description": "This is the first NFT evolved",
        "idToEvolve" : 0,
        "attributes": [
          {
            "key": "Characteristic evolved",
            "value": "Characteristic Value evolved"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      },
      {
        "image": "<SOME_IMAGE URL>",
        "name": "Second NFT evolved",
        "idToEvolve" : 1,
        "description": "This is the second NFT evolved",
        "attributes": [
          {
            "key": "Characteristic evolved ",
            "value": "Characteristic Value 1"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      }
    ]
  }
]

Response

  • result: Response data

    • totalToMint: Total NFTs to mint at this moment

    • addresses: NFT sending address

    • amounts: Number of NFTs to mint for each address

    • uris: IPFS urls for each NFT

    • ids: ids NFT in Backend

    • smartContractAddress: Smart Contract Address

    • blockchain: Blockchain

    • blockchainId: Decimal chain id

  • error: Error data if request fail

Status: 200 OK
{
    "result": {
        "totalToMint": 6,
        "addresses": [
            "0x11112222333344445555666677778888",
            "0x88887777666655554444333322221111"
        ],
        "amounts": [
            1,
            1
        ],
        "uris": [
            "XXXX",
            "YYYY",
        ],
        "ids": [
            0,
            1,
        ],
        "_ids": [
            "660e02406878e6ef809b9667",
            "660e02406878e6ef809b9668"
        ],
        "smartContractAddress": "Ox...",
        "smartContractId": "<smartContract_id>",
        "typeBlockchain": 4,
        "blockchainId": "80001",
        "nftsCreated": [
            {
                "smartContractId": "660d6e384c23124d6a0653ad",
                "ipfsUrl": "QmVmSzvth73L4xeYS7CZXSusWyeUTRsPPHxDLioY9pm3JF",
                "path": "6dcc04e9-61a0-4e04-8e0a-b579c8e7462b.png",
                "json": "6fb00a0c04a05ed646438a38ef7c83c1.json",
                "idNFT": 0,
                "name": "NFT Evolved",
                "description": "Tests",
                "ipfsImage": "ipfs://QmU5YHNmQn3dNsrGXKMfCBWpNbY63dJUvk9RWu3XNkMtmd",
                "wallet": "020361b86e8e6cbd50a9d2589b9d8de43565f32bfa4439ef41cd78a9054caed63979",
                "contentType": "image/png",
                "status": 0,
                "type": 1,
                "isEvolution": true,
                "attributes": [
                    {
                        "key": "Version",
                        "value": "2.0"
                    },
                    {
                        "key": "Test",
                        "value": "1"
                    }
                ],
                "includeMint": true,
                "paid": false,
                "_id": "660e02406878e6ef809b9667",
                "__v": 0,
                "createdAt": "2024-04-04T01:28:32.486Z",
                "updatedAt": "2024-04-04T01:28:32.486Z"
            },
            {
                "smartContractId": "660d6e384c23124d6a0653ad",
                "ipfsUrl": "QmVmSzvth73L4xeYS7CZXSusWyeUTRsPPHxDLioY9pm3JF",
                "path": "6dcc04e9-61a0-4e04-8e0a-b579c8e7462b.png",
                "json": "6fb00a0c04a05ed646438a38ef7c83c1.json",
                "idNFT": 1,
                "name": "NFT Evolved 2",
                "description": "Tests 2",
                "ipfsImage": "ipfs://QmU5YHNmQn3dNsrGXKMfCBWpNbY63dJUvk9RWu3XNkMtmd",
                "wallet": "020361b86e8e6cbd50a9d2589b9d8de43565f32bfa4439ef41cd78a9054caed63979",
                "contentType": "image/png",
                "status": 0,
                "type": 1,
                "isEvolution": true,
                "attributes": [
                    {
                        "key": "Version",
                        "value": "2.0"
                    },
                    {
                        "key": "Test",
                        "value": "2"
                    }
                ],
                "includeMint": true,
                "paid": false,
                "_id": "660e02406878e6ef809b9667",
                "__v": 0,
                "createdAt": "2024-04-04T01:28:32.486Z",
                "updatedAt": "2024-04-04T01:28:32.486Z"
            }
        ]
    },
    "error": null
}

CURL

curl --location --request POST 'https://api-testnet.minteando.me/v1/nft/generate-nft/62e6cb8cece6b853fb6db8b4' \
--header 'API_KEY: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '[
  {
    "metadata": [
      {
        "image": "<SOME_IMAGE URL>", // imageName (if use upload-image)
        "name": "First NFT evolved",
        "description": "This is the first NFT evolved",
        "idToEvolve" : 0,
        "attributes": [
          {
            "key": "Characteristic evolved",
            "value": "Characteristic Value evolved"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      },
      {
        "image": "<SOME_IMAGE URL>",
        "name": "Second NFT evolved",
        "idToEvolve" : 1,
        "description": "This is the second NFT evolved",
        "attributes": [
          {
            "key": "Characteristic evolved ",
            "value": "Characteristic Value 1"
          },
          {
            "key": "Characteristic 2",
            "value": "Characteristic Value 2"
          }
        ]
      }
    ]
  }
]'

Example Typescript (axios)

import axios, { AxiosResponse } from 'axios';

interface Attribute {
  key: string;
  value: string;
}

interface NFTMetadata {
  image?: string;
  name: string;
  description: string;
  attributes?: Attribute[];
}

interface NFTGenerationRequest {
  userWallet?: string;
  email?: string;
  metadata: NFTMetadata[];
}

interface GeneratedNFT {
  tokenId: string;
  userWallet: string;
}

const API_KEY = 'YOUR_API_KEY';
const smartContractId = '12345';
const endpoint = `https://api-testnet.minteando.me/v1/nft/generate-nft/${smartContractId}`;

// Set request headers
const headers = {
  API_KEY,
  'Content-Type': 'application/json',
};

// Request body
const requestBody: NFTGenerationRequest[] = [
  {
    metadata: [
      {
        image: '<SOME_IMAGE>',
        name: 'First NFT evolved',
        idToEvolve : 1,
        description: 'This is the first NFT evolved',
        attributes: [
          { key: 'Characteristic 1', value: 'Characteristic Value 1' },
          { key: 'Characteristic 2', value: 'Characteristic Value 2' },
        ],
      },
      {
        image: '<SOME_IMAGE>',
        name: 'Second NFT evolved',
        description: 'This is the second NFT evolved',
        idToEvolve : 1,
        attributes: [
          { key: 'Characteristic 1', value: 'Characteristic Value 1' },
          { key: 'Characteristic 2', value: 'Characteristic Value 2' },
        ],
      },
    ],
  },
];

// Make the request
axios
  .post(endpoint, requestBody, { headers })
  .then((response: AxiosResponse) => {
    const responseData = response.data;
    // Process the response data
    console.log(responseData);
  })
  .catch((error) => {
    console.error('Error:', error.message);
  });

Example PHP

<?php

$apiKey = 'YOUR_API_KEY';
$smartContractId = '12345';
$endpoint = "https://api-testnet.minteando.me/v1/nft/generate-nft/{$smartContractId}";

// Request data
$requestData = [
    [
        "userWallet" => "0x11112222333344445555666677778888",
        "metadata" => [
            [
                "image" => "<SOME_IMAGE>",
                "name" => "First NFT",
                "description" => "This is the first NFT",
                "attributes" => [
                    [
                        "key" => "Characteristic 1",
                        "value" => "Characteristic Value 1"
                    ],
                    [
                        "key" => "Characteristic 2",
                        "value" => "Characteristic Value 2"
                    ]
                ]
            ]
        ]
    ],
    [
        "userWallet" => "0x88887777666655554444333322221111",
        "metadata" => [
            [
                "image" => "<SOME_IMAGE>",
                "name" => "Second NFT",
                "description" => "This is the second NFT",
                "attributes" => [
                    [
                        "key" => "Characteristic 1",
                        "value" => "Characteristic Value 1"
                    ],
                    [
                        "key" => "Characteristic 2",
                        "value" => "Characteristic Value 2"
                    ]
                ]
            ]
        ]
    ]
];

// Create request headers
$headers = [
    'API_KEY: ' . $apiKey,
    'Content-Type: application/json'
];

// Initialize cURL
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Process the response
    $responseData = json_decode($response, true);
    // Do something with the response data
    var_dump($responseData);
}

// Close cURL
curl_close($ch);
?>

Last updated