manifest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manifest DEX Integration Guide

Manifest DEX 集成指南

Build trading, routing, portfolio, and frontend integrations on top of Manifest's permissionless orderbook.
在Manifest的无需许可订单簿之上构建交易、路由、投资组合及前端集成。

Overview

概述

Use this skill when the task involves:
  • Reading Manifest market state or orderbooks
  • Placing, canceling, depositing, or withdrawing via the Manifest SDK
  • Choosing between local market balances and global balances
  • Handling wrapper setup, seat claims, and wallet-adapter flows
  • Understanding
    Limit
    ,
    PostOnly
    ,
    ImmediateOrCancel
    ,
    Global
    ,
    Reverse
    , and
    ReverseTight
    order types
Load supporting references as needed:
  • resources/manifest-actions.md
  • resources/manifest-sdk.md
  • docs/troubleshooting.md
  • examples/read-market/read-market.ts
  • examples/wallet-order/place-order.ts
  • examples/global-liquidity/global-order.ts
  • examples/reverse-liquidity/amm-style-batch.ts
  • templates/manifest-setup.ts
当任务涉及以下内容时,可使用本技能:
  • 读取Manifest市场状态或订单簿
  • 通过Manifest SDK下达、取消订单,进行存款或提款操作
  • 在本地市场余额与全局余额之间做选择
  • 处理包装器设置、席位申领及钱包适配器流程
  • 理解
    Limit
    PostOnly
    ImmediateOrCancel
    Global
    Reverse
    ReverseTight
    订单类型
按需加载配套参考资料:
  • resources/manifest-actions.md
  • resources/manifest-sdk.md
  • docs/troubleshooting.md
  • examples/read-market/read-market.ts
  • examples/wallet-order/place-order.ts
  • examples/global-liquidity/global-order.ts
  • examples/reverse-liquidity/amm-style-batch.ts
  • templates/manifest-setup.ts

Instructions

操作步骤

  1. Determine whether the task is read-only market access or transaction-building.
  2. For read-only access, prefer
    Market
    reads or
    ManifestClient.getClientReadOnly(...)
    .
  3. For transaction-building, use
    getClientForMarket(...)
    for signer-controlled flows, or use
    getSetupIxs(...)
    first and then
    getClientForMarketNoPrivateKey(...)
    for wallet-adapter flows.
  4. Decide whether liquidity should be market-local (wrapper balances plus a market seat) or global (global account plus
    OrderType.Global
    ).
  5. If the task involves recurring two-sided liquidity, evaluate
    Reverse
    or
    ReverseTight
    instead of ordinary limit orders.
  6. For UI/orderbook work, prefer
    bidsL2()
    and
    asksL2()
    for display-ready levels.
  7. When documenting or implementing cleanup behavior, distinguish wrapper-level cancels from core-level cancels.
    cancelAllIx()
    does not fully cover all reverse/global edge cases;
    cancelAllOnCoreIx()
    is the stronger cleanup path.
  8. State assumptions explicitly:
  • cluster
  • market address
  • trader/signer model
  • whether wrapper/global setup already exists
  1. 判断任务是仅读取市场数据还是需要构建交易。
  2. 对于仅读取场景,优先使用
    Market
    读取或
    ManifestClient.getClientReadOnly(...)
  3. 对于交易构建场景,若为签名者控制的流程,使用
    getClientForMarket(...)
    ;若为钱包适配器流程,先调用
    getSetupIxs(...)
    ,再使用
    getClientForMarketNoPrivateKey(...)
  4. 决定流动性是采用市场本地模式(包装器余额+市场席位)还是全局模式(全局账户+
    OrderType.Global
    )。
  5. 若任务涉及双向循环流动性,考虑使用
    Reverse
    ReverseTight
    订单,而非普通限价订单。
  6. 对于UI/订单簿开发,优先使用
    bidsL2()
    asksL2()
    获取可直接用于展示的档位数据。
  7. 当编写文档或实现清理逻辑时,区分包装器层级的取消操作与核心层级的取消操作。
    cancelAllIx()
    无法完全覆盖所有反向/全局订单的边缘情况,
    cancelAllOnCoreIx()
    是更彻底的清理方式。
  8. 明确说明假设前提:
  • 集群环境
  • 市场地址
  • 交易者/签名者模型
  • 包装器/全局设置是否已完成

