chain-insights 0.77.1 → 0.79.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.cjs +39 -15
  3. package/dist/cli.mjs +39 -15
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/deployer-screen-4AxZhsrO.cjs +446 -0
  6. package/dist/deployer-screen-eix6pvW7.mjs +413 -0
  7. package/dist/deployer-screen-eix6pvW7.mjs.map +1 -0
  8. package/dist/{dex-registry-CZQB2YhU.cjs → dex-registry-DdXOg5On.cjs} +4 -0
  9. package/dist/{dex-registry-D6Xxi_vr.mjs → dex-registry-sPTFuCrP.mjs} +5 -1
  10. package/dist/dex-registry-sPTFuCrP.mjs.map +1 -0
  11. package/dist/{dex-tool-DsM-pSku.cjs → dex-tool-CDmhhXfk.cjs} +3 -3
  12. package/dist/{dex-tool-BoAYqhZO.mjs → dex-tool-D61sIjpq.mjs} +4 -4
  13. package/dist/{dex-tool-BoAYqhZO.mjs.map → dex-tool-D61sIjpq.mjs.map} +1 -1
  14. package/dist/mcp-proxy.cjs +18 -4
  15. package/dist/mcp-proxy.d.cts.map +1 -1
  16. package/dist/mcp-proxy.d.mts.map +1 -1
  17. package/dist/mcp-proxy.mjs +18 -4
  18. package/dist/mcp-proxy.mjs.map +1 -1
  19. package/dist/{token-lookup-XnyisLQW.mjs → token-lookup-Bv_Fviis.mjs} +5 -4
  20. package/dist/token-lookup-Bv_Fviis.mjs.map +1 -0
  21. package/dist/{token-lookup-BJ00JO9A.cjs → token-lookup-DBN3Lxl7.cjs} +15 -2
  22. package/dist/{tool-visibility-Dy3psowS.mjs → tool-visibility-DlxA8R00.mjs} +3 -2
  23. package/dist/tool-visibility-DlxA8R00.mjs.map +1 -0
  24. package/dist/{tool-visibility-DIpgPULN.cjs → tool-visibility-DwNr6Rp9.cjs} +2 -1
  25. package/docs/contributing.md +4 -2
  26. package/docs/development.md +3 -2
  27. package/docs/graph-tools.md +7 -2
  28. package/docs/mcp-proxy.md +49 -3
  29. package/docs/stability.md +3 -2
  30. package/package.json +2 -2
  31. package/registry/README.md +16 -10
  32. package/registry/robinhood.json +192 -4
  33. package/registry/robinhood.md +93 -5
  34. package/skills/chain-insights-dex/SKILL.md +8 -2
  35. package/skills/chain-insights-dex-launchpad/SKILL.md +7 -10
  36. package/skills/chain-insights-virtuals/SKILL.md +1 -1
  37. package/dist/dex-registry-D6Xxi_vr.mjs.map +0 -1
  38. package/dist/token-lookup-XnyisLQW.mjs.map +0 -1
  39. package/dist/tool-visibility-Dy3psowS.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.mjs";
2
2
  import { t as ANSWER_HINT } from "./answer-hint-vOE1O6Lf.mjs";
3
- import { a as normalizeDexNetwork, t as DexRegistryError } from "./dex-registry-D6Xxi_vr.mjs";
3
+ import { a as normalizeDexNetwork, t as DexRegistryError } from "./dex-registry-sPTFuCrP.mjs";
4
4
  import { i as isEpochMs, o as utcText } from "./print-result-IFARsMnL.mjs";
5
5
  // src/mcp/token-lookup.ts
6
6
  /**
@@ -118,6 +118,7 @@ function rowsOf(answer) {
118
118
  const results = isRecord(query) ? query.results : void 0;
119
119
  return Array.isArray(results) ? results.filter(isRecord) : null;
120
120
  }
121
+ /** The members of a graph_query_batch answer by id. */
121
122
  function membersOf(answer) {
122
123
  const facts = isRecord(answer.structuredContent) ? answer.structuredContent.facts : void 0;
123
124
  const queries = isRecord(facts) ? facts.queries : void 0;
@@ -281,7 +282,7 @@ async function handleMetaTokenLookup(args, deps) {
281
282
  candidates: [],
282
283
  total: 0,
283
284
  truncated: false,
284
- hint: `${ANSWER_HINT} This Chain Insights server does not serve the token lookup yet (${read.refusal.code}). That is not "no contract carries ${symbol}": ask the user for the token's contract, 0x plus 40 hex characters. ${NO_WEB}`
285
+ hint: `${ANSWER_HINT} This lookup gave no answer (${read.refusal.code}). That is not "no contract carries ${symbol}": ask the user for the token's contract, 0x plus 40 hex characters. ${NO_WEB}`
285
286
  });
286
287
  const total = read.rows.length;
287
288
  const candidates = read.rows.slice(0, CANDIDATES_MAX).map(candidateOf).filter((candidate) => candidate !== null);
@@ -298,6 +299,6 @@ async function handleMetaTokenLookup(args, deps) {
298
299
  hint: hintFor(result, creatorsNotRead)
299
300
  });
300
301
  }
301
- export { SYMBOL_MAX as a, META_TOKEN_LOOKUP_TOOL as i, META_TOKEN_LOOKUP_DESCRIPTION as n, handleMetaTokenLookup as o, META_TOKEN_LOOKUP_TITLE as r, token_lookup_exports as s, META_TOKEN_LOOKUP_ANNOTATIONS as t };
302
+ export { SYMBOL_MAX as a, refusalOf as c, META_TOKEN_LOOKUP_TOOL as i, token_lookup_exports as l, META_TOKEN_LOOKUP_DESCRIPTION as n, handleMetaTokenLookup as o, META_TOKEN_LOOKUP_TITLE as r, membersOf as s, META_TOKEN_LOOKUP_ANNOTATIONS as t };
302
303
 
