回收能量
接口调用
POST
https://open.tronify.io/api/tronRent/undelegateresource
以下参数带*字段为必填,不带*号为选填
相关参数从 查询地址质押记录 接口获取
Request Body
Name
Type
Description
saleAddress*
String
用户地址(创建质押交易的钱包地址)
sourceFlag*
String
渠道来源(需要双方约定一个名称来代表三方的渠道)
orderType*
String
订单类型(ENERGY/BANDWIDTH)
pledgeAddress*
String
出售能量的目标地址
payTrxNum*
String
回收trx数量
{
"resCode": 100,
"resMsg": "Success",
"data": {
"visible": false,
"txID": "b20aeb61595643ce60f50b34d839a81ad426f6a93ddf2c4ea3a5b727d6ae75cb",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"balance": 301000000,
"resource": "ENERGY",
"receiver_address": "416a91f86fc9b7e98b01a9d9141db61aed6f389b9e",
"owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7"
},
"type_url": "type.googleapis.com/protocol.UnDelegateResourceContract"
},
"type": "UnDelegateResourceContract"
}
],
"ref_block_bytes": "698e",
"ref_block_hash": "f8c19af47b0e65d3",
"expiration": 1682476032000,
"timestamp": 1682475972451
},
"raw_data_hex": "0a02698e2208f8c19af47b0e65d34080c08bdbfb305a75083a12710a37747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e556e44656c65676174655265736f75726365436f6e747261637412360a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d7100118c0cac38f012215416a91f86fc9b7e98b01a9d9141db61aed6f389b9e70e3ee87dbfb30"
}
}
调用示例
// example
const params = {
saleAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
pledgeAddress: 'TW7XuicuiQSHCcodUkyjMfdWxnWsbZmiSS',
orderType: 'ENERGY',
payTrxNum: 111,
sourceFlag: 'tronLink'
}
const res = await axios.post('https://open.tronify.io/api/tronRent/undelegateresource',params)
console.log(res)
if(res.resCode === '100'){
const signedTx = await tronWeb.trx.sign(res.data)
const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
return broastTx.txid
}
Postman 示例

Last updated