Token API offers the transfer, querying, and delegation of the FT (Fungible Token).
Get Token Information
Returns the token contract information of a contract address (contract
).
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract} |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the address of the token contract | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | 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.name | the token name | string |
data.symbol | the symbol of the token | string |
data.decimals | the maximum decimal places of the token | number |
data.totalSupply | the total amount of supply | string |
Request Sample
1 2 3 4 5 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x94853BdC9c6AdD50D7842D1A3117fab385457470' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' |
Response Sample
1 2 3 4 5 6 7 8 9 10 |
{ "code": 0, "message": "success", "data": { "name": "Simple Token", "symbol": "ST", "decimals": 18, "totalSupply": "1000000000" } } |
Get Token Balance
Returns the current token balance of the token owner account (from
).
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/balance |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/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 | string | Y |
Query Parameters
Field Name | Description | Type | Required |
---|---|---|---|
details | whether to return the balance details | boolean | N |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | 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.symbol | the symbol of the token | string |
data.decimals | the maximum decimal places of the token | number |
Request Sample
1 2 3 4 5 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x94853BdC9c6AdD50D7842D1A3117fab385457470/account/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765/balance?details=true' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' |
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" } } |
Get Token Amount Available for Approved Transfer
Returns the amount of tokens that the token owner account from
has approved the spender
account to send on behalf of the owner.
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/allowance/{spender} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/allowance/{spender} |
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 | string | Y |
spender | the account that is granted to send tokens | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | 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.allowance | the amount of tokens can be sent | string |
Request Sample
1 2 3 4 5 |
curl -X 'GET' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x94853BdC9c6AdD50D7842D1A3117fab385457470/account/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765/allowance/0xFBd488D1b00604d3b05124d80E35FeA9A39C3296' \ -H 'accept: application/json' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' |
Response Sample
1 2 3 4 5 6 7 |
{ "code": 0, "message": "success", "data": { "allowance": "0" } } |
Send Token
Creates a transaction that sends tokens to a specific address. from
must be the token owner. If the receiver account (to
) is a contract, this contract can do additional tasks with data
.
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract}/transfer |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/transfer |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the address of the token contract | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
encoded | whether the returned transaction is encoded or not
|
boolean | N |
from | the account address that sends the token | string | Y |
to | the account address that receives the token | string | Y |
amount | the amount of tokens to be sent | 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 | 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
1 2 3 4 5 6 7 8 9 10 11 12 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x94853BdC9c6AdD50D7842D1A3117fab385457470/transfer' \ -H 'accept: */*' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' \ -H 'Content-Type: application/json' \ -d '{ "encoded": true, "from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", "to": "0xFBd488D1b00604d3b05124d80E35FeA9A39C3296", "amount": "100.55" }' |
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 |
// Polygon { "code": 0, "message": "success", "data": { "rawTx": "02f8738301388181c2846fc23ac0846fc23ad882cdc49494853bdc9c6add50d7842d1a3117fab38545747080b8...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "4d4aa1e5-2bfe-4080-b42f-03319810fe29" } } // XPLA { "code": 0, "message": "success", "data": { "rawTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076.....", "reqeustId": "4d4aa1e5-2bfe-4080-b42f-03319810fe29" } } |
Send Token on behalf of Owner
Creates a transaction that sends tokens to a specific address on behalf of the token owner. from
must be the account that is delegated with the right to send tokens from the token owner (owner
). If the receiver account (to
) is a contract, this contract can do additional tasks with data
.
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract}/transfer-from |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/transfer-from |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the contract address | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
from | the wallet address of the account that is granted to send tokens | string | Y |
to | the wallet address that receives the token | string | Y |
amount | the amount of tokens to be sent | string | Y |
data | the data that will be sent if the receiver is a contract | string | Y |
owner | the wallet address of the token owner account | string | Y |
encoded | whether the returned transaction is encoded or not
|
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
1 2 3 4 5 6 7 8 9 10 11 12 13 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x5bd415aeb2b382c7fac9cc72c1f3994e33ff7b02/transfer-from' \ -H 'accept: */*' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' \ -H 'Content-Type: application/json' \ -d '{ "encoded": true, "from": "0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463", "to": "0xdcd51770d06B54204abd8c30A25b4583D4cABa39", "amount": "0.000001", "owner": "0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0" }' |
Response Sample
1 2 3 4 5 6 7 8 9 |
{ "code": 0, "message": "success", "data": { "rawTx": "02f8738301388181c2846fc23ac0846fc23ad882cdc49494853bdc9c6add50d7842d1a3117fab38545747080b8...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "4d4aa1e5-2bfe-4080-b42f-03319810fe29" } } |
Grant the Right to Send Tokens
Creates a transaction that the from
account approves to
account to send the amount
of tokens on behalf of the from
account. from
must be the token owner.
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/{contract}/approve |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/approve |
HTTP Method | POST |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
contract | the address of the token contract | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
from | the wallet address of the token owner account | string | Y |
to | the wallet address of the account that receives the right to send tokens | string | Y |
amount | the amount of tokens to be sent | string | Y |
encoded | whether the returned transaction is encoded or not
|
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
1 2 3 4 5 6 7 8 9 10 11 12 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/0x5bd415aeb2b382c7fac9cc72c1f3994e33ff7b02/approve' \ -H 'accept: */*' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' \ -H 'Content-Type: application/json' \ -d '{ "encoded": true, "from": "0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0", "to": "0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463", "amount": "100" }' |
Response Sample
1 2 3 4 5 6 7 8 9 |
{ "code": 0, "message": "success", "data": { "rawTx": "02f8738301388181c2846fc23ac0846fc23ad882cdc49494853bdc9c6add50d7842d1a3117fab38545747080b8...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "4d4aa1e5-2bfe-4080-b42f-03319810fe29" } } |
Deploy Token Contract
Creates a transaction that deploys the standard token contract.
Request URL
Live URL | https://bc-api.qpyou.cn/core/v1/ft/contract |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/ft/contract |
HTTP Method | POST |
Content-Type | application/json |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request Body
Field Name | Description | Type | Required |
---|---|---|---|
from | the wallet address that deploys the token contract | string | Y |
name | the token name | string | Y |
symbol | the symbol of the token | string | Y |
decimals | the maximum decimal places of the token | number | Y |
initialSupply | the initial amount of the tokens minted | string | Y |
encoded | whether the returned transaction is encoded or not
|
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
curl -X 'POST' \ 'https://sandbox-bc-api.qpyou.cn/core/v1/ft/contract' \ -H 'accept: */*' \ -H 'x-network: polygon' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...' \ -H 'Content-Type: application/json' \ -d '{ "encoded": true, "from": "0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765", "name": "Simple Token", "symbol": "ST", "decimals": 18, "initialSupply": "1000000000" }' |
Response Sample
1 2 3 4 5 6 7 8 9 |
{ "code": 0, "message": "success", "data": { "rawTx": "02f8738301388181c2846fc23ac0846fc23ad882cdc49494853bdc9c6add50d7842d1a3117fab38545747080b8...", "hashedTx": "0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556c79076...", "requestId": "4d4aa1e5-2bfe-4080-b42f-03319810fe29" } } |