Skip to content

限价单历史接口文档 ​

接口信息 ​

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

接口返回指定用户的所有限价单数据,包括当前开仓订单和历史订单,不分页。

请求参数 ​

Query 参数 ​

参数名类型必填说明
network_idstring是网络标识,前端自动注入。topo--164 或 aptos--2
wallet_addressstring是用户钱包地址

请求示例 ​

bash
GET /serverproxy/api/v1/dex/order/limit_order?network_id=topo--164&wallet_address=0x4c25640a96e3b098dcce10bfec9c0a80d7bd38270803d72d3f27f9e871cb5055
Authorization: ApiKey <key>

响应数据结构 ​

json
{
  "code": 0,
  "message": "Success",
  "data": {
    "tx_list": [
      {
        "type": "partially_filled",
        "tx": "0xabc123...",
        "package_id": "0xbcc9eca2...",
        "event_type": "0xbcc9eca2...::multi_order_book::OrderExecutedEvent",
        "sender": "0x4c25640a...",
        "block_time": 1745380000000,
        "order_id": "1001",
        "owner": "0x4c25640a...",
        "pay_coin": "0x1::aptos_coin::AptosCoin",
        "target_coin": "0x83556891...::usdc::USDC",
        "total_pay_amount": "1000000000",
        "rate": "2.1250",
        "expire_ts": 1745466400000,
        "remaining_amount": "500000000",
        "cancel_reason": 0,
        "side": "buy",
        "token_x": "0x1::aptos_coin::AptosCoin",
        "events": [
          {
            "event_type": "0xbcc9eca2...::multi_order_book::OrderExecutedEvent",
            "event_kind": "executed",
            "txHash": "0xdef456...",
            "sender": "0x4c25640a...",
            "block_time": 1745380100000,
            "amount_x": "500000000",
            "amount_filled": "500000000",
            "amount_out": "1062500000",
            "remaining": "500000000",
            "refunded_amount": "0",
            "cancel_reason": 0
          }
        ]
      }
    ],
    "total": 1,
    "page": 1,
    "page_size": 100
  },
  "timestamp": 1745380000
}

响应字段说明 ​

tx_list 数组项字段 ​

字段名类型说明
typestring订单状态类型:pending、completed、partially_filled、cancelled、expired
txstring创建交易哈希
package_idstring合约部署地址
event_typestring顶层归属事件类型,如 OrderCreatedEvent、OrderExecutedEvent、OrderCancelledEvent
senderstring下单用户地址
block_timenumber区块时间(毫秒级时间戳)
order_idstring订单 ID
ownerstring订单所有者地址
pay_coinstring支付代币的 Coin Type
target_coinstring目标代币的 Coin Type
total_pay_amountstring总支付金额(原始值,未除精度)
ratestring限价汇率(pay_coin / target_coin)
expire_tsnumber过期时间戳(毫秒)
remaining_amountstring剩余未成交金额
cancel_reasonnumber取消原因:0 = 未取消,其他值见合约定义
sidestring方向:buy 或 sell
token_xstring参考 Token(X 侧)的 Coin Type
eventsarray该订单关联的事件列表(见下)

events 数组项字段 ​

字段名类型说明
event_typestring事件类型
event_kindstring事件种类,如 placed、executed、cancelled
txHashstring触发该事件的交易哈希
senderstring触发者地址
block_timenumber区块时间(毫秒)
amount_xstringX 侧金额
amount_filledstring已成交金额
amount_outstring输出金额
remainingstring剩余未成交金额
refunded_amountstring退款金额
cancel_reasonnumber取消原因代码

前端调用示例 ​

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

const result = await fetchDexLimitOrders({
  wallet_address: '0x4c25640a96e3b098dcce10bfec9c0a80d7bd38270803d72d3f27f9e871cb5055',
})

const { tx_list } = result.data

对应 Hook:apps/web/hooks/use-limit-orders.ts

注意事项 ​

  1. network_id 由前端 request() 自动注入到 GET query 参数
  2. 接口返回该用户全量限价单,无需分页参数
  3. total_pay_amount、remaining_amount 为原始链上整数值,展示时需除以代币精度
  4. expire_ts = 0 表示永不过期