Appearance
交易对列表接口文档
接口信息
| 项目 | 说明 |
|---|---|
| 接口路径 | /api/v1/dex/token-pairs |
| 请求方法 | GET |
| 代理路径 | /serverproxy/api/v1/dex/token-pairs |
| 后端服务 | https://api.dev.topo.club |
| 认证方式 | Authorization: ApiKey <key> |
请求参数
Query 参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| network_id | string | 是 | 网络标识,前端自动注入。topo--164 或 aptos--2 |
| limit | number | 否 | 返回条数,默认不限制 |
| offset | number | 否 | 偏移量,用于分页,从 0 开始 |
请求示例
bash
GET /serverproxy/api/v1/dex/token-pairs?network_id=topo--164&limit=20&offset=0
Authorization: ApiKey <key>响应数据结构
json
{
"code": 0,
"message": "Success",
"data": {
"pairList": [
{
"id": 1,
"poolAddress": "0x97a44641fc2e70f8d0c4b682b4f03a19b3415daeb84f4e1fdcfe8fb22354ba9",
"base": {
"coinType": "0x1::aptos_coin::AptosCoin",
"symbol": "APT",
"name": "Aptos",
"decimals": 8,
"logoURL": "https://...",
"isVerified": true,
"isNative": true
},
"quote": {
"coinType": "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::usdc::USDC",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"logoURL": "https://...",
"isVerified": true,
"isNative": false
},
"feePct": "0.05%",
"tvlUsd": "5200000.00",
"vol24hUsd": "820000.00",
"vol7dUsd": "5600000.00",
"change24h": "1.45",
"priceUsd": "2.1250",
"price": "2.1250"
}
]
},
"timestamp": 1745380000
}响应字段说明
pairList 数组项字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| id | number | 交易对 ID |
| poolAddress | string | 池子地址(链上 Object ID) |
| base | object | 基础代币信息(见 token 字段说明) |
| quote | object | 计价代币信息 |
| feePct | string | 手续费百分比,如 "0.05%" |
| tvlUsd | string | 总锁仓量(美元,字符串格式) |
| vol24hUsd | string | 24h 交易量(美元) |
| vol7dUsd | string | 7 天交易量(美元) |
| change24h | string | 24h 价格变化(百分比,正涨负跌) |
| priceUsd | string | 当前 USD 价格 |
| price | string | 当前价格(quote 计价) |
base/quote token 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| coinType | string | 代币完整 Coin Type |
| symbol | string | 代币符号 |
| name | string | 代币名称 |
| decimals | number | 精度 |
| logoURL | string | 图标 URL,可能为空 |
| isVerified | boolean | 是否已验证 |
| isNative | boolean | 是否为原生代币 |
前端调用示例
typescript
import { fetchDexTokenPairs } from '@/lib/request/api'
const result = await fetchDexTokenPairs({ limit: 20, offset: 0 })
const { pairList } = result.data对应 Hook:apps/web/hooks/use-token-pairs.ts
注意事项
network_id由前端request()自动注入tvlUsd、vol24hUsd等金额字段为字符串格式,展示时需格式化change24h为字符串格式数字,正数表示涨,负数表示跌logoURL可能为空,前端需做空值兼容并展示默认图标