303
- //# sourceMappingURL=token-lookup-XnyisLQW.mjs.map
304
+ //# sourceMappingURL=token-lookup-Bv_Fviis.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-lookup-Bv_Fviis.mjs","names":[],"sources":["../src/mcp/token-lookup.ts"],"sourcesContent":["/**\n * meta_token_lookup: a ticker or a token name becomes its contracts.\n *\n * A local tool of the proxy. It sends one anchored facts read of the Asset\n * lookup by symbol, the same read by name when the symbol answers nothing, and\n * then the creator and the factory of each candidate from topology, one batch\n * member per candidate. Nothing is matched here: the graph server matches the\n * symbol or the name, case-insensitively and exactly, and orders the rows\n * verified first, then oldest first. The proxy keeps that order.\n *\n * Tickers collide on purpose: clones reuse a symbol to borrow its trust. The\n * tool never picks one. The description below is the contract with every\n * host, Claude Desktop chat included, which reads no skill.\n */\n\nimport { ANSWER_HINT } from './answer-hint.js'\nimport { DexRegistryError, normalizeDexNetwork } from './dex-registry.js'\nimport { isEpochMs, utcText } from './timestamp-text.js'\n\nexport const META_TOKEN_LOOKUP_TOOL = 'meta_token_lookup'\nexport const META_TOKEN_LOOKUP_SCHEMA = 'chain-insights.meta-token-lookup.v1' as const\nexport const META_TOKEN_LOOKUP_TITLE = 'Token by ticker or name'\nexport const META_TOKEN_LOOKUP_DESCRIPTION =\n 'Call this first when a question names a token by its ticker or name and gives no contract ' +\n '(TCITY, USDG, SPCX). It returns every contract on the network that carries that symbol, ' +\n 'verified first, then oldest first. Tickers collide: never treat the first row as the token. ' +\n 'When several match, name them and ask, or pick by the evidence the user gave. Zero candidates ' +\n 'means no contract carries the symbol: say so, and do not search the web.'\nexport const META_TOKEN_LOOKUP_ANNOTATIONS = {\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n} as const\nexport const META_TOKEN_LOOKUP_ARGS = ['network', 'symbol'] as const\n\n/** The candidates returned. The read asks for one more, so a full page says there are more. */\nexport const CANDIDATES_MAX = 25\nexport const ROWS_READ = CANDIDATES_MAX + 1\n/** The graph server admits at most 20 members in one graph_query_batch. */\nexport const CREATOR_BATCH_MAX = 20\nexport const SYMBOL_MAX = 64\n\nexport const ADDRESS_INPUT_HINT = 'an address is already an anchor: read it on USE topology'\n\nexport interface TokenCandidate {\n contract: string\n symbol: string | null\n name: string | null\n token_standard: string | null\n decimals: number | null\n verified: boolean\n verification_source: string | null\n first_seen_timestamp: number | null\n first_seen_timestamp_utc: string | null\n creator: string | null\n factory: string | null\n}\n\nexport interface MetaTokenLookupResult {\n schema: typeof META_TOKEN_LOOKUP_SCHEMA\n network: string\n query: string\n matched_on: 'symbol' | 'name' | null\n candidates: TokenCandidate[]\n /** The rows the server sent, at most 26: 26 means there are more than the 25 returned. */\n total: number\n truncated: boolean\n hint: string\n}\n\n/** One graph_query or graph_query_batch reply as the remote client returns it. */\nexport type GraphAnswer = {\n content?: unknown[]\n structuredContent?: unknown\n isError?: boolean\n}\n\nexport interface TokenToolDependencies {\n /** One graph_query through the proxy's remote client, billed as any read. */\n graphQuery: (args: { network: string; query: string }) => Promise<GraphAnswer>\n /** One graph_query_batch through the proxy's remote client, billed as any read. */\n graphQueryBatch: (args: {\n network: string\n queries: Array<{ id: string; query: string }>\n }) => Promise<GraphAnswer>\n /** The reason no read can be sent now, or undefined when the graph is reachable. */\n unavailable?: () => Promise<string | undefined> | string | undefined\n /** The text of a call that threw: payment required, transport. */\n describeFailure: (err: unknown) => string\n}\n\nexport type MetaTokenLookupToolResult = {\n content: Array<{ type: 'text'; text: string }>\n structuredContent?: Record<string, unknown>\n isError: boolean\n}\n\nconst ADDRESS_FORM = /^0x[0-9a-fA-F]{40}$/\nconst CONTRACT_FORM = /^0x[0-9a-f]{40}$/\n// A string literal of the read holds no double quote, no backslash and no\n// control character: the symbol is refused rather than escaped, so the read the\n// server receives is always the read written here.\nfunction unsafeLiteral(text: string): boolean {\n for (const char of text) {\n const code = char.codePointAt(0)!\n if (char === '\"' || char === '\\\\' || code < 0x20 || code === 0x7f) return true\n }\n return false\n}\nconst CODE_PREFIX = /^([a-z][a-z0-9_]*):\\s*/\n// Codes of a read that was stopped, not refused: the same read may answer later.\nconst TRANSIENT_CODE =\n /(timeout|memory_limit|cpu_limit|busy|_failed$|rate_limited|unavailable|too_large|node_error)/\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nfunction errorResult(text: string): MetaTokenLookupToolResult {\n return { content: [{ type: 'text', text }], isError: true }\n}\n\nfunction textResult(structured: MetaTokenLookupResult): MetaTokenLookupToolResult {\n return {\n content: [{ type: 'text', text: JSON.stringify(structured, null, 2) }],\n structuredContent: structured as unknown as Record<string, unknown>,\n isError: false,\n }\n}\n\n/** The facts Asset read by symbol or by name, in the one shape the graph server admits. */\nexport function assetQuery(key: 'symbol' | 'name', value: string): string {\n return (\n `USE facts MATCH (t:Asset {${key}: \"${value}\"}) ` +\n 'RETURN t.asset_contract AS contract, t.asset_symbol AS symbol, t.name AS name, ' +\n 't.token_standard AS token_standard, t.decimals AS decimals, t.verified AS verified, ' +\n 't.verification_source AS verification_source, t.first_seen_timestamp AS first_seen_timestamp ' +\n `LIMIT ${ROWS_READ}`\n )\n}\n\n/** The topology read of who deployed one contract: the deploying address and the transaction's sender. */\nexport function creatorQuery(contract: string): string {\n return (\n `USE topology MATCH (f:Address)-[d:DEPLOYED_CONTRACT]->(t:Address {address: \"${contract}\"}) ` +\n 'RETURN f.address AS factory, d.tx_origin AS creator LIMIT 1'\n )\n}\n\nconst textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value : null\n\nconst numberOrNull = (value: unknown): number | null => {\n if (typeof value === 'number' && Number.isFinite(value)) return value\n if (typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value)))\n return Number(value)\n return null\n}\n\nconst addressOrNull = (value: unknown): string | null =>\n typeof value === 'string' && ADDRESS_FORM.test(value.trim()) ? value.trim().toLowerCase() : null\n\nfunction verifiedOf(value: unknown): boolean {\n if (typeof value === 'boolean') return value\n if (typeof value === 'number') return value === 1\n if (typeof value === 'string') return ['true', '1'].includes(value.trim().toLowerCase())\n return false\n}\n\nfunction answerText(answer: GraphAnswer): string {\n return (Array.isArray(answer.content) ? answer.content : [])\n .map((block) => (isRecord(block) && typeof block.text === 'string' ? block.text : ''))\n .filter(Boolean)\n .join('\\n')\n .trim()\n}\n\nexport type Refusal = { code: string; text: string; transient: boolean }\n\n/** A graph_query answer that did not answer: its code, its text, and whether the same read may answer later. */\nexport function refusalOf(answer: GraphAnswer): Refusal {\n const text = answerText(answer)\n const detail = isRecord(answer.structuredContent)\n ? answer.structuredContent.error_detail\n : undefined\n const detailCode = isRecord(detail) && typeof detail.code === 'string' ? detail.code : ''\n const detailClass = isRecord(detail) && typeof detail.class === 'string' ? detail.class : ''\n const named = detailCode || CODE_PREFIX.exec(text)?.[1] || ''\n // A refusal that names no class is a stop only when its code says so; a\n // refusal in plain words (\"unknown label Asset\") is a server that lacks the read.\n const transient = detailClass ? detailClass !== 'refused' : TRANSIENT_CODE.test(named)\n const code = named || 'not_served'\n return { code, text: text || `${code}: the graph endpoint refused the read`, transient }\n}\n\n/** The result rows of a graph_query answer, or null when it holds none. */\nfunction rowsOf(answer: GraphAnswer): Array<Record<string, unknown>> | null {\n const facts = isRecord(answer.structuredContent) ? answer.structuredContent.facts : undefined\n const query = isRecord(facts) ? facts.query : undefined\n const results = isRecord(query) ? query.results : undefined\n return Array.isArray(results) ? results.filter(isRecord) : null\n}\n\nexport type Member = { id?: unknown; ok?: unknown; results?: unknown; error?: unknown }\n\n/** The members of a graph_query_batch answer by id. */\nexport function membersOf(answer: GraphAnswer): Map<string, Member> {\n const facts = isRecord(answer.structuredContent) ? answer.structuredContent.facts : undefined\n const queries = isRecord(facts) ? facts.queries : undefined\n const members = new Map<string, Member>()\n if (Array.isArray(queries)) {\n for (const member of queries)\n if (isRecord(member) && typeof member.id === 'string') members.set(member.id, member)\n }\n return members\n}\n\nfunction candidateOf(row: Record<string, unknown>): TokenCandidate | null {\n const contract = textOrNull(row.contract)?.trim().toLowerCase()\n if (!contract) return null\n const firstSeen = numberOrNull(row.first_seen_timestamp)\n return {\n contract,\n symbol: textOrNull(row.symbol),\n name: textOrNull(row.name),\n token_standard: textOrNull(row.token_standard),\n decimals: numberOrNull(row.decimals),\n verified: verifiedOf(row.verified),\n verification_source: textOrNull(row.verification_source),\n first_seen_timestamp: firstSeen,\n first_seen_timestamp_utc: isEpochMs(firstSeen) ? utcText(firstSeen) : null,\n creator: null,\n factory: null,\n }\n}\n\ntype Read =\n | { kind: 'rows'; rows: Array<Record<string, unknown>> }\n | { kind: 'not_served'; refusal: Refusal }\n | { kind: 'failed'; text: string }\n\nasync function readAssets(\n deps: TokenToolDependencies,\n network: string,\n key: 'symbol' | 'name',\n value: string\n): Promise<Read> {\n let answer: GraphAnswer\n try {\n answer = await deps.graphQuery({ network, query: assetQuery(key, value) })\n } catch (err) {\n return { kind: 'failed', text: deps.describeFailure(err) }\n }\n const rows = rowsOf(answer)\n if (answer.isError !== true && rows !== null) return { kind: 'rows', rows }\n const refusal = refusalOf(answer)\n if (answer.isError === true && refusal.transient) return { kind: 'failed', text: refusal.text }\n return { kind: 'not_served', refusal }\n}\n\n/**\n * The creator and the factory of each candidate, written in place. Returns why\n * some creators were not read, or null when every read answered. A read that\n * answered with no row leaves the candidate's creator empty with no note: the\n * graph holds no deployment for it.\n */\nasync function readCreators(\n deps: TokenToolDependencies,\n network: string,\n candidates: TokenCandidate[]\n): Promise<string | null> {\n const contracts = [\n ...new Set(candidates.map((c) => c.contract).filter((c) => CONTRACT_FORM.test(c))),\n ]\n const found = new Map<string, { creator: string | null; factory: string | null }>()\n const reasons: string[] = []\n let unread = candidates.length - candidates.filter((c) => CONTRACT_FORM.test(c.contract)).length\n for (let at = 0; at < contracts.length; at += CREATOR_BATCH_MAX) {\n const chunk = contracts.slice(at, at + CREATOR_BATCH_MAX)\n const queries = chunk.map((contract) => ({\n id: `creator:${contract}`,\n query: creatorQuery(contract),\n }))\n let members = new Map<string, Member>()\n try {\n const answer = await deps.graphQueryBatch({ network, queries })\n members = membersOf(answer)\n if (members.size === 0) {\n reasons.push(\n answer.isError === true ? refusalOf(answer).text : 'the batch answer held no reads'\n )\n }\n } catch (err) {\n reasons.push(deps.describeFailure(err))\n }\n for (const contract of chunk) {\n const member = members.get(`creator:${contract}`)\n if (member?.ok === true && Array.isArray(member.results)) {\n const row = member.results.find(isRecord)\n found.set(contract, {\n creator: row ? addressOrNull(row.creator) : null,\n factory: row ? addressOrNull(row.factory) : null,\n })\n continue\n }\n unread += 1\n if (member && typeof member.error === 'string' && !reasons.includes(member.error))\n reasons.push(member.error)\n }\n }\n for (const candidate of candidates) {\n const read = found.get(candidate.contract)\n if (read) Object.assign(candidate, read)\n }\n if (unread === 0) return null\n return `${unread} of ${candidates.length}${reasons.length > 0 ? `: ${reasons.join('; ')}` : ''}`\n}\n\nconst NO_WEB =\n 'Do not search the web and do not guess a contract: a web page is not a contract on this network.'\n\nfunction hintFor(\n result: Omit<MetaTokenLookupResult, 'hint'>,\n creatorsNotRead: string | null\n): string {\n const { network, query, candidates, matched_on, truncated } = result\n const parts: string[] = [ANSWER_HINT]\n if (candidates.length === 0) {\n parts.push(\n `No contract on ${network} carries the symbol or the name \"${query}\". Say so in one line. ${NO_WEB} ` +\n 'Ask the user for the contract if they have one.'\n )\n return parts.join(' ')\n }\n if (matched_on === 'name') {\n parts.push(`No contract carries \"${query}\" as its symbol; these carry it as their name.`)\n }\n if (candidates.length === 1) {\n parts.push(\n `One contract on ${network} carries \"${query}\": ${candidates[0]!.contract}. ` +\n 'Say it is the only one on this network, then read it by this full contract on USE topology.'\n )\n } else {\n parts.push(\n `${candidates.length} contracts on ${network} carry \"${query}\"` +\n `${truncated ? `, and more exist than the ${CANDIDATES_MAX} listed` : ''}. ` +\n 'Tickers collide: never treat the first row as the token. Name them, each contract in full, ' +\n 'with its creator and first seen time, and ask which one the user means, or pick one by the evidence the user gave ' +\n '(a creator, a launch date, a price move) and say why.'\n )\n }\n if (creatorsNotRead) {\n parts.push(\n `The creators were not read for ${creatorsNotRead}. creator and factory are empty there because the read failed, ` +\n 'not because the chain holds none.'\n )\n }\n parts.push('Write every contract and creator in full, 0x plus 40 hex characters.')\n return parts.join(' ')\n}\n\n/** meta_token_lookup, {network, symbol}. Every argument is checked before a read is sent. */\nexport async function handleMetaTokenLookup(\n args: unknown,\n deps: TokenToolDependencies\n): Promise<MetaTokenLookupToolResult> {\n const record = isRecord(args) ? args : {}\n let network: string\n try {\n network = normalizeDexNetwork(record.network)\n } catch (err) {\n return errorResult(\n err instanceof DexRegistryError ? err.message : `invalid_network: ${(err as Error).message}`\n )\n }\n if (typeof record.symbol !== 'string' || record.symbol.trim() === '') {\n return errorResult(\n 'invalid_symbol: symbol is required: the ticker or the name as the user wrote it, for example TCITY'\n )\n }\n const symbol = record.symbol.trim()\n if (symbol.length > SYMBOL_MAX) {\n return errorResult(`invalid_symbol: symbol holds at most ${SYMBOL_MAX} characters`)\n }\n const base = {\n schema: META_TOKEN_LOOKUP_SCHEMA,\n network,\n query: symbol,\n }\n\n if (ADDRESS_FORM.test(symbol)) {\n const address = symbol.toLowerCase()\n return textResult({\n ...base,\n matched_on: null,\n candidates: [],\n total: 0,\n truncated: false,\n hint: `${ANSWER_HINT} ${address} is a contract address, not a ticker: ${ADDRESS_INPUT_HINT}. Send no token lookup for it.`,\n })\n }\n if (unsafeLiteral(symbol)) {\n return errorResult(\n 'invalid_symbol: a symbol holds no double quote, backslash or control character. Send the ticker or the name as plain text.'\n )\n }\n\n const unavailable = await deps.unavailable?.()\n if (unavailable) {\n return errorResult(\n `No token read was sent: ${unavailable} The lookup has no answer yet, which is not \"no contract\": try again later, or ask the user for the contract. ${NO_WEB}`\n )\n }\n\n let matchedOn: 'symbol' | 'name' = 'symbol'\n let read = await readAssets(deps, network, 'symbol', symbol)\n if (read.kind === 'rows' && read.rows.length === 0) {\n matchedOn = 'name'\n read = await readAssets(deps, network, 'name', symbol)\n }\n if (read.kind === 'failed') {\n return errorResult(\n `The token read failed: ${read.text} This is not \"no contract\": send the same lookup again once, or ask the user for the contract. ${NO_WEB}`\n )\n }\n if (read.kind === 'not_served') {\n return textResult({\n ...base,\n matched_on: null,\n candidates: [],\n total: 0,\n truncated: false,\n hint:\n `${ANSWER_HINT} This lookup gave no answer (${read.refusal.code}). ` +\n `That is not \"no contract carries ${symbol}\": ask the user for the token's contract, 0x plus 40 hex characters. ${NO_WEB}`,\n })\n }\n\n const total = read.rows.length\n const candidates = read.rows\n .slice(0, CANDIDATES_MAX)\n .map(candidateOf)\n .filter((candidate): candidate is TokenCandidate => candidate !== null)\n const creatorsNotRead =\n candidates.length > 0 ? await readCreators(deps, network, candidates) : null\n const result = {\n ...base,\n matched_on: candidates.length > 0 ? matchedOn : null,\n candidates,\n total,\n truncated: total > CANDIDATES_MAX,\n }\n return textResult({ ...result, hint: hintFor(result, creatorsNotRead) })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,yBAAyB;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,KAAK,QAAQ,KAAK,sCAC5B,OAAO,uEAAuE;CACtH,CAAC;CAGH,MAAM,QAAQ,KAAK,KAAK;CACxB,MAAM,aAAa,KAAK,KACrB,MAAM,GAAG,cAAc,CAAC,CACxB,IAAI,WAAW,CAAC,CAChB,QAAQ,cAA2C,cAAc,IAAI;CACxE,MAAM,kBACJ,WAAW,SAAS,IAAI,MAAM,aAAa,MAAM,SAAS,UAAU,IAAI;CAC1E,MAAM,SAAS;EACb,GAAG;EACH,YAAY,WAAW,SAAS,IAAI,YAAY;EAChD;EACA;EACA,WAAW,QAAQ;CACrB;CACA,OAAO,WAAW;EAAE,GAAG;EAAQ,MAAM,QAAQ,QAAQ,eAAe;CAAE,CAAC;AACzE"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BW-eSwOZ.cjs");
2
2
  const require_answer_hint = require("./answer-hint-BlYEBq_Y.cjs");
