-
Notifications
You must be signed in to change notification settings - Fork 255
Contract Token
[TOC]
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenPreCreateTx",
"params":[{"name":"string",
"symbol":string,
"introduction":"string",
"total":int64,
"price": int64,
"category": int64,
"owner":"string"}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
name | string | token full name, maximum length is 128 characters |
symbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
introduction | string | token introduction with maximum length of 1024 bytes |
total | int64 | The total amount of issuance, need to multiply it by 10 to the eighth. For example, to issue 100 coins, you have to have 100 times 1e8. |
price | int64 | issuing cost that token is willing to bear |
owner | string | token owner address |
category | int64 | attribute category, 0 for ordinary token, 1 for additional and combustion |
Response message: |
response:
{
"id":int32,
"error":null,
"result": "string"
}
Parameter description:
Parameter | Type | Description |
---|---|---|
result | string | hexadecimal encoded transaction strings |
Example: Request:
{
"id":1,
"method":"token.CreateRawTokenPreCreateTx",
"params":[{"name":"Develop Coins",
"symbol":"DEVCOIND",
"introduction":"Develop Coins",
"total":19900000000000000,
"price": 0,
"owner":"14Gkp5kUEMo7fXhHuDRnRN6vJxNpSdDw1T"}]
}
Response:
{
"id":1, "result":"0a14757365722e702e646576746573742e746f6b656e123538070a310a0d446576656c6f7020436f696e731208444556434f494e5a1a0d446576656c6f7020436f696e732080809ff89cdeac2320a08d0630d8ebd6a2a7c293ca343a22314c5173504264486f776a3945767337583545654c6770736a464441547759755162",
"error":null
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenFinishTx",
"params":[{"symbol":"string",
"owner":"string"}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
symbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
owner | string | token owner address |
Response message:
response:
{
"id":int32,
"error":null,
"result": "string"
}
Parameter description:
Parameter | Type | Description |
---|---|---|
result | string | hexadecimal string encoding of the transaction object |
Example: Request:
{
"id":1,
"method":"token.CreateRawTokenFinishTx",
"params":[{"symbol":"DEVCOINZ",
"owner":"14Gkp5kUEMo7fXhHuDRnRN6vJxNpSdDw1T"
}]
}
Response:
{
"id":1,
"result":"0a14757365722e702e646576746573742e746f6b656e12323808122e0a08444556434f494e4412223134476b70356b55454d6f37665868487544526e524e36764a784e7053644477315420a08d06309eabebbcd9b383cc763a22314c5173504264486f776a3945767337583545654c6770736a464441547759755162",
"error":null
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenRevokeTx",
"params":[{"symbol":"string","owner":"string"}]
}
Parameter description:
Parameter | Type | If Necessary | Description |
---|---|---|---|
symbol | string | yes | token symbol with a maximum length of 16 characters, and must be uppercase |
owner | string | yes | token owner address |
Response message:
response:
{
"id":int32,
"error":null,
"result": "string"
}
Parameter description:
Parameter | Type | Description |
---|---|---|
result | string | hexadecimal string encoding of the transaction object |
Example: Request:
{
"id":1,
"method":"token.CreateRawTokenRevokeTx",
"params":[{"symbol":"DEVECOIN",
"owner":"14Gkp5kUEMo7fXhHuDRnRN6vJxNpSdDw1T"
}]
}
Response:
{
"id":1, "result":"0a14757365722e702e646576746573742e746f6b656e123238091a2e0a0844455645434f494e12223134476b70356b55454d6f37665868487544526e524e36764a784e7053644477315420a08d0630a5cab6e0fc96d0cd503a22314c5173504264486f776a3945767337583545654c6770736a464441547759755162",
"error":null
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.Query",
"params":[{"execer" : "token",
"funcName" : "GetTokens",
"payload" : {"status": 0,"queryAll":true,"symbolOnly":true}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | base class method name, fixed chain33.Query |
execer | string | main chain query: token parallel chain query:user.p.xxxx.token |
funcName | string | GetTokens |
payload | - | status: 0, queryAll: true/false, symbolOnly: optional (true/false) |
Response message:
response:
{
"id":2,
"result":{"tokens":[
{"name":"ganme",
"symbol":"GANME",
"introduction":"ganme_token",
"total":"1990000000000000000",
"price":"0",
"owner":"14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc",
"creator":"1N84sP4Nep9k72kE69AoKjEi4uKZ5h7ZVz",
"status":0,
"createdHeight":"0",
"createdTime":"0",
"prepareCreateHeight":"188",
"prepareCreateTime":"1544775327",
"precision":8,
"totalTransferTimes":"0",
"revokedHeight":"0",
"revokedTime":"0"}]},
"error":null}
Parameter description:
Parameter | Type | Description |
---|---|---|
name | string | token full name, maximum length is 128 characters |
symbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
introduction | string | token introduction with maximum length of 1024 bytes |
ownerAddr | string | token owner address |
total | int | total amount of issuance |
price | int | issuing cost that token is willing to bear |
creator | string | pre-creator address |
status | int | 0 represent TokenStatusPreCreated status |
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.Query",
"params":[{"execer" : "token",
"funcName" : "GetTokens",
"payload" : {"status": 1,"queryAll":true,"symbolOnly":true}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | base class method name, fixed chain33.Query |
execer | string | main chain query: token parallel chain query:user.p.xxxx.token |
funcName | string | GetTokens |
payload | - | status: 0, queryAll: true/false, symbolOnly: optional (true/false) |
Response message:
{"id":2,"result":
{"tokens":[{"name":"ganme","symbol":"GANMEB","introduction":"ganme_token","total":"1990000000000000000","price":"0","owner":"14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc","creator":"1N84sP4Nep9k72kE69AoKjEi4uKZ5h7ZVz","status":1,"createdHeight":"196","createdTime":"1544776259","prepareCreateHeight":"195","prepareCreateTime":"1544776220","precision":8,"totalTransferTimes":"0","revokedHeight":"0","revokedTime":"0"},{"name":"“ganme”","symbol":"GANMEA","introduction":"ganme_token","total":"1990000000000000000","price":"0","owner":"“14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc”","creator":"1N84sP4Nep9k72kE69AoKjEi4uKZ5h7ZVz","status":1,"createdHeight":"194","createdTime":"1544775905","prepareCreateHeight":"193","prepareCreateTime":"1544775872","precision":8,"totalTransferTimes":"0","revokedHeight":"0","revokedTime":"0"}]},
"error":null}
Parameter description:
Parameter | Type | Description |
---|---|---|
name | string | token full name, maximum length is 128 characters |
symbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
introduction | string | token introduction with maximum length of 1024 bytes |
ownerAddr | string | token owner address |
total | int | total amount of issuance |
price | int | issuing cost that token is willing to bear |
creator | string | pre-creator address |
status | int | 1 represent token creation is complete |
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id": 1,
"method":"Chain33.Query",
"params":[{"execer" : "token",
"funcName" : "GetTokenInfo",
"payload" : {"data":"ADDRE"}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | Chain33.Query |
execer | string | main chain query: token parallel chain query:user.p.xxx.token |
funcName | string | GetTokenInfo |
payload | string | token tag |
Response message:
response:
{
"id":int32,
"error":null,
"result":{"tokens":[
{
"name": "AA",
"symbol": "AA",
"introduction": "LINJING",
"total": 100000000,
"price": 10,
"owner": "1MehcdmmayjP3whqvTf4dey17jKg5evqMu",
"creator": "1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK",
"status": 1,
"prepareCreateHeight": 14,
"prepareCreateTime": 1540973249,
"createdHeight": 26,
"createdTime": 1540973261,
"precision": 8
},
]}
}
Parameter description:
Parameter | Type | Description |
---|---|---|
name | string | token full name, maximum length is 128 characters |
symbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
introduction | string | token introduction with maximum length of 1024 bytes |
ownerAddr | string | token owner address |
total | int | total amount of issuance |
price | int | issuing cost that token is willing to bear |
creator | string | pre-creator address |
status | string | 1. 0 represent TokenStatusCreated status |
Example: Request:
{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"user.p.ganme.token","funcName":"GetTokenInfo","payload": {"data":"GANMEB"}}]}
Response:
{"id":2,"result":{"name":"ganme","symbol":"GANMEB","introduction":"ganme_token","total":"1990000000000000000","price":"0","owner":"14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc","creator":"1N84sP4Nep9k72kE69AoKjEi4uKZ5h7ZVz","status":1,"createdHeight":"196","createdTime":"1544776259","prepareCreateHeight":"195","prepareCreateTime":"1544776220","precision":8,"totalTransferTimes":"0","revokedHeight":"0","revokedTime":"0"},"error":null}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.SendToAddress",
"params":[{"from":"string","to":"string","amount":int64,"note":"string", "isToken", true, "tokenSymbol" : "string"}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
from | string | source address |
to | string | send to address |
amount | int | send amount |
note | string | note |
isToken | bool | Whether it sent token or not. If false, then send bty. |
tokenSymbol | string | token symbol with a maximum length of 16 characters, and must be uppercase |
Response message:
response:
{
"id":int32,
"error":null,
"result":{"hash":"0xa5cda12b0b91b5a6840213762899faee4a58a4b6246251aaceb896338fd374d3"}
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.SendToAddress",
"params":[{"from":"string","to":"string","amount":int64,"note":"string", "isToken", true, "tokenSymbol" : "string"}]
}
from: Token coin withdraw address to:Token saved contract address. amount: Send amount. Fill in the negative form. note: remark isToken: Whether it sent token or not. If false, then send bty. tokenSymbol: Token symbol with a maximum length of 16 characters, and must be uppercase
Response message:
response:
{
"id":int32,
"error":null,
"result":{"hash":"0xa5cda12b0b91b5a6840213762899faee4a58a4b6246251aaceb896338fd374d3"}
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.Query",
"params":[{"execer" : "token",
"funcName" : "GetAccountTokenAssets",
"payload" : {"address": "12aiZzR7uMxxa9okd1x7ULwEZHsAdWRUK1", "execer": string}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | Chain33.Query |
execer | string | actuator name main chain query: token parallel chain query:user.p.xxx.token |
funcName | string | GetAccountTokenAssets |
payload | - | address: query address, execer: token |
Response message:
response:
{
"id":int32,
"error":null,
"result":[
{
"symbol": "AA",
"account" :{
"currency" : int32
"balance" : int64
"frozen" : int64
"addr" : stirng
},
},
]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
symbol | string | token tag with a maximum length of 16 characters, and must be uppercase |
account | string | token account information for the corresponding address |
introduction | string | token introduction with maximum length of 1024 byte |
balance | int | available balance of the account |
frozen | int | freezing balance in account |
addr | string | account address |
Example: Request:
{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"user.p.ganme.token","funcName":"GetAccountTokenAssets","payload": {"address":"14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc","execer":"token"}}]}
Response:
{"id":2,"result":{"tokenAssets":[{"symbol":"GANMEB","account":{"currency":0,"balance":"1989999900000000000","frozen":"0","addr":"14S4UKuggZW17YfJ8cnrK5ACkPwW3kUJUc"}}]},"error":null}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.Query",
"params":[{
"execer" : "token",
"funcName" : "GetTxByToken",
"payload" : {
"symbol": "LJ",
"count" : 200,
"flag" : 0,
"height" : -1,
"index" : 1,
"direction" : 1
}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | Chain33.Query |
execer | string | actuator name main chain query: token parallel chain query:user.p.xxx.token |
funcName | string | GetTxByToken |
payload | - | symbol: token tag, count: transaction, flag / height / index / direction: paging related parameters |
execer | string | token |
Response message:
response:
{
"id":int32,
"error":null,
"result" : {
"txInfos" : [
{
"hash" : "0x4521ce4782832c190deb31ab1c0242dc4b212cfed3df38b2aae0947672eeff13",
"height" : 936292,
"index" : 1,
"assets": null
},
{
"index" : 2,
"height" : 936561,
"hash" : "0xd2963ef91ecc1141914a3e96f4081fe7fe1da11d65193f81a28b5390f3222b2a"
"assets": [
{
"exec": "token",
"symbol": "TEST"
}
]
}
]
}
}
Parameter description:
Parameter | Type | Description |
---|---|---|
txInfos | List | transaction list, including transaction hash, asset information, etc |
Example: Request:
{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"user.p.ganme.token","funcName":"GetTxByToken","payload": {"symbol":"GANMEB","direction": 0,"height": -1,"flag": 0,"index": 0,"count": 8}}]}
Response:
{"id":2,"result":{"txInfos":[{"hash":"0x3a9bce21222aa9c71aea71fad33a1ec57ce6174dcbc580f3de31e3d324e875a7","height":"208","index":"2","assets":[{"exec":"token","symbol":"GANMEB","amount":"0"}]}]},"error":null}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenMintTx",
"params":[{
"symbol": string,
"amount":int64
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | token.CreateRawTokenMintTx |
amount | int64 | additional issue token amount, number to be filled in* 1e8 |
symbol | string | token tag |
Response message:
response:
{
"id":int32,
"error":null,
"result": "string"
}
Parameter description:
Parameter | Type | Description |
---|---|---|
result | string | hexadecimal encoded transaction strings |
Example: Request:
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenMintTx",
"params":[{
"symbol": "TC",
"amount":10000000000
}]
}
Response:
{
"id":1, "result":"0a14757365722e702e646576746573742e746f6b656e123538070a310a0d446576656c6f7020436f696e731208444556434f494e5a1a0d446576656c6f7020436f696e732080809ff89cdeac2320a08d0630d8ebd6a2a7c293ca343a22314c5173504264486f776a3945767337583545654c6770736a464441547759755162",
"error":null
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenBurnTx",
"params":[{
"symbol": string,
"amount":int64
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | token.CreateRawTokenBurnTx |
amount | int64 | burning token amount, number to be filled in * 1e8 |
symbol | string | token tag |
Response message:
response:
{
"id":int32,
"error":null,
"result": "string"
}
Parameter description:
Parameter | Type | Description |
---|---|---|
result | string | hexadecimal encoded transaction strings |
Example: Request:
{
"jsonrpc":"2.0",
"id":int32,
"method":"token.CreateRawTokenBurnTx",
"params":[{
"symbol": "TC",
"amount":1000000000
}]
}
Response:
{
"id":1, "result":"0a14757365722e702e646576746573742e746f6b656e123538070a310a0d446576656c6f7020436f696e731208444556434f494e5a1a0d446576656c6f7020436f696e732080809ff89cdeac2320a08d0630d8ebd6a2a7c293ca343a22314c5173504264486f776a3945767337583545654c6770736a464441547759755162",
"error":null
}
Request message:
request: http.post
{
"jsonrpc":"2.0",
"id":int32,
"method":"Chain33.Query",
"params":[{
"execer" : "token",
"funcName" : "GetTokenHistory",
"payload" : {
"data": "string"
}
}]
}
Parameter description:
Parameter | Type | Description |
---|---|---|
method | string | Chain33.Query |
execer | string | actuator name main chain query: token parallel chain query:user.p.xxx.token |
funcName | string | GetTokenHistory |
payload | - | data : token tag |
execer | string | token |
Response message:
response:
{
"id":int32,
"error":null,
"result" : {
"logs": [
{
"symbol": "string",
"txIndex": "string",
"actionType": int32,
"txHash": "string"
}
]
}
}
Parameter description:
Parameter | Type | Description |
---|---|---|
logs | List | txHash transaction hash,symbol token, specific information can be searched by transaction hash, actionType: 8 for token creation, 12 for additional issuance, and 13 for combustion |
Example: Request:
{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"user.p.ganme.token","funcName":"GetTokenHistory","payload": {"data":"GANMEB"}}]}
Response:
{
"id":int32,
"error":null,
"result" : {
"logs": [
{
"symbol": "TC",
"txIndex": "000000000002300000",
"actionType": 13,
"txHash": "0xa288cc1c9b265ee3ddaf75630282c14a9461c4e97715014eb32d33e94b4f7636"
},
{
"symbol": "TC",
"txIndex": "000000000002000000",
"actionType": 12,
"txHash": "0x28d2be9acd00f473cb29cc77fb85ca14305d35089a446dcc7dadf4fd8c13757f"
},
{
"symbol": "TC",
"txIndex": "000000000000800000",
"actionType": 8,
"txHash": "0x0f7419ef74cd75715e860d5fe1421b3fda37766d35af87a59882ce0a1ea1cb95"
}
]
}
}
hello world