Mints
The Mints APIs provide users the entries to mint the NFTs by calling the method in the ERC721 or ERC1155 contract.
Mint Actions
The Mints APIs provide three methods to help users mint NFTs, including the custom minting, minting with a file and minting with metadata.
Mint NFT
The Mint NFT
provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT. Users need to deploy their own contract firstly. If the network is Conflux_test
, set sponsor api
needs to be called beforing minting.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Type | Required | Default |
---|---|---|---|---|---|
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | body | string | random | |
chain | The chain type. The types include | body | string | ||
mint_to_address | The owner of the NFT | body | string | ||
contract_address | The address of the contract | body | string | ||
metadata_uri | The uri of the metadata. It can be created thorugh create metadata uri. | body | string | ||
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | body | integer | 1 |
{
"chain": "conflux_test",
"token_id": "123",
"mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
"contract_address": "cfxtest:aca7psszv5pvak2hesk3e33m5yabkn3d5j2gzsmm5n",
"metadata_uri": "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
"amount": 123
}
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
app_id | The id of the app | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH | integer |
contract_type | The type of the contract. 1-ERC721, 2-ERC1155 | integer |
contract | The address of the contract | string |
error | The error during executing tx | string |
hash | The hash of the transaction | string |
mint_to | The owner of the nft | string |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
token_id | The id of the token | string |
token_uri | The uri of the token | string |
tx_id | The id of the transaction | integer |
mint_type | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint | integer |
{
"id": 8109,
"created_at": "2022-08-24T04:56:09.841Z",
"updated_at": "2022-08-24T04:56:52.986Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
"contract_type": 0,
"tx_id": 8121,
"hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
"status": 1,
"error": "",
"mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
"token_id": "123",
"amount": 1,
"token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
"mint_type": 0
}
curl --request POST \
--url https://api.nftrainbow.cn/v1/mints/ \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chain": "conflux_test",
"token_id": "123",
"mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
"contract_address": "cfxtest:acgat1yux2rk0xmk2s8ceferyprgm0u1hetj0w72yf",
"metadata_uri": "http://dev.nftrainbow/assets/metadata/0/nft/2dfd6b3add9d5154cf4ccef7a040f4c5c3c965ec5845bd11ca297e8550ac63ee.json",
"amount": 1
}'
The token_id is the number like "123", whose type is string
Batch Mint NFTs
The Batch Mint NFTs
API provides users with the entry to call the ERC721 or ERC1155 contract to mint several NFTs once.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Type | Required | Default |
---|---|---|---|---|---|
chain | The chain type. The types include | body | string | ||
contract_address | The address of the contract | body | string | ||
mint_items | The mint tasks | body | The array of the MintItemDto |
The MintItemDto construct is presented in the following.
Name | Meaning | Param Type | Type | Required | Default |
---|---|---|---|---|---|
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | body | string | The radom value between 1 and 10 | |
mint_to_address | The owner of the NFT | body | string | ||
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | body | integer | 1 | |
metadata_uri | The uri of the metadata. This uri can be generated through create metadata | body | string | The base_uri in the deploy contract |
{
"chain": "conflux_test",
"contract_address": "cfxtest:aceng286bm0xnu8s4wdf1xzdchgn0zxxapb1jj597t",
"mint_items": [
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
"token_id":"10",
"amount": 1
},
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
"token_id":"11",
"amount": 1
},
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
"token_id":"12",
"amount": 1
}
]
}
The response is the array of MintTask construct.
The MintTask construct is showed in the following.
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
app_id | The id of the app | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH. | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
contract | The address of the contract | string |
contract_type | The type of the contract. 1-ERC721, 2-ERC1155 | integer |
mint_to | The address of the owner | string |
token_uri | The uri of the token | string |
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | string |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
hash | The hash of the transaction | string |
tx_id | The id of the transaction | integer |
error | The error during executing the transaction | string |
mint_type | The type of minting. 1-easyMinting 2-customMinting 3-BatchcustomMinting | integer |
[
{
"id": 8372,
"created_at": "2022-09-28T07:54:53.602Z",
"updated_at": "2022-09-28T07:54:53.602Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
"contract_type": 1,
"tx_id": 8474,
"hash": "",
"status": 0,
"error": "",
"mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"token_id": "1",
"amount": 1,
"token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
"mint_type": 3
},
{
"id": 8373,
"created_at": "2022-09-28T07:54:53.602Z",
"updated_at": "2022-09-28T07:54:53.602Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
"contract_type": 1,
"tx_id": 8474,
"hash": "",
"status": 0,
"error": "",
"mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"token_id": "22",
"amount": 1,
"token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
"mint_type": 3
},
{
"id": 8374,
"created_at": "2022-09-28T07:54:53.602Z",
"updated_at": "2022-09-28T07:54:53.602Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acbf8taf6zzy99kncvu7d81vyavaz2ay5254ca3j7c",
"contract_type": 1,
"tx_id": 8474,
"hash": "",
"status": 0,
"error": "",
"mint_to": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"token_id": "23",
"amount": 1,
"token_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
"mint_type": 3
}
]
curl --request POST \
--url https://api.nftrainbow.cn/v1/mints/customizable/batch \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chain": "conflux_test",
"contract_address": "cfxtest:aceng286bm0xnu8s4wdf1xzdchgn0zxxapb1jj597t",
"mint_items": [
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/10",
"token_id":"10",
"amount": 1
},
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/11",
"token_id":"11",
"amount": 1
},
{
"mint_to_address": "cfxtest:aam1eawbm9pzp0dnwv96tts5shnbdfv9nuwu7zgzz8",
"metadata_uri": "https://live---metadata-5covpqijaa-uc.a.run.app/metadata/12",
"token_id":"12",
"amount": 1
}
]
}'
Mint NFT with file
The Mint NFT with file
API provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT with uploading files. The uploaded files can be images, video and so on.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Type | Required |
---|---|---|---|---|
name | The name of the NFT | body | string | |
chain | The chain type. The types include | body | string | |
mint_to_address | The owner of the NFT | body | string | |
description | The description of the NFT | body | string | |
file | The uploaded file | formData |
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
app_id | The id of the app | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH | integer |
contract_type | The type of the contract. 1-ERC721, 2-ERC1155 | integer |
contract | The address of the contract. | string |
error | The error during executing tx | string |
hash | The hash of the transaction | string |
mint_to | The owner of the nft | string |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | string |
token_uri | The uri of the token | string |
tx_id | The id of the transaction | integer |
mint_type | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint | integer |
{
"id": 8109,
"created_at": "2022-08-24T04:56:09.841Z",
"updated_at": "2022-08-24T04:56:52.986Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
"contract_type": 0,
"tx_id": 8121,
"hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
"status": 1,
"error": "",
"mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
"token_id": "123",
"amount": 1,
"token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
"mint_type": 0
}
curl --request POST \
--url https://api.nftrainbow.cn/v1/mints/easy/files \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form file= \
--form chain= 'conflux_test' \
--form description= 'throll description' \
--form mint_to_address= 'cfxtest:aatk708nbb7573bkwumsu00h0r1rtkcdz2chwhttzk' \
--form name= 'throll'
Mint NFT with metadata
The Mint NFT with metadata
provides users with the entry to call the ERC721 or ERC1155 contract to mint the NFT with creating metadata by providing a file url.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Type | Required |
---|---|---|---|---|
name | The name of the nft | body | string | |
chain | The chain type. The types include | body | string | |
mint_to_address | The owner of the NFT | body | string | |
description | The description of the NFT | body | string | |
file_url | The url of the file, which can be generated through upload file or upload file to oss | body | string |
{
"chain": "conflux_test",
"name": "123",
"description": "123",
"mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
"file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg"
}
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
app_id | The id of the app | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH | integer |
contract_type | The type of the contract | integer |
contract | The address of the contract | string |
error | The error during executing tx | string |
hash | The hash of the transaction | string |
mint_to | The owner of the nft | string |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | string |
token_uri | The uri of the token | string |
tx_id | The id of the transaction | integer |
mint_type | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint | integer |
{
"id": 8109,
"created_at": "2022-08-24T04:56:09.841Z",
"updated_at": "2022-08-24T04:56:52.986Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
"contract_type": 0,
"tx_id": 8121,
"hash": "0x5e8eafa9cf8fc52f3fb0d0810a86b5ac97ef23c3ba057bfa8a9f889907e65209",
"status": 1,
"error": "",
"mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
"token_id": "123",
"amount": 1,
"token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
"mint_type": 0
}
curl --request POST \
--url https://api.nftrainbow.cn/v1/mints/easy/urls \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chain": "conflux_test",
"name": "123",
"description": "123",
"mint_to_address": "cfxtest:aasr1hmezez1wepvh8ew8sk9p40khhhj1ymxwmpaf0",
"file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg"
}'
Obtain Informations
Obtain NFT list
The Obtain NFT list
API provides users with the entry to query the NFTs information created on a spcific app.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Data Type | Required | Default |
---|---|---|---|---|---|
page | Page Query | query | integer | 1 | |
limit | Page Query | query | integer | 10 | |
contract | contract address | query | string | ||
mint_to | owner of NFTs | query | string | ||
status | The status of the transaction. 0-pending, 1-success, 2-failed | query | integer | -1 | |
chain | The chain type including | query | string |
Name | Meaning | Type |
---|---|---|
count | The number of the minted NFTs | integer |
items | The nfts information | []MintTask |
The MintTask Struct
is listed as follow:
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
app_id | The id of the app | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH | integer |
contract_type | The type of the contract. 1-ERC721, 2-ERC1155 | integer |
contract | The address of the contract | string |
error | The error during executing tx | string |
hash | The hash of the transaction | string |
mint_to | The owner of the nft | string |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | string |
token_uri | The uri of the token | string |
tx_id | The id of the transaction | integer |
mint_type | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint | integer |
{
"count": 1,
"items": [
{
"id": 8109,
"created_at": "2022-08-24T04:56:09.841Z",
"updated_at": "2022-08-24T04:56:52.986Z",
"deleted_at": null,
"app_id": 2,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
"contract_type": 0,
"tx_id": 8121,
"status": 1,
"error": "",
"mint_to": "cfxtest:aar9up0wsbgtw7f0g5tyc4hbwb2wa5wf7emmk94znd",
"token_id": "",
"amount": 1,
"token_uri": "https://dev.nftrainbow.cn/assets/metadata/0/nft/0b7ba21ca161facbf392e8b275f2d62bbf78eb5302f13564415de85879b7cd7b.json",
"mint_type": 0
}
]
}
curl --request GET \
--url https://api.nftrainbow.cn/v1/mints/ \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json'
Query detailed NFT
The Query detailed NFT
API provides users with the entry to query the detailed NFT information created on a specific app according to the NFT's id.
Name | Meaning | Param Type | Data Type |
---|---|---|---|
Authorization | Bearer Token | Header | string |
Name | Meaning | Param Type | Data Type | Required |
---|---|---|---|---|
id | NFT id | path | integer |
Name | Meaning | Type |
---|---|---|
created_at | The time of creating the item in the database | string |
updated_at | The time of updating the item in the database | string |
deleted_at | The time of deleting the item in the database | string |
id | The id of the item in the database | integer |
amount | The amount of the minted NFTs. For ERC721 contract, this field must be 1. For ERC1155 contract, this field can be greater than 0. | integer |
app_id | The id of the app | integer |
chain_id | The id of the chain. 1029-mainnet, 1-testnet | integer |
chain_type | The type of the chain. 1-CFX, 2-ETH | integer |
contract_type | The type of the contract. 1-ERC721, 2-ERC1155 | integer |
contract | The address of the contract | string |
error | The error during executing tx | string |
hash | The hash of the transaction | string |
mint_to | The owner of the nft | string |
status | The status of the transaction. 0-pending, 1-success, 2-failed | integer |
token_id | The id of the NFT, which will be generated randomly if the field in the request is null. | string |
token_uri | The uri of the token | string |
tx_id | The id of the transaction | integer |
mint_type | The type of the mint. 1-easyMint, 2-customMint, 3-customBatchMint | integer |
{
"id": 22,
"created_at": "2022-08-16T15:14:04.737+08:00",
"updated_at": "2022-08-16T15:14:40.78+08:00",
"deleted_at": null,
"app_id": 4,
"chain_type": 1,
"chain_id": 1,
"contract": "cfxtest:acgraybn1g1upesed09g96vxev79sdhmxjmz7bxzyy",
"contract_type": 0,
"tx_id": 14,
"hash": "0xb060076e19fc4c69fb5399faa2f8c63c0bb3179f54f069b164b84b7c312fef62",
"status": 1,
"error": "",
"mint_to": "cfxtest:aajb342mw5kzad6pjjkdz0wxx0tr54nfwpbu6yaj49",
"token_id": "14448",
"amount": 1,
"token_uri": "http://localhost:8080/assets/metadata/0/nft/2a4dc76844247c2ae927a1a67877e76b4f02f627a5b84667549fbad3d6f57250.json",
"mint_type": 0
}
curl --request GET \
--url https://api.nftrainbow.cn/v1/mints/{id} \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json'
Last updated