curl -X POST https://api.dangeracorn.com/sunpump/getTokenBalance \
-H "Content-Type: application/json" \
-H "api-key: your-api-key" \
-d '{
"publicKey": "sender-public-tron-address",
"tokenAddress": "token-contract-address",
"tokenDecimals": 18
}'
const axios = require('axios');
const getTokenBalance = async () => {
const response = await axios.post('https://api.dangeracorn.com/sunpump/getTokenBalance', {
publicKey: 'sender-public-tron-address',
tokenAddress: 'token-contract-address',
tokenDecimals: 18
}, {
headers: {
'Content-Type': 'application/json',
'api-key': 'your-api-key'
}
});
console.log(response.data);
};
getTokenBalance();
import requests
url = "https://api.dangeracorn.com/sunpump/getTokenBalance"
headers = {
"Content-Type": "application/json",
"api-key": "your-api-key"
}
data = {
"publicKey": "sender-public-tron-address",
"tokenAddress": "token-contract-address",
"tokenDecimals": 18
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const axios = require('axios');
const getTokenBalance = async () => {
const response = await axios.post('https://api.dangeracorn.com/sunpump/getTokenBalance', {
publicKey: 'sender-public-tron-address',
tokenAddress: 'token-contract-address',
tokenDecimals: 18
}, {
headers: {
'Content-Type': 'application/json',
'api-key': 'your-api-key'
}
});
console.log(response.data);
};
getTokenBalance();
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.dangeracorn.com/sunpump/getTokenBalance"
data := map[string]interface{}{
"publicKey": "sender-public-tron-address",
"tokenAddress": "token-contract-address",
"tokenDecimals": 18,
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "your-api-key")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
<?php
$url = "https://api.dangeracorn.com/sunpump/getTokenBalance";
$data = array(
"publicKey" => "sender-public-tron-address",
"tokenAddress" => "token-contract-address",
"tokenDecimals" => 18
);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n" .
"api-key: your-api-key\r\n",
'method' => 'POST',
'content' => json_encode($data),
),
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response === FALSE) {
die('Error occurred');
}
echo $response;
{
"data": [{
"priceInTRX": 0.0025,
"priceInUSD": 0.0003735,
}],
"status": "success",
"code": "200"
}
{
"error": "Invalid publicKey",
"message": "Please check that the publicKey is a valid Tron address.",
"status": "error",
"code": "400"
}
{
"error": "Invalid tokenAddress",
"message": "Please check that the tokenAddress is a valid Tron address.",
"status": "error",
"code": "400"
}
{
"error": "Error retrieving token balance",
"message": "Failed to retrieve token balance. Please check your input values and try again.",
"status": "error",
"code": "500"
}