πŸ–ΌοΈ ERC-721

Deploy and mint ERC-721 tokens

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:

FieldDescriptionTypeOptional
idA unique identifier for identifying the ERC-721 contract within Co:Create.stringNo
contract addressA unique identifier for identifying the ERC-721 contract within the Polygon blockchain ecosystem. Generated by Co:Create platform and returned upon successful contract deployment.stringNo
nameThe token name of the contract.stringNo
symbolThe token symbol of the contract.stringNo
base_uriThe base uri of the contract. This should have a trailing slash. The URL for each token is base_uri + token_id.stringNo
royalty_basis_pointsThe royalty basis points for the contract. This is the percentage of the sale price that the creator will receive. Example: 1000 basis points correspond to a 10% royalty.numberYes
royalty_address_recipientThe wallet address that will receive the royalty payments.stringYes
max limitThe maximum number of tokens that can be minted.numberYes
transfer_restrictedIf true, the tokens are transfer restricted. If false, the tokens are transferable. Default is false.booleanYes
transfer_allowlistThe list of wallet addresses that are allowed to transfer the tokens. This is only used if transfer_restricted is true. Default is an empty list.[string]Yes

Methods

The CoCreate API provides the following methods for creating & managing ERC-721 tokens:

NameMethodDescription
Deploy New ERC721 ContractPOSTDeploy New ERC-721 Contract with the given name, symbol and token parameters.
List ERC721 ContractsGETGet a list of all ERC-721 contracts for an organization.
Patch ERC721 ContractPATCHPatch New ERC-721 Contract - update transfer restrictions and base_uri.
Mint ERC721 TokenPOSTMint a new ERC-721 token to a specified wallet address.
Transfer ERC721 TokenPOSTTransfer 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 ERC-721 tokens to users

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

The body parameters for wallet_addresses, and mint_quantities are specified as arrays. To mint tokens to a single user, specify the arrays as an array of 1.

πŸ“˜

Token IDs Increment by 1

When minting an ERC-721 token, you only need to specify the amount of tokens to mint to a user. The Co:Create Platform will automatically determine the next token id to mint.

Example request:

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/erc721/mint \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "wallet_addresses": [
    "0xaaa5623dc643ae463e4bf65dd267bf668750152b",
    "0xbb6fdb5252825ef15207e7973b94598e7c221e35",
    "0xd6e3b62b8b78f7bab557017de19b3eb1a5e55aab"
  ],
  "erc721_id": "5e552b2b-fdaa-4dd8-8b61-b3343f05f2ee",
  "mint_quantity": [
    1,
    2,
    1
  ]
}
'

Example response:

{
  "data": {
    "erc721_id": "5e552b2b-fdaa-4dd8-8b61-b3343f05f2ee",
    "contract_address": "0x6711f13e76d3a19ac902baeea077ae451b5b76e9",
    "token_ids": {
      "0xaaa5623dc643ae463e4bf65dd267bf668750152b": [
        7
      ],
      "0xbb6fdb5252825ef15207e7973b94598e7c221e35": [
        8,
        9
      ],
      "0xd6e3b62b8b78f7bab557017de19b3eb1a5e55aab": [
        10
      ]
    }
  }
}

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"
	}'

πŸ‘

Get Help

If you get stuck at any time, reach out to us on Discord or contact us via email at [email protected].