Hive blockchain API เป็นเกมเว็บ 3.0 API ที่ขับเคลื่อนโดย Hive, โดยใช้มัน AppID และ PlayerID. ผู้เล่นเกมสามารถสร้างโทเค็นได้จำนวนมากในคราวเดียว มากถึง 200 โทเค็น และสตูดิโอเกมสามารถรับบันทึกธุรกรรมต่อผู้ใช้หนึ่งคน มีคุณสมบัติอื่น ๆ อีกมากมายที่เหมาะสมที่สุดสำหรับเกมบนเว็บ 3 กับ Hive blockchain APIคุณสามารถตั้งค่าการพัฒนา การดำเนินการ และการจัดการโปรเจ็กต์เกมบนเว็บ 3 ได้อย่างมีประสิทธิภาพ ที่ Hive blockchain API สนับสนุน Polygon และ XPLA blockchains.
Pre-requisites: Get API Authentication Token
หากต้องการโทรหาก Hive blockchain APIคุณต้องผนวก a auth โทเค็นที่ส่วนหัวของ API. นี่คือวิธีการรับของคุณ API auth เหรียญ
- ลงทะเบียนได้ที่ Hive คอนโซล go to AppCenter > Game List > ลงทะเบียนเกมใหม่
- สร้างใหม่ AppID at AppCenter > AppID List > ลงทะเบียนใหม่ AppID.
- ลงทะเบียนใหม่ AppID: เข้าสู่ระบบเว็บไซต์ AppID
- วัตถุประสงค์การใช้งาน: บล็อคเชน
- AppID วิธีใช้: เลือก “สร้างโดยอัตโนมัติ AppID” หรือ “สร้างขึ้นโดยอัตโนมัติ AppID” ด้วย “ข้อมูลเพิ่มเติม”
- ไปที่ the Hive Console > Blockchain > ค้นหา API รหัสยืนยันตัวตน เลือกและค้นหาชื่อเกม และรับ ID และรหัสลับ
- แทรก ID และรหัสลับในเนื้อหาคำร้องของ auth-token API และเรียกสิ่งนี้ว่า API.
- คุณสามารถรับไฟล์ API auth ที่สำคัญเป็น
data.accessToken
ใน API การตอบสนอง
NFT API
Mint NFT
สร้างธุรกรรมที่โทเค็นโทเค็นไปยังที่อยู่เฉพาะ (to
). โหลดที่จำเป็น NFT ข้อมูล (mintMsg.tokenId
, mintMsg.metadata
ฯลฯ) ลงในอาร์เรย์แล้วเรียกสิ่งนี้ API- คุณสามารถสร้างโทเค็นได้สูงสุด 200/50 รายการต่อ 1 บัญชี XPLA/Polygon ต่อ API โทร. from
ต้องเป็นบัญชีที่มีสิทธิ์ทำเหรียญกษาปณ์
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/nft/{contract}/mint |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/nft/{contract}/mint |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the NFT contract address | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
playerId | the player id | string | Y |
from | the account address that mints NFTs | string | Y |
to | the wallet address that receives NFTs | string | Y |
isSend | If true , when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false , you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. |
boolean | Y |
mintMsg | the required information | array | Y |
mintMsg.tokenId | This is the NFT ID. The NFT ID should be unique, and is defined by the NFT minter.
|
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.
|
number | Y |
mintMsg.metadata | the metadata
|
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.
|
string | N |
encoded | whether the returned transaction is encoded or not
|
boolean | Y |
callbackUrl | the address to which the result of sending transaction is returned | 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.rawTx | Transaction data. You receive this value only when isSend is false . |
string or json |
data.hashedTx | Hashed data.rawTx . You receive this value only when all the following conditions are met:
|
string |
data.txhash | Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true . |
string |
data.status | Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING . If isSend is false , it means the transaction requires signing before sending, and you will receive WAITING . |
string |
data.reqeustId | the unique value that can identify each API request | string |
Request Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/nft/0x31a6854383c81daab14089cba0b9de1d42ecd65f/mint' \ -H 'accept: */*' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20y...' \ -H 'Content-Type: application/json' \ -d '{ "playerId": 1324, "from": "0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0", "to": "0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463", "isSend": true, "royaltyPercentage": 7.5, "mintMsg": [ { "tokenId": "1", "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", } ] } } ], "encoded": true, "callbackUrl": "https://withhive.com/" }' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
// When the isSend in the Request Body is true and the from is a wallet address created from a KMS key { "code": 0, "message": "success", "data": { "txhash": "02f8f3830138810b8459682f008459682f1083023...", "status": "pending", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is a multi-signature wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is either a wallet address created from a KMS key or a plain wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When isSend in the Request Body is false: data.rawTx is a string { "code": 0, "message": "success", "data": { "rawTx": "02f8d3830138810b8458e948068458e948168302e71494ebd9144485089ebe248f8...", "requestId": "5743f0aa-0323-47fc-a3da-173eee27bbe4" } } // When isSend in the Request Body is false: data.rawTx is a JSON object { "code": 0, "message": "success", "data": { "rawTx": { "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "to": "0xebd9144485089ebe248f8490984a60579407c262", "data": "0xb88d4fde000000000000000000000000dcd51770d06b54204abd8c30a25b4583d4caba3900...", "nonce": 11, "chainId": 80001, "gas": 190228, "maxFeePerGas": 1491259270, "maxPriorityFeePerGas": 1491259255 }, "requestId": "dd33ddd8-31fa-4491-9c3c-2f912f7059bc" } } |
เข้ามา NFT ข้อมูล
เข้ามา NFT ข้อมูลผ่านโทเค็น ID (tokenId
).
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/nft/{contract}/tokens/{tokenId} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/nft/{contract}/tokens/{tokenId} |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the NFT contract address | string | Y |
tokenId | the token ID | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Responses
Request Sample
1 2 3 4 5 6 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/nft/0x31a6854383c81daab14089cba0b9de1d42ecd65f/tokens/1' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.c2xwallet.hivepc.kr.test' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6...' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
{ "code": 0, "message": "success", "data": { "nftContract": "0x31a6854383c81daab14089cba0b9de1d42ecd65f", "tokenId": "5", "tokenUri": "ipfs://QmTPp6KFmBiDQyVL5b9fUGgp9tJtKrVEayRiXadDuBaPSD", "gatewayUrl": "https://test-bc-file.qpyou.cn/ipfs/QmTPp6KFmBiDQyVL5b9fUGgp9tJtKrVEayRiXadDuBaPSD", "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", "backgroundColor": "orange", "attributes": [ { "traitType": "Category", "value": "Game", "displayType": "string" } ] } } } |
Lock API
Lock NFT
การล็อค NFT หมายถึงการห้ามมิ้นต์ NFT ที่จะซื้อขาย เมื่อนักเล่นเกมทำเหรียญกษาปณ์ NFT จากไอเทมในเกมและต้องการให้ไอเทมชิ้นนี้กลับมาใช้ในเกมอีกครั้งที่มิ้นต์ NFT ถูกล็อคและไม่สามารถทำการซื้อขายได้ สร้างธุรกรรมการล็อคเพื่อล็อคลง NFT (tokenId
). เจ้าของ (owner
) ของ an NFT จะใช้สิ่งนี้ไม่ได้ NFT.
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/nft/contract/{contract}/lock |
---|---|
Sandbox URL |
https://sandbox-bc-api.qpyou.cn/ service/v1/nft/contract/{contract}/lock |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the NFT contract address | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
playerId | the player id | string | Y |
from | the wallet address of the NFT owner | string | Y |
isSend | If true , when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false , you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. |
boolean | Y |
lockContract | the address of the NFT lock contract | string | Y |
tokenId | NFT ID | String | Y |
encoded | whether the returned transaction is encoded or not
|
boolean | Y |
callbackUrl | the address to which the result of sending transaction is returned | 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.rawTx | Transaction data. You receive this value only when isSend is false . |
string or json |
data.hashedTx | Hashed data.rawTx . You receive this value only when all the following conditions are met:
|
string |
data.txhash | Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true . |
string |
data.status | Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING . If isSend is false , it means the transaction requires signing before sending, and you will receive WAITING . |
string |
data.reqeustId | the unique value that can identify each API request | string |
Request Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/nft/contract/0xebd9144485089ebe248f8490984a60579407c262/lock' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20...' \ -H 'Content-Type: application/json' \ -d '{ "playerId": 1324, "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "isSend": true, "lockContract": "0x572f47db51a98ae0d51324c2703d9d63ee3c9f03", "tokenId": "1", "encoded": true, "callbackUrl": "https://withhive.com/" }' |
ตัวอย่างการตอบกลับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
// When the isSend in the Request Body is true and the from is a wallet address created from a KMS key { "code": 0, "message": "success", "data": { "txhash": "02f8f3830138810b8459682f008459682f1083023...", "status": "pending", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is a multisig wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is either a wallet address created from a KMS key or a plain wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When isSend in the Request Body is false: data.rawTx is a string { "code": 0, "message": "success", "data": { "rawTx": "02f8d3830138810b8458e948068458e948168302e71494ebd9144485089ebe248f8...", "requestId": "5743f0aa-0323-47fc-a3da-173eee27bbe4" } } // When isSend in the Request Body is false: data.rawTx is JSON obejct { "code": 0, "message": "success", "data": { "rawTx": { "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "to": "0xebd9144485089ebe248f8490984a60579407c262", "data": "0xb88d4fde000000000000000000000000dcd51770d06b54204abd8c30a25b4583d4caba3900...", "nonce": 11, "chainId": 80001, "gas": 190228, "maxFeePerGas": 1491259270, "maxPriorityFeePerGas": 1491259255 }, "requestId": "dd33ddd8-31fa-4491-9c3c-2f912f7059bc" } } |
Unlock NFT
สร้างธุรกรรมการปลดล็อคเพื่อปล่อย NFT (tokenId
) จากการถูกล็อค เจ้าของ (owner
) ของ an NFT จะสามารถใช้สิ่งนี้ได้ NFT อีกครั้ง
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/lock/contract/{contract}/unlock |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/lock/contract/{contract}/unlock |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the address of the NFT lock contract | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
playerId | the PlayerID | string | Y |
nftContract | the NFT contract address | string | Y |
from | the wallet address of the owner of the NFT lock contract | string | Y |
isSend | If true , when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false , you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. |
boolean | Y |
tokenId | NFT ID | String | Y |
encoded | whether the returned transaction is encoded or not
|
boolean | Y |
callbackUrl | the address to which the result of sending transaction is returned | 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.rawTx | Transaction data. You receive this value only when isSend is false . |
string or json |
data.hashedTx | Hashed data.rawTx . You receive this value only when all the following conditions are met:
|
string |
data.txhash | Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true . |
string |
data.status | Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING . If isSend is false , it means the transaction requires signing before sending, and you will receive WAITING . |
string |
data.reqeustId | the unique value that can identify each API request | string |
Request Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/lock/contract/0x572f47db51a98ae0d51324c2703d9d63ee3c9f03/unlock' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuaGl2ZXNka...' \ -H 'Content-Type: application/json' \ -d '{ "playerId": 1324, "nftContract": "0xebd9144485089ebe248f8490984a60579407c262", "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "isSend": true, "tokenId": "2", "encoded": true, "callbackUrl": "https://withhive.com/" }' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
// When the isSend in the Request Body is true and the from is a wallet address created from a KMS key { "code": 0, "message": "success", "data": { "txhash": "02f8f3830138810b8459682f008459682f1083023...", "status": "pending", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is a multisig wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is either a wallet address created from a KMS key or a plain wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When isSend in the Request Body is false: data.rawTx is a string { "code": 0, "message": "success", "data": { "rawTx": "02f8d3830138810b8458e948068458e948168302e71494ebd9144485089ebe248f8...", "requestId": "5743f0aa-0323-47fc-a3da-173eee27bbe4" } } // When isSend in the Request Body is false: data.rawTx is JSON obejct { "code": 0, "message": "success", "data": { "rawTx": { "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "to": "0xebd9144485089ebe248f8490984a60579407c262", "data": "0xb88d4fde000000000000000000000000dcd51770d06b54204abd8c30a25b4583d4caba3900...", "nonce": 11, "chainId": 80001, "gas": 190228, "maxFeePerGas": 1491259270, "maxPriorityFeePerGas": 1491259255 }, "requestId": "dd33ddd8-31fa-4491-9c3c-2f912f7059bc" } } |
Convert API
แลกเปลี่ยนสกุลเงินเกมและเกม Token
แลกเปลี่ยนโทเค็นเกมเป็นสกุลเงินของเกมหรือในทางกลับกัน
- to-token: แลกเปลี่ยนสกุลเงินเกม (gameCurrencyCode) สำหรับโทเค็นเกม (gameToken).
- to-currency: แลกเปลี่ยนโทเค็นเกม (gameToken) สำหรับสกุลเงินของเกม (gameCurrencyCode).
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/convert/{type} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/convert/{type} |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Type | the convert type
|
string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
playerId | the PlayerID | string | Y |
isSend | If true , when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false , you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. |
boolean | Y |
owner | the wallet address of the user | string | Y |
convertPool | the address of the convert pool | string | Y |
gameTokenAmount | the amount of the game token | string | Y |
gameCurrencyCode | the code of the game currency | string | Y |
gameCurrencyAmount | the amount of the game currency | string | Y |
encoded | whether the returned transaction is encoded or not
|
boolean | Y |
callbackUrl | the address to which the result of sending transaction is returned | 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.rawTx | Transaction data. You receive this value only when isSend is false . |
string or json |
data.hashedTx | Hashed data.rawTx . You receive this value only when all the following conditions are met:
|
string |
data.txhash | Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true . |
string |
data.status | Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING . If isSend is false , it means the transaction requires signing before sending, and you will receive WAITING . |
string |
data.reqeustId | the unique value that can identify each API request | string |
Request Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/convert/to-token' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvb...' \ -H 'Content-Type: application/json' \ -d '{ "playerId": 1324, "isSend": true, "owner": "0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463", "convertPool": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "gameTokenAmount": "1", "gameCurrencyCode": "A39539HFTGOLD0001", "gameCurrencyAmount": "1000", "encoded": true, "callbackUrl": "https://withhive.com/" }' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
// When the isSend in the Request Body is true and the from is a wallet address created from a KMS key { "code": 0, "message": "success", "data": { "txhash": "02f8f3830138810b8459682f008459682f1083023...", "status": "pending", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is a multisig wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When the isSend in the Request Body is false and the from is either a wallet address created from a KMS key or a plain wallet address { "code": 0, "message": "success", "data": { "rawTx": "02f8f3830138810b8459682f008459682f1083023...", "requestId": "6fb62650-d52e-4bec-bb91-dd081813d7f1" } } // When isSend in the Request Body is false: data.rawTx is a string { "code": 0, "message": "success", "data": { "rawTx": "02f8d3830138810b8458e948068458e948168302e71494ebd9144485089ebe248f8...", "requestId": "5743f0aa-0323-47fc-a3da-173eee27bbe4" } } // When isSend in the Request Body is false: data.rawTx is JSON obejct { "code": 0, "message": "success", "data": { "rawTx": { "from": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "to": "0xebd9144485089ebe248f8490984a60579407c262", "data": "0xb88d4fde000000000000000000000000dcd51770d06b54204abd8c30a25b4583d4caba3900...", "nonce": 11, "chainId": 80001, "gas": 190228, "maxFeePerGas": 1491259270, "maxPriorityFeePerGas": 1491259255 }, "requestId": "dd33ddd8-31fa-4491-9c3c-2f912f7059bc" } } |
Get Convert Pool Information
A convert พูลเป็นสถานที่ที่โทเค็นเกมที่สร้างโดยสตูดิโอเกมและสกุลเงินของเกมสามารถแลกเปลี่ยนระหว่างกันได้ นี้ API ทำให้คุณได้รับโทเค็นและสกุลเงินเกมที่เหลืออยู่ใน convert สระ
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/convert/pool/{convertPool} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/convert/pool/{convertPool} |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
convertPool | the address of the convert pool | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | 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 |
Request Sample
1 2 3 4 5 6 7 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/convert/pool/0xdcd51770d06B54204abd8c30A25b4583D4cABa39' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvb...' \ -d '' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
{ "code": 0, "message": "success", "data": { "convertPoolAmount": "1000000000", "gameCurrency": [ { "goodsCode": "A39539HFTBRONZE0003", "goodsAmount": "10000000000" }, { "goodsCode": "A39539HFTGOLD0001", "goodsAmount": "1000000000000" }, { "goodsCode": "A39539HFTSILVER0002", "goodsAmount": "100000000000" } ] } } |
Transaction API
สมัครสมาชิก Txhash
สมัครสมาชิก requestId
ที่ถูกส่งคืนใน API การตอบสนองหลังจากที่คุณสร้างธุรกรรม (mint, convert, ล็อค APIฯลฯ) และลงทะเบียน txHash
ซึ่งจะได้รับหลังจากส่งธุรกรรมนี้ไปที่ blockchain. จุดประสงค์ของการเรียกสิ่งนี้ API กำลังติดตามคำขอสร้างธุรกรรมและสถานะ
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/tx/hash |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/tx/hash |
HTTP Method | PATCH |
Content-Type | application/json |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
requestId | the unique value that can identify each API request | string | Y |
txHash | the transaction hash | 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 |
Request Sample
1 2 3 4 5 6 7 8 9 10 11 |
curl -X 'PATCH' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/tx/hash' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.normal.freefull.apple.global.ios.universal' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImN...' \ -H 'Content-Type: application/json' \ -d '{ "requestId": "538d0ca4-9d8b-4b8c-ab02-c68bc1623ed3", "txHash": "0x99a93c8ba06865bd7054835d5f9abe57424289dca15ea61fe55a33a0651b058c" }' |
Response Sample
1 2 3 4 |
{ "code": 0, "message": "success" } |
เข้ามา Transaction รายการ
API ทำให้คุณได้รับรายการธุรกรรมที่ร้องขอให้ส่งไปยัง blockchain. หากธุรกรรมที่ร้องขอถูกส่งและบันทึกในก blockchainสถานะของมัน (transactions.txStatus
) ได้รับการอัปเดตเป็น "ความสำเร็จ"
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/tx |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/tx |
HTTP Method | GET |
Content-Type | application/json |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Query Parameters
Field Name | Description | Type | Required |
---|---|---|---|
playerId | the PlayerID | string | N |
startDate | the start date of the search range for the transaction creation date (yyyy-mm-dd) | string | N |
endDate | the end date of the search range for the transaction creation date (yyyy-mm-dd) | string | N |
page | the current page no. | number | N |
limit | the number of transactions that will be displayed on a page. | number | N |
Responses
Field Name | Description | Type |
---|---|---|
code | api request result code, 0: success | number |
message | the result message | String |
data | API response data | json |
transactions | the transaction information | array |
transactions.appid | the unique code (AppID) for identification of an app registered at the AppCenter | string |
transactions.playerId | the PlayerID | number |
transactions.address | the wallet address of an account that created the transaction | string |
transactions.contract | the contract address of the requested transaction | string |
transactions.requestId | the unique value that can identify each API request | string |
transactions.requestParams | the request parameters of the API | json |
transactions.txType | the transaction type | string |
transactions.txStatus | the transaction status | string |
transactions.txHash | the transaction hash | string |
transactions.createdAt | the date the transaction was created | string |
transactions.updatedAt | the date the transaction was updated | string |
meta | the pagination information | json |
meta.totalItems | the total number | number |
meta.itemCount | the number of exposures | number |
meta.itemsPerPage | the number of exposures per page | number |
meta.totalPages | the total number of pages | number |
meta.currentPage | the current page no. | number |
Request Sample
1 2 3 4 5 6 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/tx?playerId=1324&startDate=2023-08-10&endDate=2023-08-10' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.c2xwallet.hivepc.kr.test' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuaGl2...' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
{ "code": 0, "message": "success", "data": { "transactions": [ { "appid": "com.com2us.hivesdk.c2xwallet.hivepc.kr.test", "address": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", "contract": "0xB3A634AAC8F04f1946C1c9Fc461055AC1Bdc4b34", "requestId": "1643105b-7669-4260-8679-ca967660df41", "requestParams": { "encoded": true, "tokenId": "1", "playerId": 1324, "callbackUrl": "https://withhive.com/", "nftContract": "0xa3fd0377a12b75ac2f70d5f69550332c96582b00", "lockContract": "0xB3A634AAC8F04f1946C1c9Fc461055AC1Bdc4b34", "lockContractOwner": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765" }, "txType": "UNLOCK", "txStatus": "SUCCESS", "txHash": "0x78889d58613816c16389a7031634cc781fc725c3b3a88999524c92f67be89236", "createdAt": "2023-08-10T07:23:05.000Z", "updatedAt": "2023-08-10T07:25:00.000Z" } ], "meta": { "totalItems": 11, "itemCount": 1, "itemsPerPage": 1, "totalPages": 11, "currentPage": 1 } } } |
Token API
เข้ามา Token ยอดคงเหลือ
API ทำให้คุณได้รับยอดโทเค็นปัจจุบันของที่อยู่บัญชีของเจ้าของโทเค็น (from
).
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/ft/{contract}/account/{from}/balance |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/ft/{contract}/account/{from}/balance |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the address of the token contract | string | Y |
from | the token owner address | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | 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.value | the token balance | string |
data.rawValue | the token balance not applying data.decimals |
string |
data.decimals | the maximum decimal places of the token | number |
data.symbol | the symbol of the token | string |
data.symbolUri | the token symbol image URI | string |
Request Sample
1 2 3 4 5 6 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/ft/0x94853BdC9c6AdD50D7842D1A3117fab385457470/account/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765/balance' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.c2xwallet.hivepc.kr.test' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6I...' |
Response Sample
1 2 3 4 5 6 7 8 9 10 |
{ "code": 0, "message": "success", "data": { "value": "999998999", "symbol": "ST", "decimals": 18, "rawValue": "999998999000000000000000000" } } |
Contract API
เข้ามา Contract ข้อมูล
API รับข้อมูลสัญญาที่จัดทำโดยที่อยู่บัญชี (owner
).
Request URL
Live URL | https://bc-api.qpyou.cn/service/v1/contract/owner/{owner} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/service/v1/contract/owner/{owner} |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
owner | the account address that deployed the contract | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
Authorization | The authentication token required to call APIs | string | Y |
x-network | the blockchain networks {ploygon, xpla} | string | Y |
x-appid | This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. | string | Y |
Query Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contractType | the contract type | string | N |
page | the current page no. | number | N |
limit | the number of contracts that will be displayed on a page. | number | 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.contracts | the contract information | array |
data.contracts.network | the chain information | string |
data.contracts.owner | the account address that deployed the contract | string |
data.contracts.address | the contract address | string |
data.contracts.type | the contract type | string |
data.contracts.name | the contract name | string |
data.contracts.gameIndex | the game index | number |
data.contracts.gameName | the game name | string |
data.contracts.symbol | the contract symbol image URI | string |
data.contracts.symbolUri | the contract symbol image URI | string |
data.contracts.createdAt | the date the contract was recorded | string |
meta | the pagination information | json |
meta.totalItems | the total number | number |
meta.itemCount | the number of exposures | number |
meta.itemsPerPage | the number of exposures per page | number |
meta.totalPages | the total number of pages | number |
meta.currentPage | the current page no. | number |
Request Sample
1 2 3 4 5 6 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/service/v1/contract/owner/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765?contractType=FT&limit=1' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'x-appid: com.com2us.hivesdk.c2xwallet.hivepc.kr.test' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydX...' |
Response Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
{ "code": 0, "message": "success", "data": { "contracts": [ { "gameIndex": 539, "gameName": "HIVE SDK(en)", "owner": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", "address": "0x05524fd875255ebd9c5f8871015ccc37b7fb20de", "name": "Fungible Token", "type": "FT", "symbol": "Fungible Token", "symbolUri": "https://sandbox-bc-file.qpyou.cn/ipfs/QmfJ9oT8Yb69bGr9bKozoYFYDQ4e1qPy31q4W3xsxfVw9L", "createdAt": "2023-08-10T01:09:59.000Z", "network": "polygon" } ], "meta": { "totalItems": 5, "itemCount": 1, "itemsPerPage": 1, "totalPages": 5, "currentPage": 1 } } } |