Approve Tokens

This endpoint returns an unsigned transaction to approve an unlimited amount of tokens for trading on SunPump. This should be signed and broadcasted locally or on the client side.

Endpoint

  • URL: /sunpump/approve

  • Method: POST

  • Content-Type: application/json

  • API Key Header: api-key: your-api-key

Parameters

ParameterTypeRequiredDescription

tokenAddress

string

Yes

Token Contract Address

userAddress

string

Yes

Public Tron Address of sender

Example Approve Requests

curl -X POST https://api.dangeracorn.com/sunpump/approve \
-H "Content-Type: application/json" \
-H "api-key: your-api-key" \
-d '{
  "tokenAddress": "token-contract-address",
  "userAddress": "sender-public-tron-address"
}'

Example Response JSON

{
  "unsignedTx": {
    "raw_data": { /* transaction data */ },
    "txID": "b69f27c7bfcf54a464294f1df99aaeff1b53714a12a80460709b20923a24486c" // example
  },
  "status": "unsigned",
  "code": "200"
}

Error Responses

Invalid Parameters

{
  "error": "Invalid parameters",
  "message": "You must only provide tokenAddress and userAddress",
  "code": "400"
}

Insufficient Funds

{
  "error": "Insufficient funds",
  "message": "Your account does not have enough funds to perform this transaction.",
  "code": "400"
}

Notes

  • Rate Limiting: This endpoint is rate-limited according to your plan's API key limits. Ensure that you handle these limits in your application.

  • Unsigned Transactions: The API returns unsigned transactions that users must sign before broadcasting.

Last updated