3
- const require_dex_registry = require("./dex-registry-CZQB2YhU.cjs");
3
+ const require_dex_registry = require("./dex-registry-DdXOg5On.cjs");
4
4
  const require_print_result = require("./print-result-BYppJlUi.cjs");
5
5
  // src/mcp/token-lookup.ts
6
6
  /**
@@ -118,6 +118,7 @@ function rowsOf(answer) {
118
118
  const results = isRecord(query) ? query.results : void 0;
119
119
  return Array.isArray(results) ? results.filter(isRecord) : null;
120
120
  }
121
+ /** The members of a graph_query_batch answer by id. */
121
122
  function membersOf(answer) {
122
123
  const facts = isRecord(answer.structuredContent) ? answer.structuredContent.facts : void 0;
123
124
  const queries = isRecord(facts) ? facts.queries : void 0;
@@ -281,7 +282,7 @@ async function handleMetaTokenLookup(args, deps) {
281
282
  candidates: [],
282
283
  total: 0,
283
284
  truncated: false,
284
- hint: `${require_answer_hint.ANSWER_HINT} This Chain Insights server does not serve the token lookup yet (${read.refusal.code}). That is not "no contract carries ${symbol}": ask the user for the token's contract, 0x plus 40 hex characters. ${NO_WEB}`
285
+ hint: `${require_answer_hint.ANSWER_HINT} This lookup gave no answer (${read.refusal.code}). That is not "no contract carries ${symbol}": ask the user for the token's contract, 0x plus 40 hex characters. ${NO_WEB}`
285
286
  });
