Hive Blockchain API is the web 3.0 game API that is powered by Hive, using its AppID and PlayerID. The game player can mint many tokens at once, up to 200 tokens, and the game studio can get transaction log per user. There are many other features optimal for the web 3 games. With the Hive Blockchain API, you can efficiently set up the development, operation, and management of web 3 game projects. The Hive Blockchain API supports Polygon and XPLA blockchains.
Pre-requisites: Get API Authentication Token
To call a Hive Blockchain API, you have to append an auth token to the header of an API. This is how to get your API auth token.
- Sign up at the Hive Console, go to AppCenter > Game List > Register new game.
- Create an new AppID at AppCenter > AppID List > Register new AppID.
- Register new AppID: Web Login AppID
- Purpose of use: Blockchain
- AppID to use: Choose “automatically generated AppID” or “automatically generated AppID” with “Additional Information”
- Go to the the Hive Console > Blockchain > Search for API Authentication Key, select and search the game name, and get the ID and the Secret key.
- Insert the ID and the Secret key in the request body of auth-token API and call this API.
- You can get your API auth key as
data.accessToken
in the API responses.
NFT API
Mint NFT
Create a transaction that mint tokens to a specific address (to
). Load the required NFT information (mintMsg.tokenId
, mintMsg.metadata
, etc.) into an array and call this API. You can mint a maximum of 200/50 tokens to 1 account for XPLA/Polygon per API call. from
must be the account that has a right to mint.
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" } } |
Get NFT Information
Get NFT information via the token 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
Locking an NFT means forbidding a minted NFT to be traded. When a gamer minted an NFT from a game item and wants this item to use in the game again, the minted NFT is locked and become unavailable for trading. Creates a lock transaction to lock down the NFT (tokenId
). The owner (owner
) of an NFT won’t be able to use this 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/" }' |
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" } } |
Unlock NFT
Creates a unlocking transaction to release the NFT (tokenId
) from being locked. The owner (owner
) of an NFT will be able to use this NFT again.
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
Exchange Game Currency and Game Token
Exchange the game token for the game currency or the vice versa.
- to-token: Exchange the game currency (gameCurrencyCode) for the game token (gameToken).
- to-currency: Exchange the game token (gameToken) for the game currency (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 pool is a place where the game token minted by the game studio and the game currency can be exchanged with each other. This API gets you the remaining amount of tokens and game currency in a convert pool.
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
Register Txhash
Register requestId
that is returned in the API response after you created a transaction (mint, convert, lock API, etc.), and register txHash
which is received after sending this transaction to a blockchain. The purpose of calling this API is tracking the request for creating a transaction and its status.
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" } |
Get Transaction List
This API gets you the list of transactions requested to be sent to a blockchain. If the requested transactions are successfully sent and recorded in a blockchain, its status (transactions.txStatus
) is updated to “success.”
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
Get Token Balance
This API gets you the current token balance of the token owner account address (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
Get Contract Information
This API gets you the information of the contract that was deployed by an account address (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 } } } |