मुख्य API
एनर्जी खरीदें
TRON एड्रेस के लिए एनर्जी खरीदें
POST
/
api
/
v1
/
energy
/
buy
एनर्जी खरीदें
curl --request POST \
--url https://api.example.com/api/v1/energy/buy \
--header 'Content-Type: application/json' \
--data '
{
"target_address": "<string>",
"volume": 123,
"duration": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/energy/buy"
payload = {
"target_address": "<string>",
"volume": 123,
"duration": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({target_address: '<string>', volume: 123, duration: '<string>'})
};
fetch('https://api.example.com/api/v1/energy/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/energy/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'target_address' => '<string>',
'volume' => 123,
'duration' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/energy/buy"
payload := strings.NewReader("{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/energy/buy")
.header("Content-Type", "application/json")
.body("{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/energy/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"status": "<string>",
"txid": {},
"price_trx": "<string>",
"reclaim_at": {},
"activation_cost_trx": "<string>"
}एनर्जी खरीदें
निर्दिष्ट TRON एड्रेस को एनर्जी डेलिगेट करता है। लागत आपके अकाउंट बैलेंस से काटी जाती है।अनुरोध बॉडी
लक्ष्य TRON एड्रेस (T… प्रारूप, 34 अक्षर)
डेलिगेट करने के लिए एनर्जी की मात्रा (न्यूनतम 32,000, अधिकतम 5,000,000)
किराये की अवधि:
"1h" (केवल 1 घंटा)रिस्पॉन्स
Unique order identifier
Order status:
pending, filled, failedOn-chain transaction id once the delegation is broadcast (null while
pending)Total cost charged from your balance, in TRX
ISO 8601 timestamp when the bandwidth rental is reclaimed (energy is reclaimed automatically by the provider)
Address activation cost in TRX (
"0" if the recipient is already activated)उदाहरण
curl -X POST https://api.tronrental.com/v1/energy/buy \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"target_address": "TYourRecipientAddress1234567890abc",
"volume": 65000,
"duration": "1h"
}'
import requests
resp = requests.post(
"https://api.tronrental.com/v1/energy/buy",
headers={"X-API-Key": "your_api_key"},
json={
"target_address": "TYourRecipientAddress1234567890abc",
"volume": 65000,
"duration": "1h",
},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/energy/buy", {
method: "POST",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
target_address: "TYourRecipientAddress1234567890abc",
volume: 65000,
duration: "1h",
}),
});
console.log(await resp.json());
Response
{
"id": 12345,
"price_trx": "2.75",
"status": "pending"
}
65,000 एनर्जी उस एड्रेस पर एक USDT ट्रांसफर को कवर करती है जिसके पास पहले से USDT है।
पहली बार USDT प्राप्त करने वालों के लिए 131,000 का उपयोग करें (नए स्टोरेज स्लॉट का निर्माण)।
⌘I
एनर्जी खरीदें
curl --request POST \
--url https://api.example.com/api/v1/energy/buy \
--header 'Content-Type: application/json' \
--data '
{
"target_address": "<string>",
"volume": 123,
"duration": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/energy/buy"
payload = {
"target_address": "<string>",
"volume": 123,
"duration": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({target_address: '<string>', volume: 123, duration: '<string>'})
};
fetch('https://api.example.com/api/v1/energy/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/energy/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'target_address' => '<string>',
'volume' => 123,
'duration' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/energy/buy"
payload := strings.NewReader("{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/energy/buy")
.header("Content-Type", "application/json")
.body("{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/energy/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"target_address\": \"<string>\",\n \"volume\": 123,\n \"duration\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"status": "<string>",
"txid": {},
"price_trx": "<string>",
"reclaim_at": {},
"activation_cost_trx": "<string>"
}