Skip to content

代币交易记录接口文档 ​

接口信息 ​

项目说明
接口路径/api/v1/dex/coin/trades
请求方法GET
代理路径/serverproxy/api/v1/dex/coin/trades
后端服务https://api.dev.topo.club
认证方式Authorization: ApiKey <key>

请求参数 ​

Query 参数 ​

参数名类型必填说明
network_idstring是网络标识,前端自动注入。topo--164 或 aptos--2
coinTypestring是要查询的代币完整 Coin Type,如 0x1::aptos_coin::AptosCoin
limitnumber否返回条数,默认 50

请求示例 ​

bash
GET /serverproxy/api/v1/dex/coin/trades?network_id=topo--164&coinType=0x1::aptos_coin::AptosCoin&limit=20
Authorization: ApiKey <key>

响应数据结构 ​

json
{
  "code": 0,
  "message": "Success",
  "data": {
    "tx_records": [
      {
        "type": "buy",
        "txDigest": "0xabc123...",
        "eventSeq": 0,
        "timestamp": 1745380000,
        "sender": "0x4c25640a...",
        "poolId": "0x97a44641...",
        "coinChanges": [
          {
            "amount": "1000000000",
            "coinType": "0x1::aptos_coin::AptosCoin",
            "balance": "5000000000",
            "logo": "https://...",
            "symbol": "APT",
            "decimals": 8,
            "isApproximate": false
          },
          {
            "amount": "2125000",
            "coinType": "0x83556891...::usdc::USDC",
            "balance": "10000000",
            "logo": "https://...",
            "symbol": "USDC",
            "decimals": 6,
            "isApproximate": false
          }
        ],
        "price": "2.1250",
        "usdValue": "21.25"
      }
    ],
    "nextPageCursor": null
  },
  "timestamp": 1745380000
}

响应字段说明 ​

tx_records 数组项字段 ​

字段名类型说明
typestring交易方向:buy 或 sell(相对查询代币)
txDigeststring交易哈希
eventSeqnumber事件序号
timestampnumber交易时间(秒级时间戳)
senderstring交易发起人地址
poolIdstring所属池子地址
coinChangesarray代币变动列表(见下)
pricestring成交价格
usdValuestring成交 USD 价值

coinChanges 数组项字段 ​

字段名类型说明
amountstring变动金额(原始值,未除精度)
coinTypestring代币 Coin Type
balancestring用户变动后余额
logostring代币图标 URL,可能为 null
symbolstring代币符号
decimalsnumber代币精度
isApproximateboolean金额是否为近似值

前端调用示例 ​

typescript
import { fetchDexCoinTrades } from '@/lib/request/api'

const result = await fetchDexCoinTrades({
  coinType: '0x1::aptos_coin::AptosCoin',
  limit: 20,
})

const { tx_records } = result.data

对应 Hook:apps/web/hooks/use-coin-trades.ts

注意事项 ​

  1. network_id 由前端 request() 自动注入到 GET query 参数
  2. coinChanges 数组通常包含两个元素(一进一出),金额为原始整数值,展示时需除以 decimals
  3. type 字段表示相对于 coinType 指定代币的买卖方向
  4. nextPageCursor 当前版本可能为 null,暂不支持分页翻页