Examples

示例

Basic Usage

基础用法

When user asks: "Show the best bid and ask on a Manifest market"
The agent should:
  1. Use
    Market.loadFromAddress(...)
    or
    ManifestClient.getClientReadOnly(...)
  2. Read
    bestBidPrice()
    and
    bestAskPrice()
    or
    bidsL2()
    /
    asksL2()
  3. Return prices without introducing signing or setup logic
当用户询问:“显示某个Manifest市场的最优买价和卖价”
Agent应执行以下操作:
  1. 使用
    Market.loadFromAddress(...)
    ManifestClient.getClientReadOnly(...)
  2. 读取
    bestBidPrice()
    bestAskPrice()
    ,或调用
    bidsL2()
    /
    asksL2()
  3. 返回价格信息,无需引入签名或设置逻辑

Wallet Trading Flow

钱包交易流程

When user asks: "Place a Manifest order from a browser wallet"
The agent should:
  1. Call
    ManifestClient.getSetupIxs(...)
  2. If setup is needed, create wrapper state and/or claim the seat first
  3. Then use
    ManifestClient.getClientForMarketNoPrivateKey(...)
  4. Build the order instruction with
    client.placeOrderIx(...)
当用户询问:“通过浏览器钱包下达Manifest订单”
Agent应执行以下操作:
  1. 调用
    ManifestClient.getSetupIxs(...)
  2. 若需要设置,先创建包装器状态和/或申领席位
  3. 然后使用
    ManifestClient.getClientForMarketNoPrivateKey(...)
  4. 通过
    client.placeOrderIx(...)
    构建订单指令

Global Liquidity Flow

全局流动性流程

When user asks: "Use the same capital across multiple Manifest markets"
The agent should:
  1. Explain that market-local balances are insufficient for this requirement
  2. Use global-account setup with
    createGlobalAddTraderIx(...)
  3. Deposit via
    globalDepositIx(...)
  4. Place
    OrderType.Global
    orders
当用户询问:“在多个Manifest市场中复用同一资金”
Agent应执行以下操作:
  1. 说明市场本地余额无法满足该需求
  2. 使用
    createGlobalAddTraderIx(...)
    完成全局账户设置
  3. 通过
    globalDepositIx(...)
    进行存款
  4. 下达
    OrderType.Global
    类型的订单

Reverse Orders

反向订单

When user asks: "Provide recurring liquidity that flips after fills"
The agent should:
  1. Recommend
    OrderType.Reverse
    or
    OrderType.ReverseTight
  2. Explain that reverse orders use
    spreadBps
    instead of
    lastValidSlot
  3. Use
    ReverseTight
    when tighter spread precision matters
  4. Mention that cleanup may require
    cancelAllOnCoreIx()
    rather than only wrapper-level cancellation
Copy-paste oriented examples in this skill:
  • examples/read-market/read-market.ts
  • examples/wallet-order/place-order.ts
  • examples/global-liquidity/global-order.ts
  • examples/reverse-liquidity/amm-style-batch.ts
当用户询问:“提供成交后自动翻转的循环流动性”
Agent应执行以下操作:
  1. 推荐使用
    OrderType.Reverse
    OrderType.ReverseTight
  2. 说明反向订单使用
    spreadBps
    而非
    lastValidSlot
  3. 当需要更精确的点差控制时,使用
    ReverseTight
  4. 提及清理操作可能需要
    cancelAllOnCoreIx()
    ,而非仅依赖包装器层级的取消操作
本技能中可直接复制使用的示例:
  • examples/read-market/read-market.ts
  • examples/wallet-order/place-order.ts
  • examples/global-liquidity/global-order.ts
  • examples/reverse-liquidity/amm-style-batch.ts

Guidelines

