Extension API
Extension API는 표준(ERC-721) API가 지원하지 않는 기능들을 제공합니다.
NFT 로열티 정보 조회
토큰 ID(tokenId)와 NFT 판매금액(salePrice)을 사용해 로열티를 지급받을 계정 주소와 로열티 금액을 조회합니다. 로열티는 ERC-2981/CW-2981 인터페이스를 구현한 컨트랙트에서 NFT 발행 시 설정할 수 있습니다.
Request URL
Path parameters
| 필드명 | 설명 | 타입 | 필수 여부 |
| contract | NFT 컨트랙트 주소 | string | Y |
| tokenId | NFT ID | string | Y |
| 필드명 | 설명 | 타입 | 필수 여부 |
| x-network | 블록체인 네트워크{ploygon, xpla} | string | Y |
| Authorization | API를 호출하기 위한 인증 토큰 | string | Y |
Query parameters
| 필드명 | 설명 | 타입 | 필수 여부 |
| salePrice | NFT 판매금액 | string | Y |
Responses
| 필드명 | 설명 | 타입 |
| code | api 호출 결과 코드, 0:성공 | number |
| message | 결과 메시지 | string |
| data | API 응답 데이터 | json |
| data.receiver | 로열티를 받을 지갑 주소 | string |
| data.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"
}
}
NFT 발행
특정 주소(to)로 토큰을 발행하는 트랜잭션을 생성합니다. 발행할 NFT 정보(mintMsg.tokenId, mintMsg.metadata 등)를 배열에 담아 호출하며, NFT 정보를 IPFS(InterPlanetary File System)에 업로드한 후 토큰으로 발행합니다. NFT API 기능을 확장한 API로 한 번에 최대 200개 토큰을 발행할 수 있고 로열티를 설정할 수 있습니다. from은 발행 권한을 가진 계정이어야 합니다.
Note
- API로 발행한 디지털 자산과 자산의 메타데이터(
mintMsg.metadata)는 Public IPFS(InterPlanetary File System)에 등록됩니다. - Extension API의 NFT 발행 API는 한 번에 여러 계정에게 NFT를 발행할 수 있습니다. 1개 계정에 1개씩 발행한다면 XPLA는 최대 200 계정, Polygon은 최대 50 계정에게 NFT를 발행할 수 있습니다. 만약 50개 계정에게 NFT를 배포한다면 XPLA는 1개 계정에게 NFT를 4개씩, Polygon은 1개씩 발행할 수 있습니다.
Request URL
Path parameters
| 필드명 | 설명 | 타입 | 필수 여부 |
| contract | NFT 컨트랙트 주소 | string | Y |
| 필드명 | 설명 | 타입 | 필수 여부 |
| x-network | 블록체인 네트워크{ploygon, xpla} | string | Y |
| Authorization | API를 호출하기 위한 인증 토큰 | string | Y |
Request body
| 필드명 | 설명 | 타입 | 필수 여부 |
| from | NFT를 발행하는 계정 주소 | string | Y |
| mintMsg | 발행 시 필요한 정보입니다. JSON 데이터 array 형식이므로 여러 계정에게 발행할 수 있습니다. | array | Y |
| mintMsg.to | NFT를 받을 지갑 주소 | string | Y |
| mintMsg.tokenId | NFT ID입니다. NFT 발행자가 지정하며 중복을 허용하지 않습니다. - Polygon: 문자열, 정수(0~2256-1)만 사용 가능
- XPLA: 문자열만 사용 가능
| string | Y |
| mintMsg.royaltyPercentage | 로열티 비율입니다. NFT가 판매 또는 재판매될 때마다 NFT 작성자 또는 권리를 가진 보유자에게 지불할 금액입니다. 총 판매금액에 로열티로 지불할 비율이 설정됩니다. 아티스트 및 기타 NFT 제작자에게 지속적인 자금을 지원하려는 NFT 마켓 플레이스를 위한 기능입니다. NFT 전송 시 수취인에게 로열티가 자동으로 지불되지 않으며, 마켓 플레이스에서 NFT 로열티를 확인하고 수취인에게 지불합니다. OpenSea에 적용된 기능입니다. - Polygon: 소수점 둘째자리까지 허용합니다.
- XPLA: 소수점을 허용하지 않습니다.
| number | N |
| mintMsg.metadata | 메타데이터 - 메타데이터 입력 시 타입 및 url(
animationUrl, youtubeUrl, externalUrl) 포맷을 확인합니다. 정확하지 않은 데이터 전송 시 API가 정상 작동하지 않습니다. - 메타데이터가 IPFS에 저장될 때는 OpenSea와 연동 가능한 snake case로 저장됩니다(예시:
animationUrl → animation_url)
| json | Y |
| mintMsg.metadata.name | NFT 이름 | string | Y |
| mintMsg.metadata.description | NFT 설명 | string | N |
| mintMsg.metadata.image | NFT 이미지 주소입니다. IPFS에 업로드하기 위한 외부에서 접근 가능한 웹사이트 주소 또는 Public IPFS 주소입니다. | string | Y |
| mintMsg.metadata.animationUrl | NFT 관련 애니메이션 주소 | string | N |
| mintMsg.metadata.youtubeUrl | 유투브 주소 | string | N |
| mintMsg.metadata.imageData | NFT 이미지 정보 | string | N |
| mintMsg.metadata.externalUrl | 외부로 연결되는 주소 | string | N |
| mintMsg.metadata.backgroundColor | OpenSea에서 토큰의 배경색 정보 | string | N |
| mintMsg.metadata.attributes | 메타데이터 속성 정보입니다. 메타데이터에 명시하지 않았던 부가적인 정보입니다. | json | N |
| mintMsg.metadata.attributes.traitType | attributes를 구성하는 항목명입니다. | string | N |
| mintMsg.metadata.attributes.maxValue | trait 최대값 | number | N |
| mintMsg.metadata.attributes.value | trait값입니다. mintMsg.metadata.attributes.maxValue보다 작아야 합니다. mintMsg.metadata.attributes.displayType이 date이면 value에 unix timestamp (seconds)를 입력합니다. | string 또는 number | N |
| mintMsg.metadata.attributes.displayType | trait 노출 유형입니다. 기본값은 string 타입입니다. - number: Number 타입
- boost_percentage: OpenSea Boosts에 % 정보로 노출
- boost_number: OpenSea Boosts에 노출
- date: 날짜 형식으로 노출(예시: Tuesday, January 1st, 2019)
| string | N |
| encoded | 반환받을 트랜잭션의 인코딩 여부 -
true: data.rawTx으로 인코딩된 Raw Transaction String을 받습니다. -
false: data.rawTx으로 인코딩을 디코딩한 JSON 결과값을 받습니다. | boolean | N |
Responses
| 필드명 | 설명 | 타입 |
| code | api 호출 결과 코드, 0:성공 | number |
| message | 결과 메시지 | string |
| data | API 응답 데이터 | json |
| data.rawTx | 트랜잭션 데이터 | string 또는 json |
| data.hashedTx | 해시한 data.rawTx입니다. API 헤더 x-network가 polygon이고 Request Body from이 다중 서명 지갑 주소일 때에만 이 값을 받습니다. | string |
| data.requestId | API 요청을 식별할 수 있는 고유값 | string |
Request sample
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/nft/extension/0xA3F4308Ed655f962dD7CA180545c21718fAE49AD/mint'
-H 'accept: application/json'
-H 'x-network: polygon'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb...'
-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"
}
}
NFT 컨트랙트 배포
NFT 컨트랙트를 배포하는 트랜잭션을 생성합니다. 배포할 컨트랙트는 ERC-721/CW-721 표준을 지원하며 아래 확장 기능들도 지원합니다.
- Bulk Minting
- Royalty (ERC-2981/CW-2981)
Request URL
| 필드명 | 설명 | 타입 | 필수 여부 |
| x-network | 블록체인 네트워크{ploygon, xpla} | string | Y |
| Authorization | API를 호출하기 위한 인증 토큰 | string | Y |
Request body
| 필드명 | 설명 | 타입 | 필수 여부 |
| from | NFT 컨트랙트를 배포하는 계정 지갑 주소 | string | Y |
| name | NFT 컨트랙트 이름 | string | Y |
| symbol | NFT 컨트랙트 심볼 | string | Y |
| minter | NFT 컨트랙트에서 NFT를 발행할 수 있는 계정 지갑 주소 | string | Y |
| encoded | 반환받을 트랜잭션의 인코딩 여부 -
true: data.rawTx으로 인코딩된 Raw Transaction String을 받습니다. -
false: data.rawTx으로 인코딩을 디코딩한 JSON 결과값을 받습니다. | boolean | N |
Responses
| 필드명 | 설명 | 타입 |
| code | api 호출 결과 코드, 0:성공 | number |
| message | 결과 메시지 | string |
| data | API 응답 데이터 | json |
| data.rawTx | 트랜잭션 데이터 | string 또는 json |
| data.hashedTx | 해시한 data.rawTx입니다. API 헤더 x-network가 polygon이고 Request Body from이 다중 서명 지갑 주소일 때에만 이 값을 받습니다. | string |
| data.requestId | API 요청을 식별할 수 있는 고유값 | string |
Request sample
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/nft/extension/contract'
-H 'accept: application/json'
-H 'x-network: polygon'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb...'
-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"
}
}