🎁 ERC-721 Guide

Overview

The CoCreate API provides functionality for ERC-721 contract deployment & management, including creating new ERC-721 contracts, updating information about the token (eg: metadata URL), and listing your token contracts.

ERC-721 Model

The CoCreate API uses a ERC-721 model that includes the following attributes:

  • id: A unique identifier for the ERC-721 contract within Co:Create.
  • name: The name of the ERC-721 contract.
  • symbol: The symbol of the ERC-721 contract.
  • contract_address: The contract address of the ERC-721 contract on the Polygon Blockchain.
  • media_url: The media/metadata URL of the ERC-721 contract.

Methods

The CoCreate API provides the following methods for managing ERC-721 contracts:

  • Create NFTs: Create and deploy a new contract
  • List NFTs: Get a list of all ERC-721 contracts for an organization.
  • Mint NFTs: Mint a new ERC-721 token to a specified wallet address.
  • Transfer NFT: Transfer an ERC-721 token from one wallet address to another.

Guide

Create a new ERC-721 contract

To create a ERC-721 contract, make a POST request to ERC721 API.

Example request:

curl --request POST \
  --url https://api.testcocrt.xyz/alpha/erc721 \
  --header 'Authorization: Bearer <YOUR_KEY_HERE>' \
  --data '{ 
     "name": "My NFT", 
     "symbol": "CLTB", 
     "base_uri": "https://example.com/media_url/"
  }'

Example response:

{
  "data": {
    "contract_address": "0x30391925aB782008FEBE2fbf05Ea043ec966831c",
    "created_at": "2023-02-23T06:57:11.352161+00:00",
    "id": "b49da6ec-d7bb-43f3-919c-3fce33b5de22",
    "name": "My NFT",
    "org_id": "my_org_id",
    "symbol": "CLTB"
  }
}

Mint a new ERC-721 token to a user

To mint an ERC-721 token, make a POST request to ERC721 Mint API.

curl --request POST \
  --url https://api.testcocrt.xyz/alpha/erc721/mint \
  --header 'Authorization: Bearer <YOUR_KEY_HERE>' \
  --data '{
     "erc721_id":"f19e6691-3013-4bd1-8803-1a596f3a2af1",
         "mint_quantity":1,
     "wallet_address":
     "0x30391925aB782008FEBE2fbf05Ea043ec966831c"
   }'

Example response:

{
  "data": {
    "token_ids": [
      3
    ],
    "wallet_address": "0x189407D5c7E31E26fd31a4EB1ed500626f670675",
    "erc721_id": "f19e6691-3013-4bd1-8803-1a596f3a2af1"
  }
}

Transfer ERC-721 token

To transfer an ERC-721 token to another wallet, make a POST request to ERC721 Transfer API.

curl --request POST \
  --url https://api.testcocrt.xyz/alpha/erc721/transfer \
  --header 'Authorization: Bearer <YOUR_KEY_HERE>' \
  --data '{
         "erc721_contract_address":"0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270",
     "token_id":1,
     "transfer_to_wallet_address":"0xacd2b0f5f0f6f4c6a4b68f8a5d98f2b497010c5e",
     "user_email":"0x30391925aB782008FEBE2fbf05Ea043ec966831c"
    }'

Any question?
Feel free to join us on Discord or by emailing [email protected], to get access.