ton-xstocks
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesexStocks on TON (buy / sell)
TON上的xStocks(买卖)
Backed xStocks are jettons on TON. Resolve the jetton master from the public xStocks API, then use the same quote → execute flow as , with routing preferences learned from real Omniston behavior.
ton-swapCritical: USDT is the only working swap pair.
Omniston consistently returns no quote for TON → xStock and xStock → TON routes.
All xStock buys and sells must go through USDT. If the user lacks sufficient USDT, buy USDT with TON first (see §Pre-fund USDT below).
Backed xStocks是TON上的jetton。从公开的xStocks API获取jetton master,然后采用与相同的报价→执行流程,路由偏好参考Omniston的实际操作逻辑。
ton-swap重要提示:仅USDT为可用兑换对。
Omniston始终会针对TON→xStock和xStock→TON路由返回无报价。
所有xStock的买卖操作必须通过USDT进行。若用户USDT不足,请先将TON兑换为USDT(见下文§预充值USDT部分)。
Key addresses
关键地址
| Token | Jetton master |
|---|---|
| USDT (TON) | |
| 代币 | Jetton master |
|---|---|
| USDT (TON) | |
Resolve the TON jetton master for an xStock
获取xStock对应的TON jetton master
-
By symbol (e.g.): fetch via
TSLAx(not WebFetch — the xStocks API returns 403 for non-standard user-agents):curlbashcurl -s "https://api.xstocks.fi/api/v2/public/assets/{symbol}"(production base:— see xStocks API).https://api.xstocks.fi/api/v2 -
In the JSON, findwhere
deployments[]isnetwork. Use that object's"Ton"as the jetton master for MCP (address/fromToken).toToken -
Optional:returns all assets with the same
curl -s "https://api.xstocks.fi/api/v2/public/assets"shape.deployments -
Callwith
get_jetton_infoto confirm name / symbol / decimals before swapping.--jettonAddress <jetton_master>
-
按代币符号(如):通过**
TSLAx**获取(请勿使用WebFetch——xStocks API会对非标准用户代理返回403):curlbashcurl -s "https://api.xstocks.fi/api/v2/public/assets/{symbol}"(生产环境基础地址:——详见xStocks API)。https://api.xstocks.fi/api/v2 -
在返回的JSON中,找到数组里**
deployments[]为network的对象,使用该对象的"Ton"**作为MCP兑换时的address/fromToken对应的jetton master。toToken -
可选操作:调用可返回所有符合上述
curl -s "https://api.xstocks.fi/api/v2/public/assets"结构的资产。deployments -
在兑换前,调用并传入
get_jetton_info,确认代币的名称/符号/小数位数。--jettonAddress <jetton_master>
MCP tools
MCP工具
| Action | Tools |
|---|---|
| Pre-fund USDT | |
| Buy xStock | |
| Sell xStock | |
| Verify | |
Amounts for are human-readable strings (respect jetton decimals from ).
get_swap_quoteget_jetton_info| 操作 | 工具 |
|---|---|
| 预充值USDT | |
| 买入xStock | |
| 卖出xStock | |
| 验证 | |
get_swap_quoteget_jetton_infoCLI argument names (exact)
CLI参数名称(严格匹配)
| Tool | Arg | CLI flag |
|---|---|---|
| jettonAddress | |
| jettonAddress | |
| fromToken | |
| toToken | |
| amount | |
| slippageBps | |
| messages | |
| messages | |
| normalizedHash | |
| 工具 | 参数 | CLI标志 |
|---|---|---|
| jettonAddress | |
| jettonAddress | |
| fromToken | |
| toToken | |
| amount | |
| slippageBps | |
| messages | |
| messages | |
| normalizedHash | |
Pre-fund USDT (auto, when needed)
预充值USDT(自动触发,按需执行)
Before any xStock trade, check the user's USDT balance:
- for the USDT master address — use the
get_jetton_balancefield for comparison.amount - If < required amount for the planned buy: a. Calculate the shortfall (include a small buffer for price movement). b.
amountwithget_swap_quote=fromToken(the literal string, not an address),"TON"= USDT master,toToken= shortfall. c. Confirm with the user: "You need ~X USDT but only have Y. Swap Z TON → X USDT first?" d. On approval,amount→ pollsend_raw_transactionuntilget_transaction_status. e. Re-check USDT balance before proceeding to the xStock buy.completed
在进行任何xStock交易前,检查用户的USDT余额:
- 针对USDT master地址调用——使用返回的
get_jetton_balance字段进行余额对比。amount - 若< 计划买入所需金额: a. 计算差额(预留少量缓冲应对价格波动)。 b. 调用
amount,参数get_swap_quote=fromToken(字面字符串,非地址),"TON"=USDT master,toToken=差额。 c. 向用户确认:"您需要约X USDT,但当前仅持有Y USDT。是否先将Z TON兑换为X USDT?" d. 用户确认后,调用amount→ 轮询send_raw_transaction直到状态变为get_transaction_status。 e. 重新检查USDT余额,再继续执行xStock买入操作。completed
Buy workflow
买入流程
- Resolve the Ton jetton master for the xStock symbol (API above).
- Check USDT balance — run Pre-fund USDT if insufficient.
- :
get_swap_quote= USDT master,fromToken= xStock master,toToken= USDT to spend,amount= 100 (1 %).slippageBps - with the quote's
emulate_transaction— verify expected balance changes before sending.transaction.messages - Show the user: fromAmount, toAmount, minReceived, expiresAt, emulation results, and note the forward TON on router messages (gas).
- Confirm once, then with the returned
send_raw_transaction.transaction.messages - Poll on
get_transaction_statusuntilnormalizedHashorcompleted.failed
Do not attempt TON → xStock directly. It will return no quote. Always route through USDT.
- 获取目标xStock符号对应的Ton jetton master(通过上述API)。
- 检查USDT余额——若不足则执行预充值USDT流程。
- 调用:
get_swap_quote=USDT master,fromToken=xStock master,toToken=要花费的USDT金额,amount=100(1%)。slippageBps - 使用报价返回的调用
transaction.messages——在发送交易前验证预期的余额变化。emulate_transaction - 向用户展示:fromAmount、toAmount、minReceived、expiresAt、模拟执行结果,并注意路由消息中的正向TON(Gas费用)。
- 用户确认后,使用返回的调用
transaction.messages。send_raw_transaction - 轮询对应的
normalizedHash,直到状态变为get_transaction_status或completed。failed
请勿直接尝试TON→xStock兑换。 该路由会返回无报价,务必通过USDT中转。
Sell workflow ("sell all" or fixed amount)
卖出流程("全部卖出"或固定金额)
- for the xStock master → use the returned
get_jetton_balancefield (already a human-readable decimal string, e.g.amount). Use"12.5"only if a raw integer is needed elsewhere.amountRaw - Pass directly as the
amountparameter foramount— no manual conversion needed.get_swap_quote - :
get_swap_quote= xStock master,fromToken= USDT master.toToken - with the quote's
emulate_transaction— verify expected balance changes.transaction.messages - Show the user the quote details and emulation results, then confirm.
- , then poll
send_raw_transactionuntilget_transaction_statusorcompleted.failed
Do not attempt xStock → TON directly. Always sell into USDT.
- 针对xStock master调用→ 使用返回的
get_jetton_balance字段(已为人类可读的十进制字符串,如amount)。仅在其他场景需要原始整数时使用"12.5"。amountRaw - 将直接作为
amount的get_swap_quote参数传入——无需手动转换。amount - 调用:
get_swap_quote=xStock master,fromToken=USDT master。toToken - 使用报价返回的调用
transaction.messages——验证预期的余额变化。emulate_transaction - 向用户展示报价详情和模拟执行结果,待用户确认。
- 调用,然后轮询
send_raw_transaction直到状态变为get_transaction_status或completed。failed
请勿直接尝试xStock→TON兑换。 务必卖出为USDT。
Post-trade checks
交易后检查
- If balance reads 0 immediately after a buy, wait a few seconds and re-query; indexers can lag.
- After a sell, confirm USDT balance increased as expected.
- 若买入后余额立即显示为0,请等待几秒后重新查询;索引器可能存在延迟。
- 卖出后,确认USDT余额已按预期增加。
Omniston quirks
Omniston特性
- "No quote available" — no route at that size / time. Retry after a short wait, or adjust amount / slippage slightly. Do not switch to TON pairing; it won't help.
- Occasional WebSocket errors (e.g. quote ack) — retry .
get_swap_quote - Quotes expire; if the user waited before confirming, fetch a fresh quote before executing.
- "无可用报价"——当前规模/时间下无可用路由。等待片刻后重试,或小幅调整金额/滑点。请勿切换为TON配对,这无法解决问题。
- 偶尔会出现WebSocket错误(如报价确认失败)——重试。
get_swap_quote - 报价会过期;若用户在确认前等待过久,请在执行前重新获取新报价。
Relations
关联内容
- Execution and confirmation rules: skill.
ton-swap - Wallet funding and status polling: skill.
ton-balance - Issuance / redemption outside DEX: xStocks product docs / dashboard — not covered by MCP swap alone.
- 执行与确认规则:****技能。
ton-swap - 钱包充值与状态轮询:****技能。
ton-balance - DEX外的发行/赎回:xStocks产品文档/控制台——本指南仅覆盖MCP兑换相关操作。