Orders

Buy energy

Purchase TRON Energy for a target address.

Three modes:

  1. X-API-Key header: deducts from TRX balance → 200 + order
  2. PAYMENT-SIGNATURE header: x402 v2 USDC on Base → 200 final result or 202 pending confirmation. Poll the same intent; do not pay again. Late confirmed payments credit the account with order: null.
  3. No auth headers: returns 402 with TRX instructions and, when available, a two-minute x402 quote. Copy resource and accepts[0] into the signed payload unchanged.
post/api/v2/agent/buy-energy

Request

  • Base URL: https://powersun.vip
  • URL: https://powersun.vip/api/v2/agent/buy-energy
  • Auth: one of:
    • API key in header X-API-Key
    • none

Headers

PAYMENT-SIGNATUREstring

Base64-encoded JSON: {x402Version: 2, resource, accepted, payload: {signature, authorization: {from, to, value, validAfter, validBefore, nonce}}}. Copy resource and accepted from the quote, including accepted.extra.intentId. Sign EIP-3009 using the quoted USD Coin / 2 domain on Base. X-PAYMENT remains a compatibility alias.

X-PAYMENT-INTENT-IDstring

Optional compatibility hint. If present, must match accepted.extra.intentId in PAYMENT-SIGNATURE.

Request body

targetAddressstring required

TRON address to delegate energy to

txCountinteger required
txType'trc20_transfer' | 'trc20_transfer_new' | 'trc10_transfer' | 'contract_call'
durationMinutesinteger
maxPriceTrxnumber

Maximum acceptable total price in TRX

resourceType'ENERGY' | 'BANDWIDTH'
x402IntentIdstring

Optional compatibility hint; must match accepted.extra.intentId in PAYMENT-SIGNATURE

Example request

{
  "targetAddress": "TXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "txCount": 10
}

Response

Order created, or final x402 result. A late confirmed x402 payment credits the account and returns order: null with paymentStage: credited.

pendingfalse
intentIdstring
paymentStage'completed' | 'credited'

Example response

{
  "settlement": {
    "network": "eip155:8453"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.