API 介面一覽

所有可用的 API 端點

Base URL

生產環境: https://api.usdtlowfee.com

通用約定

單位

  • • sun: 1 TRX = 1,000,000 sun(所有金額欄位使用 sun)
  • • energyValue: 能量單位(int64 數字)
  • • durationHours: 小時(int 數字)

資料類型

  • • ID 欄位: int64 數字(snowflake ID)
  • • 金額欄位: int64 數字(*Sun 後綴,如 balanceSun, priceSun)
  • • 時間欄位: string (ISO8601 UTC 格式,如 "2025-01-15T10:30:00Z")
  • • 布林欄位: true/false

響應格式

  • • 成功: { "data": {...}, "meta": {...} }(meta 可選)
  • • 失敗: { "error": { "code": "...", "message": "..." } }

帳戶管理

查詢錢包餘額和使用者資訊

GET /v1/wallet/balance

查詢餘額

取得目前錢包餘額

響應範例:

{
  "data": {
    "balanceSun": 1000000,
    "frozenSun": 0,
    "totalSun": 1000000
  }
}
GET /v1/users/me

使用者資訊

取得目前使用者基本資訊

響應範例:

{
  "data": {
    "id": 123456,
    "email": "user@example.com",
    "emailVerified": true,
    "createdAt": "2025-01-01T00:00:00Z"
  }
}

訂單管理

建立和查詢能量訂單

POST /v1/energy/orders

建立訂單

為指定位址建立能量租賃訂單(目前僅支援 manual 類型)

請求參數:

參數 類型 必填 說明
type string 訂單類型,目前僅支援 "manual"
data.tronAddress string 接收能量的 TRON 位址(34位,T開頭)
data.energyValue int64 能量數量(數字,最小 32000,推薦 65000 用於 USDT 轉帳)
data.durationHours int 租賃時長(小時數,可選值:1, 24, 72, 168, 336, 720)

請求範例:

{
  "type": "manual",
  "data": {
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1
  }
}

響應範例:

{
  "data": {
    "id": 1234567890,
    "userId": 9876543210,
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1,
    "priceSun": 3000000,
    "priceTrx": 3.0,
    "orderType": "manual",
    "status": "processing",
    "createdAt": "2025-01-15T10:30:00Z",
    "updatedAt": "2025-01-15T10:30:00Z",
    "statusUpdatedAt": "2025-01-15T10:30:00Z",
    "canTransitionTo": ["completed", "failed"]
  }
}
GET /v1/energy/orders/:id

查詢訂單

根據訂單 ID 查詢訂單詳情

響應範例:

{
  "data": {
    "id": 1234567890,
    "userId": 9876543210,
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1,
    "priceSun": 3000000,
    "priceTrx": 3.0,
    "orderType": "manual",
    "status": "completed",
    "txid": "abc123...",
    "createdAt": "2025-01-15T10:30:00Z",
    "completedAt": "2025-01-15T10:30:05Z",
    "updatedAt": "2025-01-15T10:30:05Z",
    "statusUpdatedAt": "2025-01-15T10:30:05Z",
    "canTransitionTo": []
  }
}
GET /v1/energy/orders

訂單列表

查詢訂單列表(支援分頁和篩選)

請求參數:

參數 類型 必填 說明
offset number 偏移量,預設 0
limit number 每頁數量,預設 20,最大 100
status string 訂單狀態篩選:processing, completed, failed

響應範例:

{
  "data": {
    "orders": [
      {
        "id": 1234567890,
        "userId": 9876543210,
        "tronAddress": "TYour1...",
        "energyValue": 65000,
        "durationHours": 1,
        "priceSun": 3000000,
        "priceTrx": 3.0,
        "orderType": "manual",
        "status": "completed",
        "createdAt": "2025-01-15T10:30:00Z",
        "updatedAt": "2025-01-15T10:30:05Z",
        "statusUpdatedAt": "2025-01-15T10:30:05Z",
        "canTransitionTo": []
      }
    ],
    "total": 100,
    "offset": 0,
    "limit": 20
  }
}

位址管理

管理常用收款位址

POST /v1/addresses

新增位址

儲存新位址

請求範例:

{
  "tronAddress": "TYour1Address2Here3...",
  "label": "主錢包",
  "isDefault": false
}

響應範例:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "主錢包",
    "isDefault": false,
    "usageCount": 0,
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
GET /v1/addresses

位址列表

取得儲存的位址列表

響應範例:

{
  "data": {
    "addresses": [
      {
        "id": 1,
        "tronAddress": "TYour1Address2Here3...",
        "label": "主錢包",
        "isDefault": true,
        "usageCount": 5,
        "lastUsedAt": "2025-01-15T10:30:00Z",
        "createdAt": "2025-01-01T00:00:00Z"
      }
    ],
    "total": 1
  }
}
GET /v1/addresses/:id

取得位址詳情

查詢單一位址資訊

響應範例:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "主錢包",
    "isDefault": true,
    "usageCount": 5,
    "lastUsedAt": "2025-01-15T10:30:00Z",
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
PUT /v1/addresses/:id/label

更新位址標籤

修改位址的備註標籤

請求範例:

{
  "label": "新標籤"
}

響應範例:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "新標籤",
    "isDefault": false,
    "usageCount": 3,
    "lastUsedAt": "2025-01-15T10:30:00Z",
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
PUT /v1/addresses/:id/default

設定預設位址

將指定位址設為預設收款位址

響應範例:

// HTTP 204 No Content
// 無響應體

成功時回傳狀態碼 204,無響應內容。
DELETE /v1/addresses/:id

刪除位址

刪除儲存的位址