cURL JavaScript Python Node.js Go PHP
Copy curl -X POST "http://api.dangeracorn.bot/pumpfun/trade" \
-H "Content-Type: application/json" \
-H "api-key: your-api-key" \
-d '{
"action": "buy",
"tokenAddress": "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A",
"amount": 100,
"slippage": 5,
"priorityFee": 10,
"privateKey": "your-private-key"
}'
Copy const axios = require ( 'axios' );
const data = {
action : "buy" ,
tokenAddress : "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A" ,
amount : 100 ,
slippage : 5 ,
priorityFee : 10 ,
privateKey : "your-private-key"
};
axios .post ( 'https://api.dangeracorn.bot/sunpump/trade' , data , {
headers : {
'Content-Type' : 'application/json' ,
'api-key' : 'your-api-key'
}
})
.then (response => {
console .log ( response .data);
})
.catch (error => {
console .error (error);
});
Copy import requests
url = 'https://api.dangeracorn.bot/sunpump/trade'
headers = {
'Content-Type' : 'application/json' ,
'api-key' : 'your-api-key'
}
data = {
"action" : "buy" ,
"tokenAddress" : "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A" ,
"amount" : 100 ,
"slippage" : 5 ,
"priorityFee" : 10 ,
"privateKey" : "your-private-key"
}
response = requests . post (url, json = data, headers = headers)
print (response. json ())
Copy const https = require ( 'https' );
const data = JSON .stringify ({
action : 'buy' ,
tokenAddress : 'TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A' ,
amount : 100 ,
slippage : 5 ,
priorityFee : 10 ,
privateKey : 'your-private-key'
});
const options = {
hostname : 'api.dangeracorn.bot' ,
port : 443 ,
path : '/sunpump/trade' ,
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
'api-key' : 'your-api-key'
}
};
const req = https .request (options , (res) => {
let responseData = '' ;
res .on ( 'data' , (chunk) => {
responseData += chunk;
});
res .on ( 'end' , () => {
console .log ( JSON .parse (responseData));
});
});
req .on ( 'error' , (e) => {
console .error (e);
});
req .write (data);
req .end ();
Copy package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main () {
url := "https://api.dangeracorn.bot/sunpump/trade"
apiKey := "your-api-key"
data := map [ string ] interface {}{
"action" : "buy" ,
"tokenAddress" : "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A" ,
"amount" : 100 ,
"slippage" : 5 ,
"priorityFee" : 10 ,
"privateKey" : "your-private-key" ,
}
jsonData, _ := json. Marshal (data)
req, _ := http. NewRequest ( "POST" , url, bytes. NewBuffer (jsonData))
req.Header. Set ( "Content-Type" , "application/json" )
req.Header. Set ( "api-key" , apiKey)
client := & http . Client {}
resp, err := client. Do (req)
if err != nil {
fmt. Println ( "Error:" , err)
return
}
defer resp.Body. Close ()
fmt. Println ( "Response Status:" , resp.Status)
// Additional response parsing can go here
}
Copy <? php
$api_url = "https://api.dangeracorn.bot/sunpump/trade" ;
$api_key = "your-api-key" ;
$data = array (
"action" => "buy" ,
"tokenAddress" => "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A" ,
"amount" => 100 ,
"slippage" => 5 ,
"priorityFee" => 0 . 002 ,
"privateKey" => "your-private-key"
);
$ch = curl_init ( $api_url ) ;
curl_setopt ( $ch , CURLOPT_HTTPHEADER , array(
'Content-Type: application/json' ,
'api-key: ' . $api_key
) ) ;
curl_setopt ( $ch , CURLOPT_POST , 1 ) ;
curl_setopt ( $ch , CURLOPT_POSTFIELDS , json_encode ( $data )) ;
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , true ) ;
$response = curl_exec ( $ch ) ;
if ( curl_errno ( $ch ) ) {
echo 'Request Error:' . curl_error ( $ch ) ;
} else {
echo $response;
}
curl_close ( $ch ) ;
?>
Copy {
"signature" : "b69f27c7bfcf54a464294f1df99aaeff1b53714a12a80460709b20923a24486c" ,
"status" : "success" ,
"code" : "200"
}
Copy jsonCopy code{
"error" : "Invalid parameters" ,
"message" : "You must provide action, tokenAddress, amount, and privateKey" ,
"code" : "400"
}
Copy jsonCopy code{
"error" : "Simulation failed" ,
"message" : "Max slippage reached" ,
"code" : "500"
}
Copy jsonCopy code{
"error" : "Insufficient funds" ,
"message" : "Your account does not have enough funds to perform this transaction." ,
"code" : "400"
}
Copy jsonCopy code{
"error" : "Invalid action" ,
"message" : "Action must be either 'buy' or 'sell'" ,
"code" : "400"
}