创建出售订单
创建出售能量/带宽的订单
接口调用
POST
https://open.tronify.io/api/tronRent/addTronSale
以下参数带*字段为必填,不带*号为选填
Request Body
Name
Type
Description
relateOrderId*
String
买单Id
saleAddress*
String
用户地址(创建出售订单的钱包地址)
sourceFlag*
String
渠道来源(需要双方约定一个名称来代表三方的渠道)
buyPledgeNum*
String
能量/带宽出售数量
payTrxAddress*
String
trx接收地址
{
"resCode": 100,
"resMsg": "Success",
"data": {
"orderId": "82gaugby_r7oh_ki1y_f2ma_ltelk84hivte",
"relateOrderId": "3j354cx4_a4to_hbck_3amx_zrc0zh51dfkg",
"transaction": {
"visible": false,
"txID": "14fc0e21c3be5889bb413c2406b184df724ce0cefa239adf1e3ed8368e39d741",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"balance": 301000000,
"resource": "ENERGY",
"receiver_address": "41242e5341ccd7d16af9e3a3b1c5cb07794f596609",
"lock": true,
"owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7"
},
"type_url": "type.googleapis.com/protocol.DelegateResourceContract"
},
"type": "DelegateResourceContract"
}
],
"ref_block_bytes": "141a",
"ref_block_hash": "b29ae11706ac4963",
"expiration": 1682213709000,
"timestamp": 1682213651693
},
"raw_data_hex": "0a02141a2208b29ae11706ac496340c8c980defa305a75083912710a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e44656c65676174655265736f75726365436f6e747261637412380a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d7100118c0cac38f01221541242e5341ccd7d16af9e3a3b1c5cb07794f596609280170ed89fdddfa30"
}
}
}
{
// Response
}
调用示例
// example
const params = {
relateOrderId: 'mt1wxcl1_dplo_r0qp_5bho_w5an5hev6d70',
saleAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
payTrxAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
buyPledgeNum: 600,
sourceFlag: 'tronLink'
}
const res = await axios.post('https://open.tronify.io/api/tronRent/addTronSale',params)
console.log(res)
if(res.resCode === '100'){
const signedTx = await tronWeb.trx.sign(res.data.transaction)
const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
return broastTx.txid
}
Postman 示例
Last updated