写操作(45 Action)
统一入口:
POST /api/v1/action· JSON-RPC 2.0 · 禁止 batch 所有数值字段在action内走 canonical decimal string(ADR-0026 §D) method 必须与签名 envelope 内 Action tag 一致
目录
- 1. 请求格式
- 2. 签名算法
- 3. EIP-712 签名通道
- 4. 响应格式
- 5. 交易
- 6. 批量交易
- 7. 保证金管理
- 8. 清算
- 9. 预言机报价
- 10. 市场管理
- 11. Bridge 充提
- 12. 账户管理
- 13. 手续费与推荐
- 14. 高级订单(触发单 / OCO)
- 15. MarketConfigWire schema
- 16. Action payload 速查(45 个)
- 17. 逐 Action 请求 / 响应示例(45 个)
1. 请求格式
{
"jsonrpc": "2.0",
"id": 1,
"method": "PlaceOrder",
"params": {
"envelope": {
"chain_id": 1,
"domain_chain_id": 1,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [95, 83, 94, "..."]
}
},
"action": {
"PlaceOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97100.00",
"qty": "1.00000",
"tif": "Gtc",
"client_order_id": "my-cloid-1",
"reduce_only": false
}
}
}
}
}
安全约束:method(JSON-RPC 外层)必须等于 params.envelope.action 的变体名(如 "PlaceOrder"),否则返回 -32602。分发权威永远是签名后的 envelope.action,method 不进签名摘要。
1.1 Action 中的数值格式
所有数值字段在 action 内均使用 canonical decimal string:
| 语义 | 精度 | 示例 |
|---|---|---|
| 价格(limit_price / trigger_price / mark_price 等) | 市场 price_decimals | "97100.00" |
| 数量(qty / amount) | 市场 size_decimals | "1.50000" |
| 余额 / 保证金 / 费率 / 名义值 | SCALE_6 | "5000.000000" |
2. 签名算法
2.1 L1 通道(41 个交易/管理操作)
适用于除 WithdrawRequest / RegisterAgent / RevokeAgent 外的全部 Action(含 SetMarginMode / SetLeverage / PlaceOrder 等)。
L1 通道使用 phantom EIP-712 类型 L1Action(string source,bytes32 connectionId)。服务端不生成、不持有 typed data JSON——签名端自行按以下原语重建 digest,再对 digest 做 secp256k1 签名。
禁止:用钱包
eth_signTypedData_v4以 Action 名(如SetMarginMode)为primaryType签名。那是 User-Signed 三操作专用形态;L1 错签会导致 recover 地址对不上 → 常报AgentNotRegistered。详见 签名与鉴权。
所需参数:
| 参数 | Auroran 生产 | 说明 |
|---|---|---|
chain_id | 42 | envelope.chain_id(auth 校验) |
domain_chain_id | 42 | 须与 chain_id 相同;L1 EIP-712 domain chainId = 此值(验签与 txid 均使用) |
network_tag | "zepto-dev" | L1 phantom L1Action.source(UTF-8,区分大小写) |
nonce | 自 getAccount 起单调分配;链上允许窗口内乱序(见 做市商对接指南 §4) | |
action | 业务构造 | externally-tagged JSON → msgpack 签名 |
完整环境表见 签名与鉴权 §2。
Step 1 — msgpack 序列化 action 并计算 connectionId:
msgpack_bytes = rmp_serde::to_vec_named(&action)
connectionId = keccak256(msgpack_bytes || nonce.to_be_bytes(8))
msgpack 编码细节(rmp_serde named-map 模式,确定性保证):
i128→ msgpack integer(定长)Option::None→ msgpacknil- Enum → msgpack map(外部 tag,key=变体名字符串,value=内层 map)
Address20→ 20 字节 bin- String/str → msgpack str
- bool → msgpack bool
- u32/u64 → 对应 msgpack integer
关键:action 序列化必须使用 msgpack(
rmp_serde::to_vec_named),而非 JSON。msgpack canonical 字节即协议,golden 锁定、跨语言可复现。使用 JSON 序列化将导致签名验证失败。
Step 2 — 构建 EIP-712 domain separator:
typeHash_domain = keccak256(b"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
domain = keccak256(
typeHash_domain
|| keccak256(b"ZeptoSignTransaction") // enc_string("ZeptoSignTransaction")
|| keccak256(b"1") // enc_string("1")
|| pad32(domain_chain_id.to_be_bytes()) // enc_uint(domain_chain_id);L1 须 == chain_id
|| pad32_left([0u8; 20]) // enc_address(0x0000...0000)
)
Step 3 — 构建 L1Action struct hash:
typeHash_l1 = keccak256(b"L1Action(string source,bytes32 connectionId)")
struct_hash = keccak256(
typeHash_l1
|| keccak256(network_tag.as_bytes()) // enc_string(network_tag)
|| connectionId // enc_bytes32(connectionId)
)
Step 4 — EIP-712 最终摘要:
digest = keccak256(0x19 || 0x01 || domain || struct_hash)
Step 5 — 签名:
对 32 字节 digest 做 secp256k1 recoverable 签名(v ∈ {27, 28}),得到 65 字节 [r_0..r_31, s_0..s_31, v](即 r || s || v,与 ethers / eth_signTypedData_v4 输出一致)。填入 credential.Secp256k1.signature(JSON 字节数组)。
2.2 EIP-712 通道(3 个敏感操作)
适用于 WithdrawRequest / RegisterAgent / RevokeAgent。详见 §3。
由钱包 eth_signTypedData_v4 直接处理 EIP-712 签名。domain 的 chainId = envelope.domain_chain_id(钱包 EVM 链 ID);envelope.chain_id 仍为 Zepto 链 ID(生产 42)。primary type 按 Action 不同。签名结果仍是 65 字节 secp256k1,填入 credential.Secp256k1.signature(JSON 字节数组)。
3. EIP-712 签名通道
三种敏感操作走 EIP-712 typed data 签名通道。钱包通过 eth_signTypedData_v4 对结构化数据进行签名。
3.1 Domain
所有 User-Signed 操作共用同一 EIP-712 domain。chainId 取 domain_chain_id(即用户钱包当前连接的 EVM 网络 ID,如 Ethereum Mainnet=1、BSC=56),确保钱包签名时不报 chainId 不匹配:
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
]
},
"domain": {
"name": "ZeptoSignTransaction",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
}
}
| 域字段 | 值 | 说明 |
|---|---|---|
name | "ZeptoSignTransaction" | 固定 |
version | "1" | Domain 版本 |
chainId | envelope.domain_chain_id | User-Signed = 钱包 EVM 链 ID;L1 = 须等于 chain_id(生产 42) |
verifyingContract | 0x0000...0000 | 零地址(链上无验证合约) |
3.2 WithdrawRequest
Primary type: Withdraw(string zeptoChain,address owner,string amount,string chain,uint64 nonce)
| 字段 | 类型 | 说明 |
|---|---|---|
zeptoChain | string | 链标识(如 "Mainnet"),密码学绑定防跨链 |
owner | address | 提现账户地址 |
amount | string | 提现金额 canonical 小数串(SCALE_6,如 "100.500000") |
chain | string | 用户选择的下提目标链(如 "bsc"),密码学绑定防跨链重放 |
nonce | uint64 | 账户 nonce |
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"Withdraw": [
{ "name": "zeptoChain", "type": "string" },
{ "name": "owner", "type": "address" },
{ "name": "amount", "type": "string" },
{ "name": "chain", "type": "string" },
{ "name": "nonce", "type": "uint64" }
]
},
"primaryType": "Withdraw",
"domain": {
"name": "ZeptoSignTransaction",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"zeptoChain": "Mainnet",
"owner": "0x1111222233334444555566667777888899990000",
"amount": "100.500000",
"chain": "bsc",
"nonce": 42
}
}
3.3 RegisterAgent
Primary type: RegisterAgent(string zeptoChain,address owner,address agentAddress,uint64 roleMask,uint64 expiresAtMs,uint64 nonce)
Auroran 生产:
zeptoChain/network_tag="zepto-dev";envelope.chain_id=42。下方 typed data 示例中domain.chainId演示 BSC 钱包(56)——须替换为对接方 master 钱包实际 EVM 链 ID,并写入envelope.domain_chain_id。
| 字段 | 类型 | 说明 |
|---|---|---|
zeptoChain | string | 链标识;Auroran 生产 "zepto-dev"(与 L1 network_tag 相同) |
owner | address | Master 账户地址 |
agentAddress | address | 被授权的 secp256k1 API-wallet 地址 |
roleMask | uint64 | 授予 agent 的角色位掩码(1 = Trader) |
expiresAtMs | uint64 | 过期时间(毫秒);0 = 永不过期 |
nonce | uint64 | 账户 nonce |
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"RegisterAgent": [
{ "name": "zeptoChain", "type": "string" },
{ "name": "owner", "type": "address" },
{ "name": "agentAddress", "type": "address" },
{ "name": "roleMask", "type": "uint64" },
{ "name": "expiresAtMs", "type": "uint64" },
{ "name": "nonce", "type": "uint64" }
]
},
"primaryType": "RegisterAgent",
"domain": {
"name": "ZeptoSignTransaction",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"zeptoChain": "Mainnet",
"owner": "0x1111222233334444555566667777888899990000",
"agentAddress": "0xaaaa111122223333444455556666777788889999",
"roleMask": 1,
"expiresAtMs": 0,
"nonce": 42
}
}
3.4 RevokeAgent
Primary type: RevokeAgent(string zeptoChain,address owner,address agentAddress,uint64 nonce)
| 字段 | 类型 | 说明 |
|---|---|---|
zeptoChain | string | 链标识;Auroran 生产 "zepto-dev"(与 L1 network_tag 相同) |
owner | address | Master 账户地址 |
agentAddress | address | 待撤销的 agent 地址 |
nonce | uint64 | 账户 nonce |
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" }
],
"RevokeAgent": [
{ "name": "zeptoChain", "type": "string" },
{ "name": "owner", "type": "address" },
{ "name": "agentAddress", "type": "address" },
{ "name": "nonce", "type": "uint64" }
]
},
"primaryType": "RevokeAgent",
"domain": {
"name": "ZeptoSignTransaction",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"zeptoChain": "Mainnet",
"owner": "0x1111222233334444555566667777888899990000",
"agentAddress": "0xaaaa111122223333444455556666777788889999",
"nonce": 42
}
}
3.5 字段编码约定
| EIP-712 类型 | 编码方式 | 对应 Rust 字段 |
|---|---|---|
string | keccak256(utf8_bytes) | String(zeptoChain、amount) |
address | 左补 12 零字节 → 32 字节 | Address20(owner、agentAddress) |
uint64 | 大端 8 字节,高位补零 → 32 字节 | u64(nonce、roleMask、expiresAtMs) |
4. 响应格式
4.1 成功(accepted)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0xa1b2...",
"height": 12346,
"envelope_idx": 3,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": { "PlaceOrder": { ... } },
"status": "accepted",
"events": [
{ "seq": 0, "block_height": 12346, "envelope_idx": 3,
"kind": { "Exec": { "OrderAccepted": { "order_id": 1001, "market_id": 1, ... } } } }
]
}
}
4.2 业务拒绝(kept-reject)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x...",
"height": 12346,
"envelope_idx": 0,
"signer": "0x...", "nonce": 43,
"action": { "PlaceOrder": { ... } },
"status": "kept-reject",
"reason": { "InsufficientBalance": { "required": 5000000000, "have": 3000000000 } },
"events": [{
"kind": { "Core": { "Rejected": { "action_kind": "PlaceOrder", "reason": { "InsufficientBalance": { "required": "5000.000000", "have": "3000.000000" } } } } }
}]
}
}
关键差异:
result.reason中的数值字段为 raw i128(如5000000000),未做 decimal 投影。同一笔交易result.events[]中的对应Rejected事件已经过 ADR-0026 投影为 decimal string(如"5000.000000")。对接方解析reason时须自行按精度转换。Cross 全仓开仓 / 加仓时InsufficientBalance.have为 trading 口径(含 Cross uPnL);reduce_only等场景不含 uPnL,见 §7.0。
4.3 响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
tx_hash | TxHash | 32 字节 hex,0x 前缀 |
height | u64 | 落块高度 |
envelope_idx | u32 | 块内序号 |
signer | Address20 | 签名者 master 地址 |
nonce | u64 | 本笔交易的 nonce |
action | Value | 原始 Action JSON |
status | TxStatus | "accepted" · "kept-reject" |
reason | RejectReason? | 仅 kept-reject;externally-tagged 枚举,数值为 raw i128 |
events | Value[] | 事件投影(数值字段为 decimal string) |
5. 交易
5.1 PlaceOrder
下单。limit_price 按价格精度、qty 按数量精度。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 下单账户地址 |
symbol | String | 是 | — | 交易对名,如 "BTC-USDT" |
side | Side | 是 | — | "Bid" 买 · "Ask" 卖 |
limit_price | String | 是 | px_decimals | 限价(decimal string) |
qty | String | 是 | sz_decimals | 下单数量(decimal string) |
tif | TimeInForce | 是 | — | "Gtc" · "Ioc" · "Fok" · "PostOnly" |
client_order_id | String? | 否 | — | 客户端订单 ID;建议 per (owner, symbol) 唯一,用于撤单 / getOrderStatus cloid 路径;WS 仅在 resting 帧回传 |
reduce_only | bool | 是 | — | 仅减仓(不增加净持仓方向);与 TIF 的组合见下表 |
expires_at_ms | u64? | 否 | — | GTD 过期时刻(毫秒);null = GTC 长挂 |
杠杆说明:
PlaceOrder不携带杠杆字段。杠杆是仓位的属性,通过SetLeverage设置。
reduce-only × TIF(只缩仓、不开仓、不翻仓):
| TIF | 可平量 / 盘口 | 结果 |
|---|---|---|
Gtc | 按可平量截成交;多出来的数量不挂簿 | 截断后的剩余若仍 crossing 则继续;否则仅挂可平残量 |
Ioc | 空簿或部分成交 | OrderDone(IocExpired),remaining = 原 qty − 已成交;不会留下幽灵挂单 |
Fok | 盘口不够但仍有可平量 | kept-reject FokRejected(result.reason / Core::Rejected) |
Fok | 仓位为 0 / 同向 / 可平量已为 0 | kept-reject ReduceOnlyWouldOpenOrFlip |
| 任意 | qty>0 但名义值截断为 0 | kept-reject DustNotionalFill |
ClosePosition 是 reduce_only + Ioc 的语法糖,空簿时同样以 IocExpired 结束。
Book B 成交价规则(与 Book A 的 maker/taker 语义对齐):
| 场景 | 用户角色 | 成交价 |
|---|---|---|
下单时已 crossing 当前 latest_quote | Taker(主动吃 oracle) | Oracle 对手价(bid/ask) |
| 先 passive 挂簿,后续 quote 扫簿 成交 | Maker(簿上 resting) | Maker 挂单价(oracle 价仅作 crossing 阈值) |
同一
limit_price可能因「即时 crossing」与「先挂后被扫」而得到不同成交价——前者走 taker/oracle 价,后者走 maker/簿价。与标准交易所一致。
保证金 admission(链上 kept-reject 口径,见 §7.0):
- Cross + 非 reduce_only:可用额 =
balance + Σ(Cross uPnL) − Σ(Cross IM 预占);浮盈可加仓,浮亏同步扣减。 - Cross + reduce_only:可用额 =
balance − Σ(Cross IM 预占)(不含 uPnL,避免浮亏挡住主动平仓)。 - Isolated:可用额 = 该市场
isolated_margin − position_im − open_orders_im(不含 uPnL、不含共享 balance)。 - 余额 / IM 不足 →
InsufficientBalance;reject 事件 / WS 中have为上述口径下的可用额(SCALE_6)。
5.2 CancelOrder
撤单。定位方式二选一。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 挂单账户地址 |
symbol | String | 条件 | cloid 路径必填;order_id 路径可省 |
order_id | u64 | 条件 | 系统订单 ID(与 client_order_id 互斥) |
client_order_id | String | 条件 | 客户端订单 ID(与 order_id 互斥,需同时提供 symbol) |
5.3 AmendOrder
改挂簿限价单。定位方式二选一(order_id / client_order_id)。所有 new_* 字段为选填——仅更新提供的字段。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 挂单账户地址 |
symbol | String | 是 | — | 交易对名 |
order_id | u64 | 条件 | — | 系统订单 ID(与 client_order_id 互斥) |
client_order_id | String | 条件 | — | 客户端订单 ID(与 order_id 互斥) |
new_limit_price | String? | 否 | px_decimals | 新限价 |
new_qty | String? | 否 | sz_decimals | 新总数量(含已成交部分);"0" 等价撤单 |
new_tif | TimeInForce? | 否 | — | 新 TIF |
new_reduce_only | bool? | 否 | — | 新 reduce_only |
适用范围:
- 仅 resting 限价挂单(Book A 与 Book B 本地 passive 簿均可)。
- 不含条件单(走 AmendTriggerOrder)、GTD 过期时刻(改单 wire 无
expires_at_ms字段)。
执行路径(Book A / Book B 共用分类规则):
| 变更类型 | 链上路径 | 说明 |
|---|---|---|
| 新总量 ≤ 已成交量 | 撤单 | new_qty: "0" 亦走此路径 |
| 仅减量,且限价 / TIF / reduce_only 不变 | 原地改单 | 保留队列优先级;调整 IM / prepaid maker fee |
| 改价、改 TIF、加量、或丢失时间优先级的 RO 变更 | 撤单 + 同 order_id 重挂 | 先 OrderDone,再 OrderAccepted(+ 可能立即成交) |
Book A 与 Book B 差异:
- 分类与 in-place 改单:规则相同;Book B passive 单同样在 matcher 本地簿中 in-place 更新。
- 撤单 + 重挂时的成交:
- Book A:与新限价 crossing 时,按 CLOB 与其他用户挂单撮合。
- Book B:与新限价 crossing 当前
latest_quote时,按 oracle bid/ask 即时 taker 成交(与 PlaceOrder 一致);未成交量挂回本地簿,待后续 quote 扫簿(扫簿成交价 = maker 挂单价,与 Book A 一致;oracle 价仅作 crossing 阈值)。
- Book B 重挂路径若无可用 oracle 报价 →
QuoteNotAvailable(整笔 amend kept-reject,原单仍在)。 - 重挂时仍校验市场 lifecycle(
Active可开仓改单;Halted/DelistPending仅reduce_only=true可重挂),与下单相同。
约束:
- 至少一个
new_*与现值不同,否则 →AmendNoChange。 - 目标单非 resting →
AmendOrderNotResting。 order_id与client_order_id须二选一且合法,否则 →OrderTargetInvalid。- 非 owner →
CancelOwnerMismatch。 - 市场
emergency_halt→MarketEmergencyHalt(改单与下单均拒)。 - in-place 加量时余额 / IM 不足 →
InsufficientBalance(Cross 非 reduce_only 时have含 Cross uPnL,见 §7.0)。
WS / 事件: in-place 成功主要 emit OrderResting。撤单 + 重挂可能依次出现 OrderDone → OrderAccepted →(若 crossing)Filled →(若仍有剩余)OrderResting;见 WebSocket §3.8。
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "AmendOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 56,
"action_version": 2,
"nonce": 37,
"signer": "0x0E13f20e288f502419cB4C29c6F1b62F9F036dbd",
"credential": { "Secp256k1": { "signature": "0x..." } },
"action": {
"AmendOrder": {
"owner": "0x0E13f20e288f502419cB4C29c6F1b62F9F036dbd",
"symbol": "BTC-USDT",
"order_id": 27,
"new_limit_price": "57000.0",
"new_qty": null,
"new_tif": null,
"new_reduce_only": null
}
}
}
}
}
L1 签名:
msgpack(action)必须与提交的envelope.action逐字节一致(含省略字段在服务端反序列化为null)。见 §2 签名算法。
5.4 MassCancel
批量撤单。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 挂单账户地址 |
symbol | String | 是 | 交易对名 |
scope | MassCancelScope | 是 | 撤销范围:"Owner"(全部) · {"Side":"Bid"}(按方向) · {"Ids":[1,2,3]}(按 ID 列表) |
5.5 ClosePosition
主动平仓(语法糖——构造 reduce_only + Ioc 的 PlaceOrder)。空簿时 OrderDone(IocExpired),见 §5.1。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 持仓账户地址 |
symbol | String | 是 | — | 交易对名 |
qty | String? | 否 | sz_decimals | 平仓数量;null = 全平 |
limit_price | String? | 否 | px_decimals | 限价;null = 市价 |
tif | TimeInForce? | 否 | — | TIF;null = Ioc |
client_order_id | String? | 否 | — | 客户端订单 ID |
5.6 ScheduleCancel
Dead-Man-Switch(断线全撤)。设置未来截止时刻,到期且未刷新则全市场全撤。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
trigger_time_ms | u64? | 是 | 截止时刻(毫秒);null = 关闭 DMS |
6. 批量交易
6.1 BatchPlaceOrder
一签多单。子项顺序执行、逐条回执,单条失败只回滚该子项并 emit BatchItemRejected。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
orders | PlaceOrderActionWire[] | 是 | 下单列表(每项字段同 PlaceOrder) |
6.2 BatchModify
一签多改单。子项顺序执行、逐条回执。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
modifies | AmendOrderActionWire[] | 是 | 改单列表(每项字段同 AmendOrder;含 Book B) |
子项执行规则与 AmendOrder §5.3 相同:单笔失败 emit BatchItemRejected 并 savepoint 回滚该条,后续子项继续;整笔 envelope 仍成功(parse 阶段错误如 SymbolNotFound 会导致 envelope kept-reject)。
6.3 批量子项上限
| Action | 上限 | 超限 |
|---|---|---|
BatchPlaceOrder | 128 笔 | envelope kept-reject · BatchSizeInvalid |
BatchModify | 无单独硬顶(建议 ≤128;受块内事件预算约束) | 子项 Rejected 或 EventBudgetExceeded |
BatchSubmitOracleQuote | 64 条 | BatchSizeInvalid |
BatchAmendTrigger | 128 条 | BatchSizeInvalid |
详见 做市商对接指南 §5.3 · 本页 §6.3。
7. 保证金管理
签名通道:L1(§2.1)。
SetLeverage/SetMarginMode/SetIsolatedMargin不是 User-Signed;勿构造primaryType: "SetMarginMode"等 typed data。完整步骤见 签名与鉴权 §5。
7.0 链上 admission 口径
链上 pre-trade gate(build_exec_plan / wallet_available / recalculate_leverage_ims)与读 API 展示字段不完全相同。集成下单 / 提现时请区分:
| 场景 | Cross | Isolated |
|---|---|---|
| 开仓 / 加仓 / 改单加量(非 reduce_only) | balance + cross_account_upnl − Σ(Cross IM) | isolated_margin − position_im − open_orders_im |
| reduce_only 平仓 / 改单 | balance − Σ(Cross IM)(不含 uPnL) | 同上(不含 uPnL) |
| WithdrawRequest 提现 | balance − Σ(Cross IM)(不含 uPnL) | 逐仓 IM 不计入共享 balance 锁定;提现仍只看 Cross 侧 available_balance |
| SetIsolatedMargin 划入(正 amount) | 从 available_balance 扣(不含 uPnL) | — |
| SetLeverage 重算 IM | 充足性 = Cross trading 口径(含 uPnL) | 充足性 = 逐仓 wallet(不含 uPnL) |
符号说明:
cross_account_upnl:仅累计margin_mode == Cross且size != 0的仓位,按各市场 mark 计价;mark == 0的市场贡献 0。Σ(Cross IM):open_orders_im + position_im,仅 Cross 市场;逐仓 IM 在isolated_margin中,不重复锁定共享 balance。- 清算 health(
Liquidategate)另用balance + cross_account_upnl(不扣 IM 预占)对比 MM——与 admission 不同,见 §8.1 Liquidate。 - 交易面板「强平价格 / 订单价值 / 预估占用」的字段公式见 下单预估与强平价。
读 API 的 withdrawable(getAccount §8.1)= max(0, account_value − total_margin_used),其中 account_value 含 uPnL——是展示用近似值,不能当作链上提现或 Cross 开仓的权威上限。
账户×市场偏好(margin_mode / leverage / isolated_margin)读回见 getMarketSettings §8.4(无链上记录时返回默认 Cross 壳)。
7.1 SetLeverage
L1 通道(§2.1)。设置某市场的杠杆倍数。修改后自动重算所有保证金,不足则拒(Cross 按 §7.0 trading 口径含 uPnL;Isolated 只看该市场 isolated_margin)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
symbol | String | 是 | 交易对名 |
leverage | u32 | 是 | 杠杆倍数(1 ≤ leverage ≤ 市场 max_leverage) |
7.2 SetMarginMode
L1 通道(§2.1)。切换 Cross ↔ Isolated(须 flat + 无挂单)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
symbol | String | 是 | 交易对名 |
margin_mode | MarginMode | 是 | "Cross" · "Isolated" |
7.3 SetIsolatedMargin
L1 通道(§2.1)。逐仓保证金划入/划出。正 amount 从全仓 cash available_balance 划入(不含 uPnL,见 §7.0)。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 账户地址 |
symbol | String | 是 | — | 交易对名 |
amount | String | 是 | SCALE_6 | 金额(正=划入逐仓,负=划出回 balance) |
8. 清算
8.1 Liquidate
清算指定账户在指定市场的仓位。signer 须持 Liquidator 角色。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
target | Address20 | 是 | 被清算账户地址 |
symbol | String | 是 | 交易对名 |
9. 预言机报价
9.1 SubmitOracleQuote
提交 Book B 盘口报价。signer 须持 Quoter 角色。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
quoter | Address20 | 是 | — | 报价者地址 |
symbol | String | 是 | — | 交易对名 |
bid_price | String | 是 | px_decimals | 买一价 |
ask_price | String | 是 | px_decimals | 卖一价 |
mark_price | String | 是 | px_decimals | 标记价 |
source_ts_ms | u64 | 是 | — | 报价源时间戳(毫秒) |
last_price | String | 是 | px_decimals | 外部最新成交价 |
volume | String | 是 | sz_decimals | 外部成交量增量 |
时间校验(取代已删除的 sequence_id):
- 超前(提交时严格拒绝):
source_ts_ms - block_timestamp_ms > MAX_QUOTE_AHEAD_MS(链级常量 13_000ms)→ 拒QuoteSourceTooFuture。 未来时间戳在提交这一刻就被挡死,进不了状态,不会抬升last_quote_ts, 也不会掩盖块末 stale 自动暂停。 - 过期(提交时主动拒 + 块末被动兜底):
block_timestamp_ms - source_ts_ms > max_quote_lag_ms→ 提交时拒QuoteSourceTooStale;若报价已挂起,块末MarketHaltedQuoteStale自动暂停。 - 时间单调:
source_ts_ms不得早于上一笔被接受报价(>=放行,同一毫秒 顺序由入块顺序决定),否则拒QuoteTimeNotMonotonic。 - 另受
min_quote_interval_ms间隔约束。
9.2 BatchSubmitOracleQuote
一签多 quote。子项顺序执行、逐条回执。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
quotes | SubmitOracleQuoteActionWire[] | 是 | 报价列表(每项字段同 SubmitOracleQuote) |
10. 市场管理
全部 master-only(必须 master 直签,agent 一律拒)。
10.1 CreateMarket
创建市场。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
config | MarketConfigWire | 是 | 完整市场配置(详见 §15 MarketConfigWire schema) |
10.2 ActivateMarket / HaltMarket / ResumeMarket
市场生命周期操作。|| 参数 | 类型 | 必填 | 说明 |
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | String | 是 | 交易对名 |
market_id | u32 | 否 | 精确寻址;携带时优先于 symbol(重名 symbol 场景按 id 管理) |
ActivateMarket:Created → ActiveHaltMarket:Active → HaltedResumeMarket:Halted → Active
暂停分因(halt_reason):
HaltMarket标记halt_reason = "Admin"——管理员主动暂停,不受报价驱动 自动恢复;必须显式ResumeMarket(报价继续被接受并刷新,但不改变 lifecycle)。- 块末检测到报价过期(
lag > max_quote_lag_ms)自动暂停,标记halt_reason = "QuoteStale",发MarketHaltedQuoteStale;报价恢复新鲜后自动 恢复(MarketResumedAfterQuote),无需手动操作。 ResumeMarket恢复后halt_reason清空(null)。旧链升级前已暂停的市场halt_reason = null,语义等价于自动暂停(报价恢复后自愈)。
10.3 RequestDelist / CompleteDelist
下市操作。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | String | 是 | 交易对名 |
market_id | u32 | 否 | 精确寻址;携带时优先于 symbol |
RequestDelist:Active\|Halted → DelistPendingCompleteDelist:DelistPending → Delisted(强制清退残留持仓)- 寻址规则:
market_id优先;未携带时按symbol解析,且跳过已下架 (Delisted)市场——下架市场仅可经显式market_id访问。DelistPending不跳过(公告期仍需按 symbol 减仓 / 撤单 / 清算)。
10.4 CancelMarket
撤销未激活市场(master-only)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | String | 是 | 交易对名 |
market_id | u32 | 否 | 精确寻址;携带时优先于 symbol |
CancelMarket:仅Created → Delisted,直接封存(无 DelistPending 过渡期 / 清退流程; 发MarketCancelled+MarketLifecycleChanged事件)。RequestDelist/CompleteDelist对Created市场仍拒绝。
10.5 SetFeeRecipient
修改市场手续费接收账户。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | String | 是 | 交易对名 |
recipient | Address20 | 是 | 新的手续费接收账户地址 |
market_id | u32 | 否 | 精确寻址;携带时优先于 symbol |
10.6 AmendMarketConfig
运行时调整市场风险/费率参数。所有字段为选填——仅更新提供的字段。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
symbol | String | 是 | — | 交易对名 |
market_id | u32 | 否 | — | 精确寻址;携带时优先于 symbol |
max_leverage | u32? | 否 | — | 市场级最大杠杆 |
maker_fee_rate | String? | 否 | SCALE_6 | Maker 费率 |
taker_fee_rate | String? | 否 | SCALE_6 | Taker 费率 |
margin_table | MarginTierWire[]? | 否 | SCALE_6 | 保证金分层表(整表替换,须升序) |
mark_max_change_bps | u32? | 否 | — | mark 单次最大相对偏离(bps;0=不限制) |
10.7 SetEmergencyHalt
紧急熔断开关。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | String | 是 | 交易对名 |
halt | bool | 是 | true 熔断 · false 恢复 |
market_id | u32 | 否 | 精确寻址;携带时优先于 symbol |
11. Bridge 充提
11.1 RecordDeposit
登记链外到账单。signer 须持 SettlementOperator 角色。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
external_ref | Object | 是 | — | 外部链充值引用 { "chain": "bsc" | "admin" | ..., "seq": u64 } |
tx_hash | [u8;32]? | 否 | — | BSC 充值 tx_hash(JSON 序列化为字节数组) |
account | Address20 | 是 | — | 入账目标账户 |
amount | String | 是 | SCALE_6 | 充值金额(> 0) |
bsc_block | u64 | 是 | — | BSC 区块号(管理员补 0) |
bsc_ts | u64 | 是 | — | BSC 区块时间戳秒(管理员补 0) |
充值序号由链上自增分配(非外部传入)。external_ref 为去重键,同 (chain, seq) 重复提交将被拒绝。管理员充值使用 chain = "admin",同样参与去重。
11.2 CreditDeposit
对已登记的充值执行入账。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
seq | u64 | 是 | 待入账充值单的链上序号(= RecordDeposit 时分配的 seq,从 DepositRecorded 事件获取) |
11.3 WithdrawRequest
用户发起提现。User-Signed EIP-712 通道(见 §3.2)。
链上 gate:amount ≤ available_balance = balance − Σ(Cross IM 预占)(不含 uPnL;见 §7.0)。超出 → WithdrawAvailableInsufficient。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
zepto_chain | String | 是 | — | 链标识(如 "Mainnet"),密码学绑定 |
owner | Address20 | 是 | — | 提现账户地址 |
amount | String | 是 | SCALE_6 | 提现金额(> 0) |
chain | String | 是 | — | 用户选择的下提目标链(如 "bsc"),链外提款程序据此适配处理 |
EIP-712 签名包含 chain 字段,防止跨链重放。
11.4 WithdrawSettle
标记提现单已链下放款成功。signer 须持 SettlementOperator 角色。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
request_id | u64 | 是 | 提现请求 ID |
external_tx | Object | 是 | {"tx_hash": [u8;32], "bsc_block": u64, "bsc_ts": u64} |
11.5 WithdrawRefund
标记提现单退款。signer 须持 SettlementOperator 角色。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
request_id | u64 | 是 | 提现请求 ID |
reason_code | u8 | 是 | 退款原因码(操作员自定义) |
11.6 SetSettlementPaused
全局充提结算闸门。signer 须持 Admin 角色。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
paused | bool | 是 | true 暂停 · false 恢复 |
12. 账户管理
12.1 SetAccountRole
修改账户角色。Master-only。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
target | Address20 | 是 | 目标账户地址 |
role | AccountRole | 是 | 角色:"Trader"/"OracleOperator"/"SettlementOperator"/"Admin"/"Liquidator"/"Quoter" |
granted | bool | 是 | true 授予 · false 撤销 |
12.2 RegisterAgent
授权 API-wallet agent。User-Signed EIP-712 通道(见 §3.3)。Master-only。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
zepto_chain | String | 是 | 链标识(如 "Mainnet") |
owner | Address20 | 是 | Master 账户地址(须 = envelope.signer) |
agent_address | Address20 | 是 | 被授权的 secp256k1 API-wallet 地址 |
role_mask | u64 | 是 | 角色位掩码(须 ⊆ owner.role_mask) |
expires_at_ms | u64 | 是 | 过期时间(毫秒);0 = 永不过期 |
12.3 RevokeAgent
撤销已注册的 API-wallet agent。User-Signed EIP-712 通道(见 §3.4)。Master-only。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
zepto_chain | String | 是 | 链标识(如 "Mainnet") |
owner | Address20 | 是 | Master 账户地址(须 = envelope.signer) |
agent_address | Address20 | 是 | 待撤销的 agent 地址 |
13. 手续费与推荐
费率 vs 返佣: SetUserFeeRate 控制 maker/taker 费率(从成交名义值扣多少 fee);返佣(Layer ⑥.2)从已扣 fee 中再抽一定比例沿推荐链分发,二者正交。
返佣语义:
- 返佣池比例(Admin):
SetGlobalRebateRatio/SetAccountRebateRatio设置「下线成交时从 fee 中抽多少进返佣池」。生效值 = 邀请者的inviter_rebate_ratio_bps ?? global_rebate_ratio_bps(见getAccount/getExchangeConfig)。SetAccountRebateRatio的owner必须已RegisterReferrer。 - 池内拆分(邀请者):
SetInviterKeepRatio设置邀请者从返佣池中自留多少;余量回分给交易者本人。不要求先RegisterReferrer。 - 入账钱包: 返佣一律 credit 全仓
balance(即使该笔 fee 从逐仓isolated_margin扣除)。 - 无推荐关系: 候选返佣不发放,
fee_recipient仍收全额 fee(不销毁)。 - 成交事件: 实际分发时 emit
Core::RebatePaid(汇总)+ 成对Core::BalanceChanged{RebateToInviter/RebateToInvitee}(见 events.md §2)。 - 读侧对账: 无
getRebateHistory专用读方法。返佣明细通过getBlockEvents(或 WS 事件流)扫Core::RebatePaid;getUserFills的fee仅为 gross 扣款 fee,不含返佣池拆分。
推荐码格式(RegisterReferrer / SetReferrer 共用):长度 3–32,仅 ASCII 字母、数字、_、-。不满足 → ReferralCodeInvalid。
13.1 SetUserFeeRate
设置账户级自定义费率。signer 须持 Admin 角色。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 目标账户地址 |
maker_fee_rate | String? | 否 | SCALE_6 | Maker 费率;null = 清除(回退市场默认) |
taker_fee_rate | String? | 否 | SCALE_6 | Taker 费率;null = 清除(回退市场默认) |
13.2 SetReferrer
绑定推荐码。signer 须持 Trader 角色。每个账户只能绑定一次。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 被推荐人地址 |
code | String | 是 | 已注册的推荐码(不能自荐;格式见 §13 推荐码格式) |
拒因: ReferralSelf · ReferrerAlreadyBound · ReferralCodeNotFound · AccountNotFound · OwnerSignerMismatch(owner ≠ signer)
13.3 RegisterReferrer
注册自己的推荐码。signer 须持 Trader 角色。不要求先绑定他人推荐码;也不是 SetInviterKeepRatio 的前置条件。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 推荐人地址 |
code | String | 是 | 推荐码(全局唯一;格式见 §13 推荐码格式) |
拒因: ReferralCodeAlreadyRegistered · ReferralCodeInvalid · ReferralCodeAlreadyExists · AccountNotFound · OwnerSignerMismatch(owner ≠ signer)
13.4 SetGlobalRebateRatio
设置全局默认返佣比例。signer 须持 Admin 角色(Agent 持 Admin 亦可)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
ratio_bps | u32 | 是 | 返佣比例(bps,≤ 10 000;1 000 = 10 %) |
事件: Ops::GlobalRebateRatioChanged { old_ratio_bps, new_ratio_bps }
拒因: RebateRatioOutOfRange { ratio_bps }(ratio_bps > 10_000)
13.5 SetAccountRebateRatio
设置或清除邀请者返佣档位。signer 须持 Admin 角色。owner 须已注册推荐码(RegisterReferrer)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 已注册推荐码的邀请者地址 |
ratio_bps | u32? | 否 | 档位(bps,≤ 10 000;1 000 = 10 %);null = 清除(回退全局默认) |
事件: Ops::AccountRebateRatioChanged { owner, ratio_bps }
拒因: RebateRatioOutOfRange(非 null 且 > 10_000) · RebateRatioOwnerNotReferrer · AccountNotFound
13.6 SetInviterKeepRatio
邀请者自行设置返佣自留比例。signer 须持 Trader 角色。不要求先 RegisterReferrer;任意已存在账户均可预设自留比例,在后续被推荐人成交时生效。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 邀请者地址 |
ratio_bps | u32 | 是 | 自留比例(bps,≤ 10 000;10 000 = 100 % 自留) |
事件: Core::InviterKeepRatioChanged { owner, old_ratio_bps, new_ratio_bps }
拒因: InviterKeepRatioOutOfRange { ratio_bps }(ratio_bps > 10_000) · MissingAccountForInviterKeepRatio · OwnerSignerMismatch(owner ≠ signer)
返佣 Action payload 示例(L1 通道;完整 envelope 见 §2.1):
{ "SetGlobalRebateRatio": { "ratio_bps": 2000 } }
{ "SetAccountRebateRatio": { "owner": "0x1111222233334444555566667777888899990000", "ratio_bps": 6000 } }
{ "SetAccountRebateRatio": { "owner": "0x1111222233334444555566667777888899990000", "ratio_bps": null } }
{ "SetInviterKeepRatio": { "owner": "0x1111222233334444555566667777888899990000", "ratio_bps": 7000 } }
14. 高级订单(触发单 / OCO)
触发单与 OCO 走 L1 签名通道(§2.1),handler 在 zepto-triggers。
语义约束:
- 触发前不预扣 IM / 手续费;mark 满足触发条件时才走
PlaceOrder,余额不足 →TriggerFireFailed事件。 - 挂单时 mark 已满足触发方向 →
TriggerWouldExecuteImmediately(禁止「挂即触发」)。 - 单账户活跃触发单(含 OCO 腿)上限 256;超限 →
TriggerCountCapExceeded。 - OCO 两腿必须同一市场;跨市场 →
OcoCrossMarketUnsupported。
实时维护条件委托列表:订阅 WS triggerUpdates.{address}(见 websocket.md §3.9);getBootstrap 不含触发单/OCO。
14.1 PlaceTriggerOrder
提交独立触发单(stop-market / stop-limit / take-profit)。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 账户地址 |
symbol | String | 是 | — | 交易对名 |
trigger_price | String | 是 | px_decimals | 触发线(必须 > 0) |
trigger_direction | TriggerDirection | 是 | — | "Above" · "Below" |
payload | TriggerOrderPayloadWire | 是 | — | 触发后提交的订单(externally-tagged,见下) |
expires_at_ms | u64? | 否 | — | GTD 过期时刻(毫秒);null = 永不过期 |
TriggerOrderPayloadWire(payload 字段):
Market 变体 — 触发后以 IOC 市价吃穿:
| 字段 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
side | Side | 是 | — | "Bid" · "Ask" |
qty | String | 是 | sz_decimals | 下单数量 |
reduce_only | bool | 是 | — | 仅减仓 |
client_order_id | String? | 否 | — | 触发后产生的订单 cloid |
Limit 变体 — 触发后下限价单:
| 字段 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
side | Side | 是 | — | "Bid" · "Ask" |
limit_price | String | 是 | px_decimals | 限价 |
qty | String | 是 | sz_decimals | 下单数量 |
tif | TimeInForce | 是 | — | TIF |
reduce_only | bool | 是 | — | 仅减仓 |
client_order_id | String? | 否 | — | 触发后产生的订单 cloid |
请求示例(stop-limit):
{
"jsonrpc": "2.0",
"id": 1,
"method": "PlaceTriggerOrder",
"params": {
"envelope": {
"chain_id": 1,
"domain_chain_id": 1,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": { "Secp256k1": { "signature": [95, 83, 94, "..."] } },
"action": {
"PlaceTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"expires_at_ms": null,
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
}
}
}
}
}
}
请求示例(stop-market): 同上,将 payload 换为:
"payload": {
"Market": {
"side": "Ask",
"qty": "0.50000",
"reduce_only": true,
"client_order_id": "sl-mkt-1"
}
}
14.2 CancelTriggerOrder
撤销仍待触发的触发单。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
trigger_id | u64 | 是 | 触发单 ID |
不存在或非 owner → TriggerNotFound / TriggerOwnerMismatch。
14.3 AmendTriggerOrder
原地修改仍待触发的触发单(保持同一 trigger_id)。适用于 stop-market / stop-limit / take-profit 条件单改价改量;不 resolve OCO pair。
| 参数 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
owner | Address20 | 是 | — | 账户地址 |
trigger_id | u64 | 是 | — | 触发单 ID |
new_trigger_price | String? | 否 | px_decimals | 新触发线;省略 = 不变 |
new_qty | String? | 否 | sz_decimals | 新数量;省略 = 不变 |
new_limit_price | String? | 否 | px_decimals | 新限价(仅 Limit 载荷);省略 = 不变 |
new_tif | TimeInForce? | 否 | — | 新 TIF(仅 Limit 载荷);省略 = 不变 |
new_reduce_only | bool? | 否 | — | 新 reduce_only;省略 = 不变 |
new_expires_at_ms | u64? | 否 | — | GTD:省略 = 不变;JSON null = 清除 GTD;正整数 = 新过期时刻 |
约束:
- 至少一个
new_*字段与现值不同,否则 →AmendTriggerNoChange。 - Market 载荷传
new_limit_price/new_tif→AmendTriggerPayloadMismatch。 - 校验规则与 PlaceTriggerOrder 大部分相同;不含「挂即触发」检查(
TriggerWouldExecuteImmediately仅约束新挂单,改单时 mark 已越过触发线仍允许修改 qty/RO/limit/GTD/触发价)。
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "AmendTriggerOrder",
"params": {
"envelope": {
"chain_id": 1,
"domain_chain_id": 1,
"action_version": 2,
"nonce": 43,
"signer": "0x1111222233334444555566667777888899990000",
"credential": { "Secp256k1": { "signature": [95, 83, 94, "..."] } },
"action": {
"AmendTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001,
"new_trigger_price": "96000.00",
"new_qty": "0.30000",
"new_limit_price": null,
"new_tif": null,
"new_reduce_only": null,
"new_expires_at_ms": null
}
}
}
}
}
14.4 BatchAmendTrigger
一签批量改触发单(最多 128 笔)。每项字段同 AmendTriggerOrder;trigger_id 用于解析各腿市场精度。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
amends | AmendTriggerOrderActionWire[] | 是 | 改单列表 |
子项顺序执行、逐条回执(与 BatchModify 一致):单笔业务失败 emit Rejected,后续子项仍继续;整笔 envelope 仍成功(仅 parse 阶段错误如 TriggerNotFound / 精度非法会导致 envelope kept-reject)。
14.5 PlaceOco
原子提交 OCO 组合单:一腿成交/触发则另一腿自动撤销。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
execution | OcoExecutionWire | 是 | OCO 腿配置(externally-tagged,见下) |
client_pair_id | u64? | 否 | 客户端 OCO pair ID |
OcoExecutionWire(execution 字段):
TwoLimits — 两个限价单互斥:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
primary | OcoLimitLegWire | 是 | 主腿 |
secondary | OcoLimitLegWire | 是 | 副腿 |
StopAndLimit — 触发腿 + 即时挂簿限价腿(限价腿下单时预占挂簿 IM):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
stop_leg | StopTriggerLegWire | 是 | 触发腿(externally-tagged Market / Limit,见下) |
limit_leg | OcoLimitLegWire | 是 | 限价腿(立刻进入订单簿) |
TwoTriggers — 双触发 OCO(典型 TP/SL;两腿均为 trigger,下单不占挂簿 IM,触发后才走撮合 / 保证金校验):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
primary | StopTriggerLegWire | 是 | 主触发腿(如 stop-market 止损) |
secondary | StopTriggerLegWire | 是 | 副触发腿(如 stop-limit 止盈) |
产品建议:前端 TP/SL 面板优先使用
TwoTriggers;StopAndLimit保留给「止损 trigger + 提前挂簿止盈限价」场景。
OcoLimitLegWire(TwoLimits 两腿 / StopAndLimit.limit_leg 共用):
| 字段 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
symbol | String | 是 | — | 交易对名 |
side | Side | 是 | — | "Bid" · "Ask" |
limit_price | String | 是 | px_decimals | 限价 |
qty | String | 是 | sz_decimals | 数量 |
tif | TimeInForce | 是 | — | TIF |
reduce_only | bool | 是 | — | 仅减仓 |
client_order_id | String? | 否 | — | 客户端订单 ID |
expires_at_ms | u64? | 否 | — | GTD 过期时刻 |
StopTriggerLegWire(StopAndLimit.stop_leg / TwoTriggers 两腿,externally-tagged):
Market 变体 — stop-market 触发腿:
| 字段 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
symbol | String | 是 | — | 交易对名 |
side | Side | 是 | — | "Bid" · "Ask" |
qty | String | 是 | sz_decimals | 数量 |
trigger_price | String | 是 | px_decimals | 触发线 |
trigger_direction | TriggerDirection | 是 | — | "Above" · "Below" |
reduce_only | bool | 是 | — | 仅减仓 |
client_trigger_id | u64? | 否 | — | 客户端触发 ID |
expires_at_ms | u64? | 否 | — | GTD 过期时刻 |
Limit 变体 — stop-limit 触发腿(在 Market 字段基础上增加):
| 字段 | 类型 | 必填 | 精度 | 说明 |
|---|---|---|---|---|
limit_price | String | 是 | px_decimals | 触发后限价 |
limit_tif | TimeInForce | 是 | — | 触发后订单 TIF |
其余字段同 Market 变体(symbol / side / qty / trigger_price / trigger_direction / reduce_only / client_trigger_id? / expires_at_ms?)。
请求示例(StopAndLimit + stop-market):
{
"jsonrpc": "2.0",
"id": 2,
"method": "PlaceOco",
"params": {
"envelope": {
"chain_id": 1,
"domain_chain_id": 1,
"action_version": 2,
"nonce": 43,
"signer": "0x1111222233334444555566667777888899990000",
"credential": { "Secp256k1": { "signature": [95, 83, 94, "..."] } },
"action": {
"PlaceOco": {
"owner": "0x1111222233334444555566667777888899990000",
"client_pair_id": 100,
"execution": {
"StopAndLimit": {
"stop_leg": {
"Market": {
"symbol": "BTC-USDT",
"side": "Ask",
"qty": "0.50000",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"reduce_only": true
}
},
"limit_leg": {
"symbol": "BTC-USDT",
"side": "Ask",
"limit_price": "98000.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": false
}
}
}
}
}
}
}
}
请求示例(StopAndLimit + stop-limit): 将 stop_leg 换为:
"stop_leg": {
"Limit": {
"symbol": "BTC-USDT",
"side": "Ask",
"qty": "0.50000",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"limit_price": "94900.00",
"limit_tif": "Gtc",
"reduce_only": true
}
}
请求示例(TwoTriggers · 平空 TP/SL,不占挂簿 IM):
"execution": {
"TwoTriggers": {
"primary": {
"Market": {
"symbol": "BTC",
"side": "Bid",
"qty": "0.32054",
"trigger_price": "70000",
"trigger_direction": "Above",
"reduce_only": true
}
},
"secondary": {
"Limit": {
"symbol": "BTC",
"side": "Bid",
"qty": "0.32054",
"trigger_price": "60000",
"trigger_direction": "Below",
"limit_price": "60000",
"limit_tif": "Gtc",
"reduce_only": true
}
}
}
}
读侧 OCO 响应中 legs 的 wire 形态见 enums.md §6 OcoLegs。
14.6 CancelOco
撤销仍 Active 的 OCO 组合单。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
owner | Address20 | 是 | 账户地址 |
pair_id | u64 | 是 | OCO pair ID |
不存在 / 非 owner / 已 Resolved → OcoPairNotFound / OcoNotOwner / OcoAlreadyResolved。
15. MarketConfigWire schema
CreateMarket 的 config 字段类型,也用于 getMarket 响应中的 config。
| 字段 | 类型 | 精度 | 说明 |
|---|---|---|---|
symbol | String | — | 交易对名 |
kind | MarketKind | — | 见 MarketKind |
price_decimals | u32 | — | 价格小数位(MARK_PRICE_DECIMALS - size_decimals) |
size_decimals | u32 | — | 数量小数位 |
fee_recipient | Address20 | — | 手续费接收账户 |
max_leverage | u32 | — | 市场级最大杠杆 |
maker_fee_rate | String | SCALE_6 | Maker 手续费率 |
taker_fee_rate | String | SCALE_6 | Taker 手续费率 |
margin_table | MarginTierWire[] | SCALE_6 | 保证金分层表(见下) |
mark_max_change_bps | u32 | — | mark 单次最大偏离(bps;0=不限制) |
max_fills_per_quote | u32 | — | 每次报价最大成交笔数 |
price_floor | String | px_decimals | 价格下限 |
price_ceil | String | px_decimals | 价格上限 |
MarginTierWire(margin_table 的元素):
| 字段 | 类型 | 精度 | 说明 |
|---|---|---|---|
max_notional | String | SCALE_6 | 该 tier 的名义值上限(最后一个 tier 可为超大值表示无上限) |
im_rate | String | SCALE_6 | 初始保证金率 |
mm_rate | String | SCALE_6 | 维持保证金率 |
max_leverage | u32 | — | 该 tier 内的最大杠杆 |
16. Action payload 速查(45 个)
以下均为 params.envelope.action 内的 externally-tagged JSON(L1 通道除 §3 三例外)。完整 envelope 见 §1 / §2。
交易
{ "PlaceOrder": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "side": "Bid", "limit_price": "97100.00", "qty": "1.00000", "tif": "Gtc", "client_order_id": "my-cloid-1", "reduce_only": false, "expires_at_ms": null } }
{ "CancelOrder": { "owner": "0x1111...0000", "symbol": null, "order_id": 1001, "client_order_id": null } }
{ "AmendOrder": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "order_id": 1001, "new_limit_price": "97200.00", "new_qty": null, "new_tif": null, "new_reduce_only": null } }
{ "MassCancel": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "scope": "Owner" } }
{ "MassCancel": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "scope": { "Side": "Bid" } } }
{ "MassCancel": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "scope": { "Ids": [1001, 1002] } } }
{ "ClosePosition": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "qty": null, "limit_price": null, "tif": null, "client_order_id": "close-1" } }
{ "ScheduleCancel": { "owner": "0x1111...0000", "trigger_time_ms": 1717203600000 } }
批量
{ "BatchPlaceOrder": { "orders": [{ "owner": "0x1111...0000", "symbol": "BTC-USDT", "side": "Bid", "limit_price": "97100.00", "qty": "0.50000", "tif": "Gtc", "client_order_id": null, "reduce_only": false, "expires_at_ms": null }] } }
{ "BatchModify": { "modifies": [{ "owner": "0x1111...0000", "symbol": "BTC-USDT", "order_id": 1001, "new_limit_price": "97200.00", "new_qty": null, "new_tif": null, "new_reduce_only": null }] } }
保证金
{ "SetLeverage": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "leverage": 10 } }
{ "SetMarginMode": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "margin_mode": "Isolated" } }
{ "SetIsolatedMargin": { "owner": "0x1111...0000", "symbol": "BTC-USDT", "amount": "5000.000000" } }
清算 / 预言机
{ "Liquidate": { "target": "0x3333...2222", "symbol": "BTC-USDT" } }
{ "SubmitOracleQuote": { "quoter": "0x4444...3333", "symbol": "BTC-USDT", "bid_price": "97100.00", "ask_price": "97300.00", "mark_price": "97200.00", "source_ts_ms": 1717200000000, "last_price": "97234.50", "volume": "1.50000" } }
{ "BatchSubmitOracleQuote": { "quotes": [{ "quoter": "0x4444...3333", "symbol": "BTC-USDT", "bid_price": "97100.00", "ask_price": "97300.00", "mark_price": "97200.00", "source_ts_ms": 1717200000000, "last_price": "97234.50", "volume": "1.50000" }] } }
市场管理
{ "CreateMarket": { "config": { "symbol": "ETH-USDT", "kind": "Native", "price_decimals": 2, "size_decimals": 4, "fee_recipient": "0x2222...1111", "max_leverage": 50, "maker_fee_rate": "0.000200", "taker_fee_rate": "0.000500", "margin_table": [{ "max_notional": "1000000.000000", "im_rate": "0.020000", "mm_rate": "0.010000", "max_leverage": 50 }], "mark_max_change_bps": 500, "max_fills_per_quote": 32, "price_floor": "0.01", "price_ceil": "100000.00" } } }
{ "ActivateMarket": { "symbol": "ETH-USDT", "market_id": 2 } }
{ "HaltMarket": { "symbol": "ETH-USDT", "market_id": null } }
{ "ResumeMarket": { "symbol": "ETH-USDT" } }
{ "RequestDelist": { "symbol": "ETH-USDT" } }
{ "CompleteDelist": { "symbol": "ETH-USDT" } }
{ "CancelMarket": { "symbol": "BTC-USDT", "market_id": 1 } }
{ "SetFeeRecipient": { "symbol": "BTC-USDT", "recipient": "0x2222...1111", "market_id": 1 } }
{ "AmendMarketConfig": { "symbol": "BTC-USDT", "market_id": 1, "max_leverage": 25, "maker_fee_rate": null, "taker_fee_rate": "0.000600", "margin_table": null, "mark_max_change_bps": null } }
{ "SetEmergencyHalt": { "symbol": "BTC-USDT", "halt": true, "market_id": 1 } }
Bridge
{ "RecordDeposit": { "external_ref": { "chain": "bsc", "seq": 50001 }, "tx_hash": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], "account": "0x1111...0000", "amount": "1000.000000", "bsc_block": 12345678, "bsc_ts": 1717200000 } }
{ "CreditDeposit": { "seq": 101 } }
{ "WithdrawRequest": { "zepto_chain": "Mainnet", "owner": "0x1111...0000", "amount": "500.000000", "chain": "bsc" } }
{ "WithdrawSettle": { "request_id": 2001, "external_tx": { "tx_hash": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], "bsc_block": 12345700, "bsc_ts": 1717200100 } } }
{ "WithdrawRefund": { "request_id": 2001, "reason_code": 1 } }
{ "SetSettlementPaused": { "paused": true } }
账户 / 费率 / 推荐
{ "SetAccountRole": { "target": "0x3333...2222", "role": "Liquidator", "granted": true } }
EIP-712 通道见 §3.3 RegisterAgent / §3.4 RevokeAgent。
{ "SetUserFeeRate": { "owner": "0x1111...0000", "maker_fee_rate": "0.000100", "taker_fee_rate": null } }
{ "SetReferrer": { "owner": "0x1111...0000", "code": "ALICE-001" } }
{ "RegisterReferrer": { "owner": "0x1111...0000", "code": "BOB-TRADE" } }
返佣 Action 见 §13。
触发单 / OCO
完整 envelope 见 §14.1 PlaceTriggerOrder / §14.3 AmendTriggerOrder / §14.5 PlaceOco。
{ "CancelTriggerOrder": { "owner": "0x1111...0000", "trigger_id": 7001 } }
{ "BatchAmendTrigger": { "amends": [{ "owner": "0x1111...0000", "trigger_id": 7001, "new_trigger_price": "96000.00", "new_qty": null, "new_limit_price": null, "new_tif": null, "new_reduce_only": null, "new_expires_at_ms": null }] } }
{ "CancelOco": { "owner": "0x1111...0000", "pair_id": 8001 } }
17. 逐 Action 请求 / 响应示例(45 个)
每个 Action 给出完整请求(JSON-RPC envelope)与 accepted 响应示例。事件仅列主事件; 同一 Action 可能产生多个事件(如
PlaceOrder可能继续OrderResting/Filled),完整事件域见 events.md。credential.signature为 secp256k1 签名(示例截断);tx_hash为占位。 EIP-712 通道(WithdrawRequest/RegisterAgent/RevokeAgent)的签名构造见 §3, 本例展示 envelope 提交形态。
17.1 PlaceOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "PlaceOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"PlaceOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97100.00",
"qty": "1.00000",
"tif": "Gtc",
"client_order_id": "my-cloid-1",
"reduce_only": false,
"expires_at_ms": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"PlaceOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97100.00",
"qty": "1.00000",
"tif": "Gtc",
"client_order_id": "my-cloid-1",
"reduce_only": false,
"expires_at_ms": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderAccepted": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"side": "Bid",
"limit_price": "97100.00",
"qty": "1.00000",
"tif": "Gtc"
}
}
}
}
]
}
}
17.2 CancelOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CancelOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CancelOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"client_order_id": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CancelOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"client_order_id": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderDone": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"reason": "Cancelled",
"remaining": "1.00000"
}
}
}
}
]
}
}
17.3 AmendOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "AmendOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"AmendOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"new_limit_price": "97200.00",
"new_qty": null,
"new_tif": null,
"new_reduce_only": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"AmendOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"new_limit_price": "97200.00",
"new_qty": null,
"new_tif": null,
"new_reduce_only": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderResting": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"resting": {
"price": "97200.00",
"qty": "1.00000",
"remaining": "1.00000",
"im_reserved": "1000.000000",
"prepaid_maker_fee": "0.000000"
}
}
}
}
}
]
}
}
17.4 MassCancel
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "MassCancel",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"MassCancel": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"scope": "Owner"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"MassCancel": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"scope": "Owner"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderDone": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"reason": "Cancelled",
"remaining": "0.50000"
}
}
}
}
]
}
}
17.5 ClosePosition
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "ClosePosition",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"ClosePosition": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"qty": null,
"limit_price": null,
"tif": null,
"client_order_id": "close-1"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"ClosePosition": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"qty": null,
"limit_price": null,
"tif": null,
"client_order_id": "close-1"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"Filled": {
"taker_order_id": 1001,
"maker_order_id": 1002,
"market_id": 1,
"taker_owner": "0x1111222233334444555566667777888899990000",
"maker_owner": "0x2222333344445555666677778888999900001111",
"price": "97000.00",
"qty": "0.50000",
"notional": "48500.000000",
"taker_fee": "24.250000",
"maker_fee": "-4.850000",
"aggressor_side": "Bid"
}
}
}
}
]
}
}
17.6 ScheduleCancel
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "ScheduleCancel",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"ScheduleCancel": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_time_ms": 1717203600000
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"ScheduleCancel": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_time_ms": 1717203600000
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Core": {
"DeadMansSwitchScheduled": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_time_ms": 1717203600000
}
}
}
}
]
}
}
17.7 BatchPlaceOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "BatchPlaceOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"BatchPlaceOrder": {
"orders": [
{
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97100.00",
"qty": "0.50000",
"tif": "Gtc",
"client_order_id": null,
"reduce_only": false,
"expires_at_ms": null
}
]
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"BatchPlaceOrder": {
"orders": [
{
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97100.00",
"qty": "0.50000",
"tif": "Gtc",
"client_order_id": null,
"reduce_only": false,
"expires_at_ms": null
}
]
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderAccepted": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"side": "Bid",
"limit_price": "97100.00",
"qty": "0.50000",
"tif": "Gtc"
}
}
}
}
]
}
}
17.8 BatchModify
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "BatchModify",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"BatchModify": {
"modifies": [
{
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"new_limit_price": "97200.00",
"new_qty": null,
"new_tif": null,
"new_reduce_only": null
}
]
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"BatchModify": {
"modifies": [
{
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"order_id": 1001,
"new_limit_price": "97200.00",
"new_qty": null,
"new_tif": null,
"new_reduce_only": null
}
]
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OrderResting": {
"order_id": 1001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"resting": {
"price": "97200.00",
"qty": "1.00000",
"remaining": "1.00000",
"im_reserved": "1000.000000",
"prepaid_maker_fee": "0.000000"
}
}
}
}
}
]
}
}
17.9 SetLeverage
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetLeverage",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetLeverage": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"leverage": 10
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetLeverage": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"leverage": 10
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"LeverageUpdated": {
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"leverage": 10
}
}
}
}
]
}
}
17.10 SetMarginMode
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetMarginMode",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetMarginMode": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"margin_mode": "Isolated"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetMarginMode": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"margin_mode": "Isolated"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"MarginModeUpdated": {
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"margin_mode": "Isolated"
}
}
}
}
]
}
}
17.11 SetIsolatedMargin
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetIsolatedMargin",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetIsolatedMargin": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"amount": "5000.000000"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetIsolatedMargin": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"amount": "5000.000000"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"IsolatedMarginUpdated": {
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"new_isolated_margin": "5000.000000"
}
}
}
}
]
}
}
17.12 Liquidate
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "Liquidate",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"Liquidate": {
"target": "0x33334444555566667777888899990000aaaa1111",
"symbol": "BTC-USDT"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"Liquidate": {
"target": "0x33334444555566667777888899990000aaaa1111",
"symbol": "BTC-USDT"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Liquidation": {
"Liquidated": {
"target": "0x33334444555566667777888899990000aaaa1111",
"market_id": 1,
"closed_via_book": "0.50000",
"force_closed_at_mark": "0",
"total_realized_pnl": "100.000000",
"mark_price": "96000.00"
}
}
}
}
]
}
}
17.13 SubmitOracleQuote
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SubmitOracleQuote",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SubmitOracleQuote": {
"quoter": "0x4444555566667777888899990000aaaa11112222",
"symbol": "BTC-USDT",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"source_ts_ms": 1717200000000,
"last_price": "97234.50",
"volume": "1.50000"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SubmitOracleQuote": {
"quoter": "0x4444555566667777888899990000aaaa11112222",
"symbol": "BTC-USDT",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"source_ts_ms": 1717200000000,
"last_price": "97234.50",
"volume": "1.50000"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OracleQuoteAccepted": {
"market_id": 1,
"quoter": "0x4444555566667777888899990000aaaa11112222",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"last_price": "97234.50",
"volume": "1.50000",
"source_ts_ms": 1717200000000,
}
}
}
}
]
}
}
17.14 BatchSubmitOracleQuote
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "BatchSubmitOracleQuote",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"BatchSubmitOracleQuote": {
"quotes": [
{
"quoter": "0x4444555566667777888899990000aaaa11112222",
"symbol": "BTC-USDT",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"source_ts_ms": 1717200000000,
"last_price": "97234.50",
"volume": "1.50000"
}
]
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"BatchSubmitOracleQuote": {
"quotes": [
{
"quoter": "0x4444555566667777888899990000aaaa11112222",
"symbol": "BTC-USDT",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"source_ts_ms": 1717200000000,
"last_price": "97234.50",
"volume": "1.50000"
}
]
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Exec": {
"OracleQuoteAccepted": {
"market_id": 1,
"quoter": "0x4444555566667777888899990000aaaa11112222",
"bid_price": "97100.00",
"ask_price": "97300.00",
"mark_price": "97200.00",
"last_price": "97234.50",
"volume": "1.50000",
"source_ts_ms": 1717200000000,
}
}
}
}
]
}
}
17.15 CreateMarket
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateMarket",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CreateMarket": {
"config": {
"symbol": "ETH-USDT",
"kind": "Native",
"price_decimals": 2,
"size_decimals": 4,
"fee_recipient": "0x2222333344445555666677778888999900001111",
"max_leverage": 50,
"maker_fee_rate": "0.000200",
"taker_fee_rate": "0.000500",
"margin_table": [
{
"max_notional": "1000000.000000",
"im_rate": "0.020000",
"mm_rate": "0.010000",
"max_leverage": 50
}
],
"mark_max_change_bps": 500,
"max_fills_per_quote": 32,
"price_floor": "0.01",
"price_ceil": "100000.00"
}
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CreateMarket": {
"config": {
"symbol": "ETH-USDT",
"kind": "Native",
"price_decimals": 2,
"size_decimals": 4,
"fee_recipient": "0x2222333344445555666677778888999900001111",
"max_leverage": 50,
"maker_fee_rate": "0.000200",
"taker_fee_rate": "0.000500",
"margin_table": [
{
"max_notional": "1000000.000000",
"im_rate": "0.020000",
"mm_rate": "0.010000",
"max_leverage": 50
}
],
"mark_max_change_bps": 500,
"max_fills_per_quote": 32,
"price_floor": "0.01",
"price_ceil": "100000.00"
}
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketCreated": {
"market_id": 2,
"kind": "Native",
"lifecycle": "Created"
}
}
}
}
]
}
}
17.16 ActivateMarket
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "ActivateMarket",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"ActivateMarket": {
"symbol": "ETH-USDT",
"market_id": 2
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"ActivateMarket": {
"symbol": "ETH-USDT",
"market_id": 2
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketLifecycleChanged": {
"market_id": 2,
"from": "Created",
"to": "Active"
}
}
}
}
]
}
}
17.17 HaltMarket
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "HaltMarket",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"HaltMarket": {
"symbol": "ETH-USDT",
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"HaltMarket": {
"symbol": "ETH-USDT"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketLifecycleChanged": {
"market_id": 2,
"from": "Active",
"to": "Halted"
}
}
}
}
]
}
}
17.18 ResumeMarket
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "ResumeMarket",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"ResumeMarket": {
"symbol": "ETH-USDT",
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"ResumeMarket": {
"symbol": "ETH-USDT"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketLifecycleChanged": {
"market_id": 2,
"from": "Halted",
"to": "Active"
}
}
}
}
]
}
}
17.19 RequestDelist
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "RequestDelist",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"RequestDelist": {
"symbol": "ETH-USDT",
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"RequestDelist": {
"symbol": "ETH-USDT"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketLifecycleChanged": {
"market_id": 2,
"from": "Active",
"to": "DelistPending"
}
}
}
}
]
}
}
17.20 CompleteDelist
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CompleteDelist",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CompleteDelist": {
"symbol": "ETH-USDT",
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CompleteDelist": {
"symbol": "ETH-USDT"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketLifecycleChanged": {
"market_id": 2,
"from": "DelistPending",
"to": "Delisted"
}
}
}
}
]
}
}
17.21 SetFeeRecipient
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetFeeRecipient",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetFeeRecipient": {
"symbol": "BTC-USDT",
"recipient": "0x2222333344445555666677778888999900001111",
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetFeeRecipient": {
"symbol": "BTC-USDT",
"recipient": "0x2222333344445555666677778888999900001111"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"FeeRecipientChanged": {
"market_id": 1,
"old_recipient": "0x2222333344445555666677778888999900001111",
"new_recipient": "0x2222333344445555666677778888999900001111"
}
}
}
}
]
}
}
17.22 AmendMarketConfig
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "AmendMarketConfig",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"AmendMarketConfig": {
"symbol": "BTC-USDT",
"market_id": 1,
"max_leverage": 25,
"maker_fee_rate": null,
"taker_fee_rate": "0.000600",
"margin_table": null,
"mark_max_change_bps": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"AmendMarketConfig": {
"symbol": "BTC-USDT",
"max_leverage": 25,
"maker_fee_rate": null,
"taker_fee_rate": "0.000600",
"margin_table": null,
"mark_max_change_bps": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"MarketConfigAmended": {
"market_id": 1,
"max_leverage": 25,
"maker_fee_rate": null,
"taker_fee_rate": "0.000600",
"margin_table_len": null,
"mark_max_change_bps": null
}
}
}
}
]
}
}
17.23 SetEmergencyHalt
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetEmergencyHalt",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetEmergencyHalt": {
"symbol": "BTC-USDT",
"halt": true,
"market_id": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetEmergencyHalt": {
"symbol": "BTC-USDT",
"halt": true
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"EmergencyHaltChanged": {
"market_id": 1,
"halted": true
}
}
}
}
]
}
}
17.24 RecordDeposit
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "RecordDeposit",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"RecordDeposit": {
"external_ref": {
"chain": "bsc",
"seq": 50001
},
"tx_hash": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32
],
"account": "0x1111222233334444555566667777888899990000",
"amount": "1000.000000",
"bsc_block": 12345678,
"bsc_ts": 1717200000
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"RecordDeposit": {
"external_ref": {
"chain": "bsc",
"seq": 50001
},
"tx_hash": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32
],
"account": "0x1111222233334444555566667777888899990000",
"amount": "1000.000000",
"bsc_block": 12345678,
"bsc_ts": 1717200000
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"DepositRecorded": {
"seq": 50001,
"external_ref": "bsc:50001",
"tx_hash": "0x0102…",
"account": "0x1111222233334444555566667777888899990000",
"amount": "1000.000000"
}
}
}
}
]
}
}
17.25 CreditDeposit
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreditDeposit",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CreditDeposit": {
"seq": 101
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CreditDeposit": {
"seq": 101
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"DepositCredited": {
"seq": 101,
"owner": "0x1111222233334444555566667777888899990000",
"amount": "1000.000000",
"new_balance": "2000.000000"
}
}
}
}
]
}
}
17.26 WithdrawRequest
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "WithdrawRequest",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"WithdrawRequest": {
"zepto_chain": "Mainnet",
"owner": "0x1111222233334444555566667777888899990000",
"amount": "500.000000",
"chain": "bsc"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"WithdrawRequest": {
"zepto_chain": "Mainnet",
"owner": "0x1111222233334444555566667777888899990000",
"amount": "500.000000",
"chain": "bsc"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"WithdrawRequested": {
"request_id": 2001,
"owner": "0x1111222233334444555566667777888899990000",
"amount": "500.000000",
"chain": "bsc",
"new_balance": "99500.000000"
}
}
}
}
]
}
}
17.27 WithdrawSettle
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "WithdrawSettle",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"WithdrawSettle": {
"request_id": 2001,
"external_tx": {
"tx_hash": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32
],
"bsc_block": 12345700,
"bsc_ts": 1717200100
}
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"WithdrawSettle": {
"request_id": 2001,
"external_tx": {
"tx_hash": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32
],
"bsc_block": 12345700,
"bsc_ts": 1717200100
}
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"WithdrawSettled": {
"request_id": 2001,
"owner": "0x1111222233334444555566667777888899990000",
"amount": "500.000000",
"tx_hash": "0x0102…"
}
}
}
}
]
}
}
17.28 WithdrawRefund
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "WithdrawRefund",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"WithdrawRefund": {
"request_id": 2001,
"reason_code": 1
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"WithdrawRefund": {
"request_id": 2001,
"reason_code": 1
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"WithdrawRefunded": {
"request_id": 2001,
"owner": "0x1111222233334444555566667777888899990000",
"amount": "500.000000",
"reason_code": 1,
"new_balance": "100000.000000"
}
}
}
}
]
}
}
17.29 SetSettlementPaused
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetSettlementPaused",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetSettlementPaused": {
"paused": true
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetSettlementPaused": {
"paused": true
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Bridge": {
"SettlementPausedChanged": {
"paused": true
}
}
}
}
]
}
}
17.30 SetAccountRole
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetAccountRole",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetAccountRole": {
"target": "0x33334444555566667777888899990000aaaa1111",
"role": "Liquidator",
"granted": true
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetAccountRole": {
"target": "0x33334444555566667777888899990000aaaa1111",
"role": "Liquidator",
"granted": true
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"AccountRoleChanged": {
"target": "0x33334444555566667777888899990000aaaa1111",
"role": "Liquidator",
"granted": true,
"new_mask": 2
}
}
}
}
]
}
}
17.31 RegisterAgent
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "RegisterAgent",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"RegisterAgent": {
"zepto_chain": "zepto-dev",
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999",
"role_mask": 1,
"expires_at_ms": 0
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"RegisterAgent": {
"zepto_chain": "zepto-dev",
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999",
"role_mask": 1,
"expires_at_ms": 0
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"AgentRegistered": {
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999",
"role_mask": 1,
"expires_at_ms": 0
}
}
}
}
]
}
}
17.32 RevokeAgent
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "RevokeAgent",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"RevokeAgent": {
"zepto_chain": "zepto-dev",
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"RevokeAgent": {
"zepto_chain": "zepto-dev",
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"AgentRevoked": {
"owner": "0x1111222233334444555566667777888899990000",
"agent_address": "0xaaaa111122223333444455556666777788889999"
}
}
}
}
]
}
}
17.33 SetUserFeeRate
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetUserFeeRate",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetUserFeeRate": {
"owner": "0x1111222233334444555566667777888899990000",
"maker_fee_rate": "0.000100",
"taker_fee_rate": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetUserFeeRate": {
"owner": "0x1111222233334444555566667777888899990000",
"maker_fee_rate": "0.000100",
"taker_fee_rate": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Core": {
"UserFeeRateChanged": {
"owner": "0x1111222233334444555566667777888899990000",
"maker_fee_rate": "0.000100",
"taker_fee_rate": null
}
}
}
}
]
}
}
17.34 SetReferrer
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetReferrer",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetReferrer": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "ALICE-001"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetReferrer": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "ALICE-001"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Core": {
"ReferrerBound": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "ALICE-001"
}
}
}
}
]
}
}
17.35 RegisterReferrer
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "RegisterReferrer",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"RegisterReferrer": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "BOB-TRADE"
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"RegisterReferrer": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "BOB-TRADE"
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Core": {
"ReferrerRegistered": {
"owner": "0x1111222233334444555566667777888899990000",
"code": "BOB-TRADE"
}
}
}
}
]
}
}
17.36 SetGlobalRebateRatio
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetGlobalRebateRatio",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetGlobalRebateRatio": {
"ratio_bps": 2000
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetGlobalRebateRatio": {
"ratio_bps": 2000
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"GlobalRebateRatioChanged": {
"old_ratio_bps": 1000,
"new_ratio_bps": 2000
}
}
}
}
]
}
}
17.37 SetAccountRebateRatio
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetAccountRebateRatio",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetAccountRebateRatio": {
"owner": "0x1111222233334444555566667777888899990000",
"ratio_bps": 6000
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetAccountRebateRatio": {
"owner": "0x1111222233334444555566667777888899990000",
"ratio_bps": 6000
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Ops": {
"AccountRebateRatioChanged": {
"owner": "0x1111222233334444555566667777888899990000",
"ratio_bps": 6000
}
}
}
}
]
}
}
17.38 SetInviterKeepRatio
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "SetInviterKeepRatio",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"SetInviterKeepRatio": {
"owner": "0x1111222233334444555566667777888899990000",
"ratio_bps": 7000
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"SetInviterKeepRatio": {
"owner": "0x1111222233334444555566667777888899990000",
"ratio_bps": 7000
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Core": {
"InviterKeepRatioChanged": {
"owner": "0x1111222233334444555566667777888899990000",
"old_ratio_bps": 0,
"new_ratio_bps": 7000
}
}
}
}
]
}
}
17.39 PlaceTriggerOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "PlaceTriggerOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"PlaceTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"expires_at_ms": null,
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
}
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"PlaceTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"symbol": "BTC-USDT",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"expires_at_ms": null,
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
}
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Trigger": {
"TriggerOrderPlaced": {
"trigger_id": 7001,
"market_id": 1,
"owner": "0x1111222233334444555566667777888899990000",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
},
"expires_at_ms": null
}
}
}
}
]
}
}
17.40 CancelTriggerOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CancelTriggerOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CancelTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CancelTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Trigger": {
"TriggerOrderCancelled": {
"trigger_id": 7001,
"market_id": 1,
"owner": "0x1111222233334444555566667777888899990000",
"reason": "ByOwner"
}
}
}
}
]
}
}
17.41 AmendTriggerOrder
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "AmendTriggerOrder",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"AmendTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001,
"new_trigger_price": "96000.00",
"new_qty": "0.30000",
"new_limit_price": null,
"new_tif": null,
"new_reduce_only": null,
"new_expires_at_ms": null
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"AmendTriggerOrder": {
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001,
"new_trigger_price": "96000.00",
"new_qty": "0.30000",
"new_limit_price": null,
"new_tif": null,
"new_reduce_only": null,
"new_expires_at_ms": null
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Trigger": {
"TriggerOrderAmended": {
"trigger_id": 7001,
"market_id": 1,
"owner": "0x1111222233334444555566667777888899990000",
"trigger_price": "96000.00",
"trigger_direction": "Below",
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.30000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
},
"expires_at_ms": null
}
}
}
}
]
}
}
17.42 BatchAmendTrigger
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "BatchAmendTrigger",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"BatchAmendTrigger": {
"amends": [
{
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001,
"new_trigger_price": "96000.00",
"new_qty": null,
"new_limit_price": null,
"new_tif": null,
"new_reduce_only": null,
"new_expires_at_ms": null
}
]
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"BatchAmendTrigger": {
"amends": [
{
"owner": "0x1111222233334444555566667777888899990000",
"trigger_id": 7001,
"new_trigger_price": "96000.00",
"new_qty": null,
"new_limit_price": null,
"new_tif": null,
"new_reduce_only": null,
"new_expires_at_ms": null
}
]
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Trigger": {
"TriggerOrderAmended": {
"trigger_id": 7001,
"market_id": 1,
"owner": "0x1111222233334444555566667777888899990000",
"trigger_price": "96000.00",
"trigger_direction": "Below",
"payload": {
"Limit": {
"side": "Ask",
"limit_price": "94900.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "sl-1"
}
},
"expires_at_ms": null
}
}
}
}
]
}
}
17.43 PlaceOco
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "PlaceOco",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"PlaceOco": {
"owner": "0x1111222233334444555566667777888899990000",
"client_pair_id": 100,
"execution": {
"StopAndLimit": {
"stop_leg": {
"Market": {
"symbol": "BTC-USDT",
"side": "Ask",
"qty": "0.50000",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"reduce_only": true,
"client_trigger_id": null,
"expires_at_ms": null
}
},
"limit_leg": {
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97500.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "oco-limit-1",
"expires_at_ms": null
}
}
}
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"PlaceOco": {
"owner": "0x1111222233334444555566667777888899990000",
"client_pair_id": 100,
"execution": {
"StopAndLimit": {
"stop_leg": {
"Market": {
"symbol": "BTC-USDT",
"side": "Ask",
"qty": "0.50000",
"trigger_price": "95000.00",
"trigger_direction": "Below",
"reduce_only": true,
"client_trigger_id": null,
"expires_at_ms": null
}
},
"limit_leg": {
"symbol": "BTC-USDT",
"side": "Bid",
"limit_price": "97500.00",
"qty": "0.50000",
"tif": "Gtc",
"reduce_only": true,
"client_order_id": "oco-limit-1",
"expires_at_ms": null
}
}
}
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Trigger": {
"OcoPairPlaced": {
"pair_id": 8001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"legs": {
"StopAndLimit": {
"stop_trigger_id": 7001,
"limit_order_id": 1003
}
},
"client_pair_id": 100,
"parent_order_id": null
}
}
}
}
]
}
}
17.44 CancelOco
请求示例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CancelOco",
"params": {
"envelope": {
"chain_id": 42,
"domain_chain_id": 42,
"action_version": 2,
"nonce": 42,
"signer": "0x1111222233334444555566667777888899990000",
"credential": {
"Secp256k1": {
"signature": [
95,
83,
94,
41,
12,
34,
56,
78,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24
]
}
},
"action": {
"CancelOco": {
"owner": "0x1111222233334444555566667777888899990000",
"pair_id": 8001
}
}
}
}
}
响应示例(accepted):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hash": "0x…",
"height": 12346,
"envelope_idx": 0,
"signer": "0x1111222233334444555566667777888899990000",
"nonce": 42,
"action": {
"CancelOco": {
"owner": "0x1111222233334444555566667777888899990000",
"pair_id": 8001
}
},
"status": "accepted",
"events": [
{
"seq": 0,
"block_height": 12346,
"envelope_idx": 0,
"kind": {
"Oco": {
"OcoPairResolved": {
"pair_id": 8001,
"owner": "0x1111222233334444555566667777888899990000",
"market_id": 1,
"winner_leg": null,
"reason": "ManualCancel"
}
}
}
}
]
}
}