api.md

January 19, 2020 ยท View on GitHub

Ethereum sender API document

send_transaction

Example

// Request
curl -X POST http://localhost:3000/launch_logs -d \
'{
   "from": "0x31ebd457b999bf99759602f5ece5aa5033cb56b3",
   "to": "0x3eb06f432ae8f518a957852aa44776c234b4a84a",
   "value": "2000000000000000000",
   "data": [],
   "gas_price": "",
   "gas_limit": 30000,
   "item_type": "engine",
   "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451229",
   "isUrgent": false
 }'

//Response
'{
   "status": 0,
   "desc": "success",
   "data": {
     "data": {
       "hash": "0xeb3eeeb4e0b8c2e04920ccdcae2836c5a4172872a672045d444d33a56f825c3e",
       "item_type": "engine",
       "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451229",
       "status": 2,
       "gas_price": "13000000000",
       "gas_limit": "30000"
     }
   }
 }'

Request Data

ParameterDescriptionRequiredTypeExample
fromsender of the transactionyesstring0x31ebd457b999bf99759602f5ece5aa5033cb56b3
toreceiver of the transactionyesstring0x3eb06f432ae8f518a957852aa44776c234b4a84a
valuevalue of the transactionyesstring2000000000000000000
datasend data of the transactionyesstring[]
gas_priceif empty, sender will set a rational valuenostring13000000000
gas_limitif empty, sender will set a rational valuenoint30000
item_typeid of the request systemyesstringengine
item_idid of the request logyesstring7e36a266-1b32-4eaa-bc95-6d7b47451229

Response Data

ParameterDescriptionTypeExample
hashhash of the transactionstring0xeb3eeeb4e0b8c2e04920ccdcae2836c5a4172872a672045d444d33a56f825c3e
statusstatus of the transactionstring2

Details

status has 8 kind of value as follows:

CodeStatusDescription
0CREATEDstatus when sender access a new tx
1RETRIEDa final status, when a tx was confirmed, other PENDING txs having the same nonce would turn into RETRIED
2PENDINGstatus when tx was successful sent
3SUCCESSa final status, when the tx was confirmed on ethereum and successful
4FAILEDa final status, when the tx was confirmed on ethereum and failed
5SIGN_FAILEDa final status, when sign fail by pkm
6SEND_FAILEDa final status, when return error by sending tx to ethereum
7ESTIMATED_GAS_FAILEDa final status, when request gas limit is not enough

query_transaction

Example

// Request
curl -X GET http://localhost:3000/launch_logs -d \
'{
   "hash": "0xeb3eeeb4e0b8c2e04920ccdcae2836c5a4172872a672045d444d33a56f825c3e",
   "item_id": "",
   "item_tyep": ""
 }'

//Response
'{
   "status": 0,
   "desc": "success",
   "data": {
     "data": [
       {
         "hash": "0xeb3eeeb4e0b8c2e04920ccdcae2836c5a4172872a672045d444d33a56f825c3e",
         "item_type": "engine",
         "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451229",
         "status": 3,
         "gas_price": "13000000000",
         "gas_used": 21000,
         "executed_at": 1578860943
       }
     ]
   }
 }'

Request Data

ParameterDescriptionRequiredTypeExample
hashhash of the transaction you querynostring0xeb3eeeb4e0b8c2e04920ccdcae2836c5a4172872a672045d444d33a56f825c3e
item_iditem_id of the transactions you querynostring7e36a266-1b32-4eaa-bc95-6d7b47451229T
item_typeitem_type of the transactions you querynostringengine

Details

when you query logs by hash, you will get only one log in response data. when you query logs by item_id and item_type, you will get a list of logs. this is because when the log you sent has been seed up, sender will resend the log with a larger gas, and the response also contains all the resend logs.

Response Data

Return a list of logs data, the structure for every log item is same as send_transaction