ton-swap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Swap TON Tokens

兑换TON代币

Swap tokens on TON via DEX aggregator. Two-step flow: get a quote, confirm with the user, then execute.
通过DEX聚合器在TON上兑换代币。分为两步流程:获取报价、与用户确认后执行。

MCP Tools

MCP工具

ToolRequiredOptional
get_swap_quote
fromToken
,
toToken
,
amount
walletSelector
emulate_transaction
messages
validUntil
send_raw_transaction
messages
walletSelector
get_known_jettons
工具必填项可选项
get_swap_quote
fromToken
,
toToken
,
amount
walletSelector
emulate_transaction
messages
validUntil
send_raw_transaction
messages
walletSelector
get_known_jettons

Workflow

工作流程

  1. If the user mentions a token by name (e.g., "USDT", "jUSDC"), call
    get_known_jettons
    to resolve the jetton address
  2. Call
    get_swap_quote
    with
    fromToken
    ,
    toToken
    , and
    amount
    • Use
      "TON"
      for native TON, or the jetton master contract address for tokens
    • Amount is human-readable (e.g.,
      "1.5"
      = 1.5 TON)
  3. Call
    emulate_transaction
    with the quote's
    transaction.messages
    to dry-run the swap — verify the expected money flow (TON/jetton balance changes) before sending
  4. Show the quote details and emulation results to the user and ask one short yes/no confirmation
  5. Call
    send_raw_transaction
    with the transaction params returned by the quote
  6. Poll
    get_transaction_status
    with the returned
    normalizedHash
    until status is
    completed
    or
    failed
    (see
    ton-balance
    skill). User can ask to skip polling.
  1. 如果用户提及代币名称(例如“USDT”、“jUSDC”),调用
    get_known_jettons
    解析jetton地址
  2. 使用
    fromToken
    toToken
    amount
    调用
    get_swap_quote
    • 原生TON使用
      "TON"
      ,代币则使用jetton主合约地址
    • 金额为人类可读格式(例如
      "1.5"
      = 1.5 TON)
  3. 使用报价中的
    transaction.messages
    调用
    emulate_transaction
    来试运行兑换——在发送前验证预期的资金流向(TON/jetton余额变化)
  4. 向用户展示报价详情和模拟结果,并请求简短的是/否确认
  5. 使用报价返回的交易参数调用
    send_raw_transaction
  6. 使用返回的
    normalizedHash
    轮询
    get_transaction_status
    ,直到状态变为
    completed
    failed
    (参见
    ton-balance
    技能)。用户可以要求跳过轮询。

Notes

注意事项

  • Always confirm the swap with the user before executing; prefer the host client's structured confirmation UI when available, otherwise accept natural-language yes/no and do not require a fixed confirmation phrase
  • The quote returns transaction messages ready for
    send_raw_transaction
  • After execution, poll
    get_transaction_status
    by default. User can specify whether to check status.
  • If no wallet is configured, use the
    ton-create-wallet
    skill first
  • 执行兑换前必须与用户确认;如果有宿主客户端的结构化确认UI则优先使用,否则接受自然语言的是/否回复,不要求固定的确认语句
  • 报价会返回可直接用于
    send_raw_transaction
    的交易消息
  • 执行完成后默认轮询
    get_transaction_status
    。用户可以指定是否检查状态。
  • 如果未配置钱包,请先使用
    ton-create-wallet
    技能