指南

  • DO: Use
    getSetupIxs(...)
    before wallet-adapter trading flows.
  • DO: Use
    getClientReadOnly(...)
    for anonymous or pre-setup inspection paths.
  • DO: Use
    bidsL2()
    /
    asksL2()
    for UI-facing orderbook displays.
  • DO: Separate market-local account logic from global-account logic.
  • DO: Mention wrapper state, market seats, and global accounts explicitly when relevant.
  • DON'T: Assume a connected wallet already has wrapper state or a market seat.
  • DON'T: Treat
    OrderType.Global
    as equivalent to ordinary market-local orders.
  • DON'T: Use
    cancelAllIx()
    as if it always fully cleans up reverse/global edge cases.
  • DON'T: Ask for or embed private keys in examples.
  • 必须:在钱包适配器交易流程前调用
    getSetupIxs(...)
  • 必须:对于匿名或前置设置完成后的查询场景,使用
    getClientReadOnly(...)
  • 必须:面向UI的订单簿展示,使用
    bidsL2()
    /
    asksL2()
  • 必须:区分市场本地账户逻辑与全局账户逻辑。
  • 必须:在相关场景下明确提及包装器状态、市场席位及全局账户。
  • 禁止:假设已连接的钱包已完成包装器状态设置或拥有市场席位。
  • 禁止:将
    OrderType.Global
    等同于普通市场本地订单。
  • 禁止:认为
    cancelAllIx()
    总能彻底清理反向/全局订单的所有边缘情况。
  • 禁止:在示例中请求或嵌入私钥。

Common Errors

常见错误

Error: Read only

错误:只读模式

Cause: A write method was called on a read-only client or without a payer/wrapper context.
Solution: Switch to
getClientForMarket(...)
or complete the
getSetupIxs(...)
flow and then use
getClientForMarketNoPrivateKey(...)
.
原因:在只读客户端或无付款人/包装器上下文的情况下调用了写入方法。
解决方案:切换至
getClientForMarket(...)
,或完成
getSetupIxs(...)
流程后使用
getClientForMarketNoPrivateKey(...)

Error: Setup still required

错误:仍需设置

Cause: Wrapper creation or market seat claim has not been completed.
Solution: Run the instructions returned by
ManifestClient.getSetupIxs(...)
before building normal wrapper-based trading actions.
原因:未完成包装器创建或市场席位申领。
解决方案:在构建基于包装器的常规交易操作前,先执行
ManifestClient.getSetupIxs(...)
返回的指令。

Error: Global order funded incorrectly

错误:全局订单资金配置错误

Cause: The trader is using
OrderType.Global
without a funded global account for the supporting token.
Solution: Run
createGlobalAddTraderIx(...)
if needed, then
globalDepositIx(...)
, and only then place the global order.
原因:交易者使用
OrderType.Global
类型订单,但对应代币未配置已充值的全局账户。
解决方案:若需要,先执行
createGlobalAddTraderIx(...)
,再调用
globalDepositIx(...)
存款,最后下达全局订单。

Error: Reverse/global orders remain after cancel-all

错误:执行全量取消后仍存在反向/全局订单

Cause: Wrapper-level cancellation does not fully cover all core-level order states.
Solution: Use
cancelAllOnCoreIx()
when full core cleanup is required.
原因:包装器层级的取消操作无法覆盖所有核心层级的订单状态。
解决方案:当需要彻底清理核心层级订单时,使用
cancelAllOnCoreIx()

References

参考资料

  • Official site:
    https://manifest.trade
  • SDK package:
    https://www.npmjs.com/package/@bonasa-tech/manifest-sdk
  • Source repository:
    https://github.com/Bonasa-Tech/manifest
  • TypeScript client docs:
    https://github.com/Bonasa-Tech/manifest/tree/main/client/ts
  • 官方网站:
    https://manifest.trade
  • SDK包:
    https://www.npmjs.com/package/@bonasa-tech/manifest-sdk
  • 源码仓库:
    https://github.com/Bonasa-Tech/manifest
  • TypeScript客户端文档:
    https://github.com/Bonasa-Tech/manifest/tree/main/client/ts