286
287
  const total = read.rows.length;
287
288
  const candidates = read.rows.slice(0, CANDIDATES_MAX).map(candidateOf).filter((candidate) => candidate !== null);
@@ -334,6 +335,18 @@ Object.defineProperty(exports, "handleMetaTokenLookup", {
334
335
  return handleMetaTokenLookup;
335
336
  }
336
337
  });
338
+ Object.defineProperty(exports, "membersOf", {
339
+ enumerable: true,
340
+ get: function() {
341
+ return membersOf;
342
+ }
343
+ });
344
+ Object.defineProperty(exports, "refusalOf", {
345
+ enumerable: true,
346
+ get: function() {
347
+ return refusalOf;
348
+ }
349
+ });
337
350
  Object.defineProperty(exports, "token_lookup_exports", {
338
351
  enumerable: true,
339
352
  get: function() {
@@ -49,7 +49,8 @@ const PUBLIC_MCP_TOOL_ALLOWED_ARGS = {
49
49
  "address",
50
50
  "pools"
51
51
  ],
52
- meta_token_lookup: ["network", "symbol"]
52
+ meta_token_lookup: ["network", "symbol"],
53
+ aml_deployer_screen: ["network", "address"]
53
54
  };
54
55
  function isHiddenRemoteToolName(name) {
55
56
  return HIDDEN_REMOTE_TOOL_NAMES.has(name);
@@ -87,4 +88,4 @@ function validatePublicMcpToolArguments(name, args) {
87
88
  }
88
89
  export { tool_visibility_exports as a, isAppOnlyTool as i, PUBLIC_MCP_TOOL_ALLOWED_ARGS as n, PUBLIC_MCP_TOOL_REQUIRED_ARGS as r, HIDDEN_REMOTE_TOOL_NAMES as t };
89
90
 
90
- //# sourceMappingURL=tool-visibility-Dy3psowS.mjs.map
91
+ //# sourceMappingURL=tool-visibility-DlxA8R00.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-visibility-DlxA8R00.mjs","names":[],"sources":["../src/mcp/tool-visibility.ts"],"sourcesContent":["import { McpToolError, formatMcpToolError } from './print-result.js'\n\nexport const HIDDEN_REMOTE_TOOL_NAMES = new Set([\n 'topup',\n 'address_risk',\n // Hidden until its verdict is fixed: never listed, never registered, never\n // called through the proxy. The remote graph endpoint does not serve it.\n 'aml_address_risk',\n 'trace_victim_funds',\n 'trace_suspect_funds',\n 'trace_deposit_sources',\n 'trace_funds',\n 'track_funds',\n // Retired tools: never exposed publicly. Built by concatenation so the\n // retired names do not appear as literals in this file.\n ['aml_trace_victim', '_funds'].join(''),\n ['aml_trace_suspect', '_funds'].join(''),\n ['aml_trace_deposit', '_sources'].join(''),\n 'network_capabilities',\n 'usage_status',\n 'subscription_status',\n 'balance',\n 'help',\n ['money', '_flows_between_exchanges'].join(''),\n 'address_connection_risk',\n])\n\nexport const PUBLIC_MCP_TOOL_REQUIRED_ARGS: Record<string, string[]> = {\n graph_query: ['query', 'network'],\n graph_query_batch: ['network', 'queries'],\n}\n\n// normalizeRemoteToolArguments FILTERS pass-through arguments to this list, so\n// an argument that is missing here is silently STRIPPED and the caller gets a\n// default-bounded result with no error and no warning. `time_scope` shipped\n// broken for exactly this reason. Every tunable search bound below\n// (per_address_limit, row_limit) must therefore be listed the moment it\n// appears on a tool schema, and is covered end-to-end through the proxy in\n// tests/mcp-proxy.test.ts.\nexport const PUBLIC_MCP_TOOL_ALLOWED_ARGS: Record<string, string[]> = {\n // `time_scope` narrows a `USE topology` query to a temporal-shard subset\n graph_query: ['query', 'network', 'time_scope'],\n graph_query_batch: ['network', 'queries', 'per_query_timeout_seconds', 'time_scope'],\n // A local tool of the proxy (src/mcp/dex-tool.ts): the exchange by name.\n meta_dex_lookup: ['network', 'name', 'address', 'pools'],\n // A local tool of the proxy (src/mcp/token-lookup.ts): the contracts of a ticker.\n meta_token_lookup: ['network', 'symbol'],\n // A local tool of the proxy (src/mcp/deployer-screen.ts): who is behind a token or a wallet.\n aml_deployer_screen: ['network', 'address'],\n}\n\nexport function isHiddenRemoteToolName(name: string): boolean {\n return HIDDEN_REMOTE_TOOL_NAMES.has(name)\n}\n\n/**\n * True for an MCP Apps tool only a view may call: `_meta.ui.visibility` is set\n * and does not include \"model\" (for example graph_expand, visibility [\"app\"]).\n * Such a tool never appears in a tool list built for the model or the CLI.\n */\nexport function isAppOnlyTool(tool: { _meta?: Record<string, unknown> }): boolean {\n const ui = tool._meta?.ui\n if (!ui || typeof ui !== 'object' || Array.isArray(ui)) return false\n const visibility = (ui as Record<string, unknown>).visibility\n return Array.isArray(visibility) && !visibility.includes('model')\n}\n\nexport function visibleRemoteTools<T extends { name: string; _meta?: Record<string, unknown> }>(\n tools: T[]\n): T[] {\n return tools.filter((tool) => !isHiddenRemoteToolName(tool.name) && !isAppOnlyTool(tool))\n}\n\nexport function assertPublicMcpToolName(name: string): void {\n if (!isHiddenRemoteToolName(name)) return\n const replacement =\n name === 'network_capabilities'\n ? ' Use meta_network_capabilities instead.'\n : name === 'usage_status'\n ? ' Use meta_usage_status instead.'\n : name === 'subscription_status'\n ? ' Use meta_subscription_status instead.'\n : name === 'balance'\n ? ' Use wallet_balance instead.'\n : name === 'help'\n ? ' Use meta_help instead.'\n : ''\n throw new Error(`MCP tool '${name}' is not exposed by Chain Insights.${replacement}`)\n}\n\nexport function formatMcpCallError(tool: string, err: unknown): string {\n // A tool error with an envelope is the server's own answer: its text, then the\n // line of its error_detail. It is never matched against the unknown-tool\n // pattern below. A tool error with no envelope keeps the old reading, because\n // a server can answer an unknown tool as an error reply.\n if (err instanceof McpToolError && err.errorDetail) return formatMcpToolError(err)\n const message = err instanceof Error ? err.message : String(err)\n if (/\\bunknown tool\\b|\\btool\\b.*\\bnot found\\b/i.test(message)) {\n return `Unknown MCP tool \"${tool}\". Run \\`cia mcp tools --refresh\\` to list available tools.`\n }\n return message\n}\n\nexport function validatePublicMcpToolArguments(name: string, args: Record<string, unknown>): void {\n const allowedArgs = PUBLIC_MCP_TOOL_ALLOWED_ARGS[name]\n if (!allowedArgs) return\n\n const unsupportedArgs = Object.keys(args).filter((argName) => !allowedArgs.includes(argName))\n if (unsupportedArgs.length === 0) return\n\n throw new Error(\n [\n `Unsupported argument${unsupportedArgs.length === 1 ? '' : 's'}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C,MAAM,IAAI,MAAM,aAAa,KAAK,qCAXhC,SAAS,yBACL,4CACA,SAAS,iBACP,oCACA,SAAS,wBACP,2CACA,SAAS,YACP,iCACA,SAAS,SACP,4BACA,IACsE;AACtF;AAEA,SAAgB,mBAAmB,MAAc,KAAsB;CAKrE,IAAI,eAAe,gBAAgB,IAAI,aAAa,OAAO,mBAAmB,GAAG;CACjF,MAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;CAC/D,IAAI,4CAA4C,KAAK,OAAO,GAC1D,OAAO,qBAAqB,KAAK;CAEnC,OAAO;AACT;AAEA,SAAgB,+BAA+B,MAAc,MAAqC;CAChG,MAAM,cAAc,6BAA6B;CACjD,IAAI,CAAC,aAAa;CAElB,MAAM,kBAAkB,OAAO,KAAK,IAAI,CAAC,CAAC,QAAQ,YAAY,CAAC,YAAY,SAAS,OAAO,CAAC;CAC5F,IAAI,gBAAgB,WAAW,GAAG;CAElC,MAAM,IAAI,MACR,CACE,uBAAuB,gBAAgB,WAAW,IAAI,KAAK,IAAI,OAAO,KAAK,IAAI,gBAAgB,KAAK,IAAI,EAAE,IAC1G,sBAAsB,YAAY,KAAK,IAAI,EAAE,EAC/C,CAAC,CAAC,KAAK,GAAG,CACZ;AACF"}
@@ -49,7 +49,8 @@ const PUBLIC_MCP_TOOL_ALLOWED_ARGS = {
49
49
  "address",
50
50
  "pools"
51
51
  ],
52
- meta_token_lookup: ["network", "symbol"]
52
+ meta_token_lookup: ["network", "symbol"],
53
+ aml_deployer_screen: ["network", "address"]
53
54
  };
54
55
  function isHiddenRemoteToolName(name) {
55
56
  return HIDDEN_REMOTE_TOOL_NAMES.has(name);
@@ -14,8 +14,10 @@ node bin/cli.js --help
14
14
 
15
15
  ## Adding AML Tools
16
16
 
17
- No AML tool lives in the Chain Insights layer today. `aml_address_risk` is
18
- hidden until its verdict is fixed.
17
+ One AML tool lives in the Chain Insights layer today: `aml_deployer_screen`, a
18
+ local tool of the MCP proxy that returns facts about who is behind a token or
19
+ a wallet, never a score. `aml_address_risk` is hidden until its verdict is
20
+ fixed.
19
21
 
20
22
  When adding a tool, document:
21
23
 
@@ -80,7 +80,7 @@ names the source file it was verified against.
80
80
  ### Public MCP Tool Surface
81
81
 
82
82
  - The canonical public tool surface is the prefixed set `graph_*` /
83
- `meta_*` / `wallet_*`.
83
+ `meta_*` / `wallet_*`, plus the local AML tool `aml_deployer_screen`.
84
84
  - `visibleRemoteTools()` in `src/mcp/tool-visibility.ts` hides unprefixed
85
85
  backend names (`address_risk`, `trace_victim_funds`, `trace_suspect_funds`,
86
86
  `trace_deposit_sources`, `trace_funds`, `track_funds`,
@@ -89,7 +89,8 @@ names the source file it was verified against.
89
89
  `HIDDEN_REMOTE_TOOL_NAMES`. They never surface publicly. So does
90
90
  `aml_address_risk`, hidden until its verdict is fixed.
91
91
  - Local tools live in `src/mcp/proxy.ts` (`LOCAL_TOOL_NAMES`):
92
- `meta_network_capabilities`, `meta_schema`, `meta_rules`, `meta_help`,
92
+ `meta_network_capabilities`, `meta_schema`, `meta_dex_lookup`,
93
+ `meta_token_lookup`, `aml_deployer_screen`, `meta_rules`, `meta_help`,
93
94
  `meta_usage_status`, `meta_subscription_status`, `wallet_balance`,
94
95
  `wallet_topup`, `subscription_topup`, and `graph_expand`, which only the view calls
95
96
  (`APP_ONLY_LOCAL_TOOL_NAMES`).
@@ -29,9 +29,14 @@ each network's remote tools.
29
29
  Use `cia mcp call` for low-level GraphRAG calls and custom read-only queries.
30
30
 
31
31
  The Chain Insights MCP proxy adds the local tools `meta_network_capabilities`,
32
- `meta_schema`, `meta_rules`, `meta_help`, `meta_usage_status`,
32
+ `meta_schema`, `meta_dex_lookup`, `meta_token_lookup`, `aml_deployer_screen`,
33
+ `meta_rules`, `meta_help`, `meta_usage_status`,
33
34
  `meta_subscription_status`, `wallet_balance`, `wallet_topup` and
34
- `subscription_topup`. On hosted
35
+ `subscription_topup`. `aml_deployer_screen` screens who is behind a token or a
36
+ wallet from two anchored topology reads: the launcher, its first funder and
37
+ what kind of wallet that is, their labels and the first inbound bridge
38
+ deposit. It returns facts only, never a score; see
39
+ [MCP proxy](mcp-proxy.md#local-tools). On hosted
35
40
  backends, `meta_usage_status` can reflect remote quota telemetry. On
36
41
  backends without a quota tool, Chain Insights returns a local unmetered
37
42
  primitive-backend status instead.
package/docs/mcp-proxy.md CHANGED
@@ -83,6 +83,7 @@ The proxy:
83
83
  | `meta_schema` | Show the live graph schema of a network: labels, link types, fields, indexes |
84
84
  | `meta_dex_lookup` | Turn an exchange name into its factories, routers or manager, pools and first reads |
85
85
  | `meta_token_lookup` | Turn a ticker or a token name into every contract that carries it, with its creator |
86
+ | `aml_deployer_screen` | Screen who is behind a token or a wallet: launcher, first funder, labels, facts only |
86
87
  | `meta_rules` | Read the answer rules when the `chain-insights-cypher` skill is not loaded |
87
88
  | `meta_help` | Show Chain Insights tool and workflow guidance |
88
89
  | `meta_usage_status` | Check the caller's daily free-tier graph query allowance |
@@ -153,12 +154,57 @@ never picks one.
153
154
 
154
155
  Zero candidates is an answer: no contract on the network carries the symbol
155
156
  or the name. A contract address sent as `symbol` sends no read: an address is
156
- already an anchor, read it on `USE topology`. A server that does not serve the
157
- `Asset` read yet answers with no candidates and a `hint` to ask the user for
158
- the contract. Both reads are billed as any read.
157
+ already an anchor, read it on `USE topology`. When the `Asset` read is refused, the
158
+ tool answers with no candidates and a `hint` to ask the user for the contract. Both reads are billed as any read.
159
159
  `cia mcp call meta_token_lookup network=robinhood symbol=TCITY` runs the same
160
160
  lookup in a terminal.
161
161
 
162
+ `aml_deployer_screen` screens who is behind a token or a wallet. It takes
163
+ `network` and `address` (both required; `address` is a token contract or a
164
+ wallet, 0x plus 40 hex characters, any case). It returns facts only: never a
165
+ score, a risk level or a verdict. The caller decides.
166
+
167
+ ```mermaid
168
+ flowchart LR
169
+ F["first funder<br/>kind, labels, how many it paid"] -->|"first inbound flow"| L["launcher<br/>the creation sender"]
170
+ C["remote chain"] -->|"first bridge deposit"| L
171
+ L -->|"creation transaction"| T["token contract"]
172
+ ```
173
+
174
+ 1. One `graph_query_batch` sends two reads on `USE topology`, both anchored on
175
+ the address. The `token` read takes the address as a contract: its first
176
+ creation, and the launcher, the wallet that sent the creation transaction.
177
+ The `wallet` read takes the address as the launcher itself. Both read the
178
+ launcher's first inbound flow of all time (its first funder) and its first
179
+ inbound bridge deposit.
180
+ 2. When the `token` read holds a row, `input_kind` is `token` and `creation`
181
+ names the transaction, block, time, deployer, factory and `mode`
182
+ (`direct` or `factory`). Otherwise the `wallet` read answers and
183
+ `input_kind` is `wallet`. When neither holds a row, `found` is false: the
184
+ graph holds no node for the address. That is an answer, not an error.
185
+ 3. `launcher` and `first_funder` carry their roles (the graph labels), their
186
+ first activity, their degree (how many distinct addresses they received
187
+ from or paid) and `crime`: the sanctions, scam, victim and issuer-frozen
188
+ marks, and each risk label with its level. `first_funder.kind` is the
189
+ first of `scam`, `mixer`, `exchange`, `bridge`, `bundler`, `launchpad` (a
190
+ pool or a protocol), `contract` (a contract with no other role) that its
191
+ roles name, or `wallet`. It also carries
192
+ when and how often it paid the launcher, and the value in USD.
193
+ 4. `launcher_resolved` is false when the launcher is a bundler: a bundler sends
194
+ transactions for others, so the person behind the launch is not known.
195
+ 5. `bridged_in` names the first inbound bridge deposit: the remote chain, the
196
+ bridge endpoint, the kind, the asset and the first block.
197
+ 6. `not_covered` lists what the graph cannot see yet: `exploit_labels`,
198
+ `ml_labels`, `bridge_sender` (who sent a bridge deposit on the other chain)
199
+ and `ethereum_history`.
200
+
201
+ A fresh launcher funded by a wallet that paid few addresses is the pattern to
202
+ look at. A funder that paid thousands is shared infrastructure, such as a
203
+ bridge or an exchange. Every timestamp has its `_utc` text twin. A failed read
204
+ is an error that says it is not "not found". The batch is billed as any read.
205
+ `cia mcp call aml_deployer_screen network=robinhood address=0x...` runs the
206
+ same screen in a terminal.
207
+
162
208
  ## Host parity
163
209
 
164
210
  **A rule a host never loads does not exist for that host.** Each host loads a
package/docs/stability.md CHANGED
@@ -18,7 +18,7 @@ Exit codes are contract. Scripts and agent harnesses may rely on them.
18
18
 
19
19
  ### MCP tool names
20
20
 
21
- The public MCP surface is these thirteen tools:
21
+ The public MCP surface is these fourteen tools:
22
22
 
23
23
  - `graph_query`
24
24
  - `graph_query_batch`
@@ -26,6 +26,7 @@ The public MCP surface is these thirteen tools:
26
26
  - `meta_schema`
27
27
  - `meta_dex_lookup`
28
28
  - `meta_token_lookup`
29
+ - `aml_deployer_screen`
29
30
  - `meta_rules`
30
31
  - `meta_help`
31
32
  - `meta_usage_status`
@@ -34,7 +35,7 @@ The public MCP surface is these thirteen tools:
34
35
  - `wallet_topup`
35
36
  - `subscription_topup`
36
37
 
37
- `graph_expand` is the fourteenth tool the proxy registers. The view calls it
38
+ `graph_expand` is the fifteenth tool the proxy registers. The view calls it
38
39
  when you click in a picture; hosts keep it out of the model's tool list. It
39
40
  is not part of the public surface.
40
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chain-insights",
3
- "version": "0.77.1",
3
+ "version": "0.79.2",
4
4
  "description": "AML investigation CLI and MCP proxy for blockchain risk screening and Chain Insights Graph access",
5
5
  "homepage": "https://chain-insights.ai",
6
6
  "repository": {
@@ -93,7 +93,7 @@
93
93
  "vitest": "^5.0.3"
94
94
  },
95
95
  "chainInsights": {
96
- "dexRegistryVersion": 4
96
+ "dexRegistryVersion": 8
97
97
  },
98
98
  "overrides": {
99
99
  "ws": "8.21.0",
@@ -22,8 +22,8 @@ flowchart LR
22
22
 
23
23
  | File | Rows served | Why |
24
24
  |---|---|---|
25
- | [robinhood.md](robinhood.md) | 53 | registry version 4, recorded 2026-11-02; the `dyor` row and the Ekubo positions row are not served |
26
- | [robinhood.json](robinhood.json) | 34 exchanges | the served copy of `robinhood.md`, never edited by hand |
25
+ | [robinhood.md](robinhood.md) | 84 | registry version 8, recorded 2026-11-06 |
26
+ | [robinhood.json](robinhood.json) | 40 exchanges | the served copy of `robinhood.md`, never edited by hand |
27
27
 
28
28
  A change to the rows merged on `main` reaches every running proxy within one
29
29
  hour. No release is needed for a data change.
@@ -36,10 +36,14 @@ hour. No release is needed for a data change.
36
36
  data shows the address does what its role says:
37
37
  - `factory`: a contract that created pools;
38
38
  - `manager`: a contract that holds pools;
39
- - `router`: a contract that forwards swaps.
39
+ - `router`: a contract that forwards swaps;
40
+ - `helper`: a contract of the exchange that the trail does not read: a
41
+ position NFT, a staking gauge, a parts deployer, or a swap router of a
42
+ vault, where the manager stays the contract past the swap. The chain or
43
+ its verified source must tie it to the exchange.
40
44
  Write the check into the file's `## Verification` section.
41
- 3. **An unchecked row stays in the table.** Its verification cell says
42
- `not served:` and the reason. It is served later, when a check passes.
45
+ 3. **An unchecked exchange has no row.** A row enters the table when its support
46
+ is serving and its check passes. Its facts wait on an AP1000 issue until then.
43
47
  4. **The chain wins over the source.** When the chain shows a different
44
48
  factory or block than the source, the row follows the chain and the file
45
49
  says so.
@@ -60,13 +64,13 @@ The `## Rows` table has twelve columns, in this order.
60
64
  | aliases | the names a user types, comma separated, on one row of the exchange or spread over several |
61
65
  | trail type | how money is traced through the exchange: `plain`, `vault`, `gauge` or `launchpad`. Every row of an exchange carries the same trail type |
62
66
  | adapter | the adapter id of the DEX indexer that reads the row's pools: `cl-gauge-v1`, `uniswap-v4` |
63
- | role | `factory` creates pools, `manager` holds pools, `router` forwards swaps |
67
+ | role | `factory` creates pools, `manager` holds pools, `router` forwards swaps, `helper` is a contract of the exchange that the trail does not read. A lookup by address finds a helper; the reads of the exchange follow, none for the helper itself |
64
68
  | address | lowercase `0x` hex in backticks |
65
69
  | valid from block | the first block the row holds from, `0` when it is not known yet |
66
70
  | example pool | optional: one pool of the exchange, read live by the release suite. Empty or `-` when not given |
67
71
  | pool floor | optional: the least number of pools the exchange must show on a lane. Empty or `-` when not given |
68
72
  | source link | the one link that confirms the row, as `[text](https://…)` |
69
- | verification | `served`, or `not served:` and the reason |
73
+ | verification | `served` |
70
74
 
71
75
  Each network file states `Registry version: N`. Bump it in every change to
72
76
  the rows. Each file also states `Recorded on: YYYY-MM-DD`, the day of the
@@ -80,14 +84,14 @@ A row is refused for one of these reasons:
80
84
  | `duplicate row` | the same key, role and address twice |
81
85
  | `bad dex key` | the key is not lowercase letters, digits, `.`, `_` or `-` |
82
86
  | `bad address` | the address is not lowercase `0x` and 40 hex digits |
83
- | `unknown role` | the role is not `factory`, `manager` or `router` |
87
+ | `unknown role` | the role is not `factory`, `manager`, `router` or `helper` |
84
88
  | `unknown trail type` | the trail type is not `plain`, `vault`, `gauge` or `launchpad` |
85
89
  | `bad adapter` | the adapter is empty or not an id |
86
90
  | `no source link` | the source link is not `[text](https://…)` |
87
91
  | `bad block`, `bad example pool`, `bad pool floor` | the cell is not a number or a pool |
88
92
  | `too long` | a value does not fit its column |
89
93
  | `dex rows disagree` | two rows of one exchange give a different display, trail type, example pool or pool floor |
90
- | `no factory or manager row for the dex` | the exchange has router rows only |
94
+ | `no factory or manager row for the dex` | the exchange has router or helper rows only |
91
95
 
92
96
  ## The check
93
97
 
@@ -104,7 +108,7 @@ pull request:
104
108
  node scripts/pin-dex-registry.mjs --check registry/robinhood.md
105
109
  ```
106
110
 
107
- It prints `rows: N served, M refused, K not served` and
111
+ It prints `rows: N served, M refused` and
108
112
  `registry/robinhood.json up to date, registry version V`. It exits 1 when a
109
113
  row is refused or the committed copy differs, and names both versions.
110
114
 
@@ -120,6 +124,8 @@ node scripts/render-dex-registry.mjs --check # exit 1 when a memo table differ
120
124
  `registry/<network>.json` has the schema `chain-insights.dex-registry.v1`:
121
125
 
122
126
  - one entry per exchange, in the order the file first names it;
127
+ - `helpers` lists its `helper` addresses, when it has any. An older proxy
128
+ ignores the field;
123
129
  - `factories` lists its `factory` and `manager` addresses, `routers` its
124
130
  `router` addresses; an exchange with no router row lists its manager there,
125
131
  because a vault forwards its own swaps;