recovered energy
Endpoint usage
POST
https://open.tronify.io/api/tronRent/undelegateresource
The fields with * are required, and the fields without * are optional related parameters can be got from Query selling records by address
Request Body
Name
Type
Description
saleAddress*
String
user address (wallet address)
sourceFlag*
String
Source channel (Both sides need to agree on a name to represent the channel of the third parties)
orderType*
String
order type(ENERGY/BANDWIDTH)
pledgeAddress*
String
target address for selling energy
payTrxNum*
String
amount of recovered 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"
}
}
code example
// 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 example

Last updated