Extension API
Extension API provides the functions that the standard (ERC-721) APIs do not offer.
Gets the royalty and the address who receives this royalty via the token ID (tokenId) and the NFT sales (salePrice). The royalty can be set upon minting an NFT with the contract implemented ERC-2981/CW-2981 interface.
Request URL
Path parameters
| Field Name | Description | Type | Required |
| contract | the NFT contract address | string | Y |
| tokenId | NFT ID | String | Y |
| Field Name | Description | Type | Required |
| Authorization | Authentication token required to call the API | string | Y |
| x-network | the blockchain networks | string | Y |
Query parameters
| Field Name | Description | Type | Required |
| salePrice | the amount of NFT sale | string | Y |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.receiver | the wallet address that receives the royalty | string |
| data.amount | the royalty amount | string |
Request sample
curl -X 'GET'
'https://sandbox-bc-api.qpyou.cn/core/v1/nft/extension/0xA3F4308Ed655f962dD7CA180545c21718fAE49AD/royalty/1?salePrice=0.5'
-H 'accept: application/json'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb...'
-H 'x-network: polygon'
Response sample
{
"code": 0,
"message": "success",
"data": {
"receiver": "0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0",
"amount": "0.0375"
}
}
Mint NFT
Creates a transaction that mint tokens to a specific address (to). You can call this API loading the required NFT information (mintMsg.tokenId, mintMsg.metadata, etc.) into an array, and this API will upload the NFT information to IPFS (InterPlanetary File System) and mint the NFT. This API extends the features of NFT API, able to mint maximum 200 tokens at the same time and to set royalty. from must be the account that has a right to mint.
Note
- The digital asset and its metadata (
mintMsg.metadata) created via API will be registered at the public IPFS (InterPlanetary File System). - Mint NFT API of Extension API can mint NFTs to multiple accounts at once. If you mint 1 NFT to 1 account each, you can mint NFTs to maximum 200 accounts for XPLA and 50 for Polygon. If you mint NFTs to 50 accounts, you can mint 4 NFTs per account for XPLA and 1 NFT per account for Polygon.
Request URL
Path parameters
| Field Name | Description | Type | Required |
| contract | the NFT contract address | string | Y |
| Field Name | Description | Type | Required |
| Authorization | Authentication token required to call the API | string | Y |
| x-network | the blockchain networks | string | Y |
Request body
| Field Name | Description | Type | Required |
| from | the account address that mints NFTs | string | Y |
| mintMsg | This is the required information for minting. It is in JSON array format, so you can mint NFTs to multiple accounts. | array | Y |
| mintMsg.to | the wallet address that receives NFTs | string | Y |
| mintMsg.tokenId | This is the NFT ID. The NFT ID should be unique, and is defined by the NFT minter. - Polygon: Only strings and integers (0~2256-1) are allowed.
- XPLA: Only strings are allowed.
| string | Y |
| mintMsg.royaltyPercentage | This is the royalty percentage. It is the money given to the creator of an NFT or the claimant every time the NFT is sold or resold. The royalty rate is applied to the total amount of sale. This feature is supported for the NFT marketplaces that are willing to continuously fund artists and NFT creators. The marketplace checks the NFT royalty and pay it to the recipient. The royalty is not directly paid to the recipient when the NFT is sold (transferred). This feature is adopted for the OpenSea.
- Polygon: Allowed to the 2 decimal places.
- XPLA: Only an integer is allowed.
| number | N |
| mintMsg.metadata | the metadata - You need to check type and url (
animationUrl, youtubeUrl, externalUrl) formats. If this data is incorrect, the API request may fail.
- The metadata will be saved in the snake case to be used for OpenSea when it is saved in IPFS (example:
animationUrl → animation_url)
| json | Y |
| mintMsg.metadata.name | the NFT name | string | Y |
| mintMsg.metadata.description | the NFT description | string | N |
| mintMsg.metadata.image | This is the NFT image address. This is the public website address or the public IPFS address for uploading images to IPFS. | string | Y |
| mintMsg.metadata.animationUrl | the address for the NFT animation | string | N |
| mintMsg.metadata.youtubeUrl | the Youtube address | string | N |
| mintMsg.metadata.imageData | the NFT image information | string | N |
| mintMsg.metadata.externalUrl | the external url | string | N |
| mintMsg.metadata.backgroundColor | the background color info of the token (OpenSea) | string | N |
| mintMsg.metadata.attributes | These are the information of the metadata attributes. These contain the additional info that are not described in the metadata. | json | N |
| mintMsg.metadata.attributes.traitType | The names of the items that constitute attributes | string | N |
| mintMsg.metadata.attributes.maxValue | the maximum value of trait | number | N |
| mintMsg.metadata.attributes.value | This is the trait value. It should be less than mintMsg.metadata.attributes.maxValue. If mintMsg.metadata.attributes.displayType is date, set this value following unix timestamp (seconds) format. | string or number | N |
| mintMsg.metadata.attributes.displayType | This is the display type of the trait. The default value is string. - number: numeric type
- boost_percentage: percentage (OpenSea Boosts)
- boost_number: numeric (OpenSea Boosts)
- date: date type (example: Tuesday, January 1st, 2019)
| string | N |
| encoded | whether the returned transaction is encoded or not
-
true: Receive the encoded raw transaction string (data.rawTx).
-
false: Receive the decoded data.rawTx (JSON).
| boolean | N |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.rawTx | the transaction data | string or json |
| data.hashedTx | This is hashed data.rawTx. This value is only returned when the API header x-network is "polygon" and the Request Body from is an multi sig wallet address. | string |
| data.requestId | the unique value that can identify each API request | string |
Request sample
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/nft/extension/0xA3F4308Ed655f962dD7CA180545c21718fAE49AD/mint'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb...'
-H 'accept: application/json'
-H 'x-network: polygon'
-H 'Content-Type: application/json'
-d '{
"from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765",
"mintMsg": [
{
"to": "0xFBd488D1b00604d3b05124d80E35FeA9A39C3296",
"tokenId": "101",
"metadata": {
"name": "Arbiter'''s Robe",
"description": "desc",
"image": "https://image01.c2x.world/equip_92053030.gif",
"animationUrl": "https://image01.c2x.world/equip_92053030.gif",
"externalUrl": "https://dex.c2xnft.com/market?key=4423",
"attributes": [
{
"traitType": "Category",
"value": "Game",
}
]
},
"royaltyPercentage": 12
}
],
"encoded": true
}'
Response sample
{
"code": 0,
"message": "success",
"data": {
"rawTx": "02f8f3830138810b8459682f008459682f1083023...",
"hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...",
"requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1"
}
}
Deploy NFT contract
Creates a transaction that deploys the NFT contract. The deployed contract supports ERC-721/CW-721 standard and the extension features.
- Bulk Minting
- Royalty (ERC-2981/CW-2981)
Request URL
| Field Name | Description | Type | Required |
| Authorization | Authentication token required to call the API | string | Y |
| x-network | the blockchain networks | string | Y |
Request body
| Field Name | Description | Type | Required |
| from | the wallet address that deploys the contract | string | Y |
| name | the NFT contract name | string | Y |
| symbol | the NFT contract symbol | string | Y |
| minter | the wallet address of the account who can mint an NFT at this NFT contract | string | Y |
| encoded | whether the returned transaction is encoded or not
-
true: Receive the encoded raw transaction string (data.rawTx).
false: Receive the decoded data.rawTx (JSON).
| boolean | N |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.rawTx | the transaction data | string or json |
| data.hashedTx | This is hashed data.rawTx. This value is only returned when the API header x-network is "polygon" and the Request Body from is an multi sig wallet address. | string |
| data.requestId | the unique value that can identify each API request | string |
Request sample
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/nft/extension/contract'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb...'
-H 'accept: application/json'
-H 'x-network: polygon'
-H 'Content-Type: application/json'
-d '{
"encoded": true,
"from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765",
"name": "Extension NFT",
"symbol": "ENFT",
"minter": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765"
}'
Response sample
{
"code": 0,
"message": "success",
"data": {
rawTx: "02f8f3830138810b8459682f008459682f108302...",
"hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...",
"requestId": "6fu656d0-t52q-2bdc-ba93-dd063815s7e1"
}
}