delegateEnergy - TRON energy
Example code for the delegateEnergy JSON RPC method. Сomplete guide on how to use delegateEnergy JSON RPC in GetBlock Web3 documentation.
Parameter
Request
curl -X POST https://api.getblock.io/tron-energy/delegateEnergy \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target_address": "TUo8pycbvje9w2XYsNnnzw67bpPs4GLFyD",
"volume": 65000,
"duration": "3d"
}'import axios from 'axios';
const data = JSON.stringify({
"target_address": "TUo8pycbvje9w2XYsNnnzw67bpPs4GLFyD",
"volume": 65000,
"duration": "3d"
});
const config = {
method: 'post',
url: 'https://api.getblock.io/tron-energy/delegateEnergy',
headers: {
'Content-Type': 'application/json',
'Authorization: Bearer YOUR_API_KEY'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error)); Response
{
"order_id": "clxyz123...",
"status": "success",
"target_address": "TUo8pycbvje9w2XYsNnnzw67bpPs4GLFyD",
"resource_type": "energy",
"volume": 65000,
"duration": "3d",
"price_usd": "4.97",
"trx_spent": 20.12,
"provider_order_id": 12345,
"txid": "abc123def...",
"message": "Order completed successfully."
}Last updated
Was this helpful?