Appearance
代币交易记录接口文档
接口信息
| 项目 | 说明 |
|---|---|
| 接口路径 | /api/v1/dex/coin/trades |
| 请求方法 | GET |
| 代理路径 | /serverproxy/api/v1/dex/coin/trades |
| 后端服务 | https://api.dev.topo.club |
| 认证方式 | Authorization: ApiKey <key> |
请求参数
Query 参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| network_id | string | 是 | 网络标识,前端自动注入。topo--164 或 aptos--2 |
| coinType | string | 是 | 要查询的代币完整 Coin Type,如 0x1::aptos_coin::AptosCoin |
| limit | number | 否 | 返回条数,默认 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 数组项字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| type | string | 交易方向:buy 或 sell(相对查询代币) |
| txDigest | string | 交易哈希 |
| eventSeq | number | 事件序号 |
| timestamp | number | 交易时间(秒级时间戳) |
| sender | string | 交易发起人地址 |
| poolId | string | 所属池子地址 |
| coinChanges | array | 代币变动列表(见下) |
| price | string | 成交价格 |
| usdValue | string | 成交 USD 价值 |
coinChanges 数组项字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| amount | string | 变动金额(原始值,未除精度) |
| coinType | string | 代币 Coin Type |
| balance | string | 用户变动后余额 |
| logo | string | 代币图标 URL,可能为 null |
| symbol | string | 代币符号 |
| decimals | number | 代币精度 |
| isApproximate | boolean | 金额是否为近似值 |
前端调用示例
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
注意事项
network_id由前端request()自动注入到 GET query 参数coinChanges数组通常包含两个元素(一进一出),金额为原始整数值,展示时需除以decimalstype字段表示相对于coinType指定代币的买卖方向nextPageCursor当前版本可能为 null,暂不支持分页翻页