# Titan：核Portal报价map的推荐路由、指令身份与错误层

整理：链小知（AI 辅助）
资料核对日期：2026-10-14
引用地址：https://lianxiaozhi.com/tools/guides/titan-portal-provider-venue-quote-record
难度：进阶
核验方式：官方文档整理，未执行真实账户操作

从官方示例或已有脱敏报价建立provider→venue→指令映射，避免取最大outAmount、误读空steps或混用凭据与交易版本。

## 使用工具
- [Titan Exchange](https://lianxiaozhi.com/tools/titan-exchange) · [官方入口](https://titan.exchange/)

## 前置条件
- 准备Portal官方Quote Swap/Info/Errors方法及已有脱敏请求、响应和header；无真实响应时仅完成文档示例映射。
- 不申请key、不请求quote/info/providers/venues，不组装或签名交易；保留原响应时间和环境。

## 1. 辨认Portal、分销商与响应编码

Portal host为portal.api.titan.exchange、组织key走x-api-key；分销商host及JWT另由provider提供，凭据不可互换。官方门户默认MessagePack；Accept: application/json时pubkey为base58、instruction data为base64。

检查已有样例host/Accept及返回编码，只记录凭据类型，不保存key。Direct WebSocket为Enterprise范围，不能把门户REST教程套成流式免费接口。

核对结果：能明确host、凭据类别与编码；缺header/host保留未知。
依据：[Titan developer portal introduction](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/introduction)
依据：[Titan Portal credit accounting](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/plans-rate-limits-credits.md)

## 2. 核mints、amount和钱包参数的作用

请求必有inputMint、outputMint、amount(u64最小单位)、userPublicKey；amount=1000000000在官方wSOL→USDC示例为1 SOL。请求整数已是最小单位，不再乘decimals；输出按metadata的mint decimals格式化。

userPublicKey是指令针对的签名/执行钱包及token accounts，不是随意查询地址。只核样例地址，不建立钱包或发送。具体ONyc资格/可路由状态不能从9月26日报道代填。

核对结果：记录请求echo、最小单位与用户钱包用途，mint未知不按ticker猜。
依据：[Titan Portal Quote Swap fields](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/quote-swap.md)
依据：[Titan ONyc RFQ product commentary](https://solanacompass.com/news/onre-liquidity-engine-launches-for-onyc-capital-backed-rfq-quotes-routed-by-titan)

## 3. 区分provider ID、venue label与pool地址过滤

quotes map键、ExpectedWinner及providers过滤用provider id；官方providers例为Titan和Titan-DART，display name可以不同。dexes/excludeDexes用venue label；venueAllowlist/Banlist用pool pubkey，Banlist覆盖Allowlist。

已有venues响应的labels[i]与programIds[i]仅同一响应位置对应，下次顺序不稳定。未知dexes label会找不到路由404 -7而非一定400；当前有效目录未取到就不声称指定池已启用。

核对结果：provider/label/pool三层身份分别映射，没有复用旧位置或猜测有效标签。
依据：[Titan Portal venue and provider filters](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/info-venues-providers.md)
依据：[Titan Portal Quote Swap fields](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/quote-swap.md)
依据：[Titan Portal errors](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/errors.md)

## 4. 先读推荐赢家再拆路由和指令

quotes是按provider键控的对象，不是数组；默认1个、numQuotes上限10。metadata.ExpectedWinner（也可expectedWinner同值）是滑点调整后的推荐，不能仅sort outAmount替代；推荐键缺失时保持未知。

route.steps为空可因provider直接fill，不直接判无路由；有hop时allocPpb为十亿分比，1000000000为整单，拆分份额须保留结构。instruction短字段p=program、a=有序账户及s/w、d=数据；检查已有ComputeBudget指令后才判断重复，本文不组装。

核对结果：推荐provider能对应map成员，空steps原因有限解释，保留指令/账户顺序与编码。
依据：[Titan Portal Quote Swap fields](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/quote-swap.md)

## 5. 将过期与预检范围写入记录

contextSlot、expiresAtMs/ expiresAfterSlot是不同字段，provider设过期才有hard expiry；缺字段不当永不过期。titanSwapVersion默认3，transactionFormat默认0(V0)；选择1需cluster支持及V3，不能因V3 swap默认推断V1交易可用。

simulate默认true只是报价预检；maxPriceDeviationBps默认1000，>=10000关闭检查且参考价缺失fail open。outAmount是滑点前预期值，steps.feeMint/feeAmount仅when reported。缺fee字段不是免费，预检也不是确认成交。

核对结果：分别记录报价状态、program/transaction版本及缺费用/参考价未知；未把预期数当到账。
依据：[Titan Portal Quote Swap fields](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/quote-swap.md)

## 6. 按错误层与共享额度完成问题记录

错误体区分平台error.code、edge Missing Authentication Token、参数plain text和engine code；403该文字是未知path/method，勿一律归因key。404 -7读quoteId.tag及metadata.errors，缺provider errors可为验证先失败；保留x-amzn-requestid和quote响应id用于定位。

429 rate_limited按retry-after等待；allowance_exhausted重试无效。官方每请求当前1credit且状态不影响计费，组织所有key/region共享滚动60秒；月额自购买日起而非日历月。不发请求即可按已有脱敏回执分类。

核对结果：输出能区分路由不可建、参数、凭据、限额与月额，并保留可定位的脱敏ID。
依据：[Titan Portal errors](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/errors.md)
依据：[Titan Portal credit accounting](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/plans-rate-limits-credits.md)

## 常见错误
- 把ONyc发行方capital reserve/资格写成Titan自身保证。
- 把ExpectedWinner当最大outAmount，或空steps当失败。
- HTTP403 Missing Authentication Token不一定凭据问题；allowance耗尽不靠重试恢复。

## 完成检查
- 形成provider、venue、pool、指令与时点的一份报价记录。
- 结果属于规格/历史回执核验，未证明当前任何指定资产可成交。

## 相关知识

## 官方依据
- [Titan developer portal introduction](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/introduction)
- [Titan Portal credit accounting](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/plans-rate-limits-credits.md)
- [Titan Portal Quote Swap fields](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/quote-swap.md)
- [Titan Portal venue and provider filters](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/reference/info-venues-providers.md)
- [Titan Portal errors](https://titan-exchange.gitbook.io/titan/developer-doc/developers-portal/errors.md)
- [Titan ONyc RFQ product commentary](https://solanacompass.com/news/onre-liquidity-engine-launches-for-onyc-capital-backed-rfq-quotes-routed-by-titan)
