chain-insights 0.78.0 → 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.
@@ -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-sH2DesLS.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;AACtC,MAAa,2BAA2B;AACxC,MAAa,0BAA0B;AACvC,MAAa,gCACX;AAKF,MAAa,gCAAgC;CAC3C,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,iBAAiB;AAC9B,MAAa,YAAY;;AAEzB,MAAa,oBAAoB;AACjC,MAAa,aAAa;AAE1B,MAAa,qBAAqB;AAuDlC,MAAM,eAAe;AACrB,MAAM,gBAAgB;AAItB,SAAS,cAAc,MAAuB;CAC5C,KAAK,MAAM,QAAQ,MAAM;EACvB,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,IAAI,SAAS,QAAO,SAAS,QAAQ,OAAO,MAAQ,SAAS,KAAM,OAAO;CAC5E;CACA,OAAO;AACT;AACA,MAAM,cAAc;AAEpB,MAAM,iBACJ;AAEF,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE;AAEA,SAAS,YAAY,MAAyC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MAAM,GAAG,YAAY,GAAG,QAAQ,wCAAwC,mBAAmB;EAC7F,CAAC;CACH;CACA,IAAI,cAAc,MAAM,GACtB,OAAO,YACL,4HACF;CAGF,MAAM,cAAc,MAAM,KAAK,cAAc;CAC7C,IAAI,aACF,OAAO,YACL,2BAA2B,YAAY,gHAAgH,QACzJ;CAGF,IAAI,YAA+B;CACnC,IAAI,OAAO,MAAM,WAAW,MAAM,SAAS,UAAU,MAAM;CAC3D,IAAI,KAAK,SAAS,UAAU,KAAK,KAAK,WAAW,GAAG;EAClD,YAAY;EACZ,OAAO,MAAM,WAAW,MAAM,SAAS,QAAQ,MAAM;CACvD;CACA,IAAI,KAAK,SAAS,UAChB,OAAO,YACL,0BAA0B,KAAK,KAAK,iGAAiG,QACvI;CAEF,IAAI,KAAK,SAAS,cAChB,OAAO,WAAW;EAChB,GAAG;EACH,YAAY;EACZ,YAAY,CAAC;EACb,OAAO;EACP,WAAW;EACX,MACE,GAAG,YAAY,+BAA+B,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"}
@@ -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'} for ${name}: ${unsupportedArgs.join(', ')}.`,\n `Allowed arguments: ${allowedArgs.join(', ')}.`,\n ].join(' ')\n )\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,2CAA2B,IAAI,IAAI;CAC9C;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CAGA,CAAC,oBAAoB,QAAQ,CAAC,CAAC,KAAK,EAAE;CACtC,CAAC,qBAAqB,QAAQ,CAAC,CAAC,KAAK,EAAE;CACvC,CAAC,qBAAqB,UAAU,CAAC,CAAC,KAAK,EAAE;CACzC;CACA;CACA;CACA;CACA;CACA,CAAC,SAAS,0BAA0B,CAAC,CAAC,KAAK,EAAE;CAC7C;AACF,CAAC;AAED,MAAa,gCAA0D;CACrE,aAAa,CAAC,SAAS,SAAS;CAChC,mBAAmB,CAAC,WAAW,SAAS;AAC1C;AASA,MAAa,+BAAyD;CAEpE,aAAa;EAAC;EAAS;EAAW;CAAY;CAC9C,mBAAmB;EAAC;EAAW;EAAW;EAA6B;CAAY;CAEnF,iBAAiB;EAAC;EAAW;EAAQ;EAAW;CAAO;CAEvD,mBAAmB,CAAC,WAAW,QAAQ;CAEvC,qBAAqB,CAAC,WAAW,SAAS;AAC5C;AAEA,SAAgB,uBAAuB,MAAuB;CAC5D,OAAO,yBAAyB,IAAI,IAAI;AAC1C;;;;;;AAOA,SAAgB,cAAc,MAAoD;CAChF,MAAM,KAAK,KAAK,OAAO;CACvB,IAAI,CAAC,MAA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
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.78.0",
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": 6
96
+ "dexRegistryVersion": 8
97
97
  },
98
98
  "overrides": {
99
99
  "ws": "8.21.0",
@@ -22,7 +22,7 @@ flowchart LR
22
22
 
23
23
  | File | Rows served | Why |
24
24
  |---|---|---|
25
- | [robinhood.md](robinhood.md) | 83 | registry version 6, recorded 2026-11-05; the `dyor` row and the Ekubo positions row are not served |
25
+ | [robinhood.md](robinhood.md) | 84 | registry version 8, recorded 2026-11-06 |
26
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
@@ -42,8 +42,8 @@ hour. No release is needed for a data change.
42
42
  vault, where the manager stays the contract past the swap. The chain or
43
43
  its verified source must tie it to the exchange.
44
44
  Write the check into the file's `## Verification` section.
45
- 3. **An unchecked row stays in the table.** Its verification cell says
46
- `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.
47
47
  4. **The chain wins over the source.** When the chain shows a different
48
48
  factory or block than the source, the row follows the chain and the file
49
49
  says so.
@@ -70,7 +70,7 @@ The `## Rows` table has twelve columns, in this order.
70
70
  | example pool | optional: one pool of the exchange, read live by the release suite. Empty or `-` when not given |
71
71
  | pool floor | optional: the least number of pools the exchange must show on a lane. Empty or `-` when not given |
72
72
  | source link | the one link that confirms the row, as `[text](https://…)` |
73
- | verification | `served`, or `not served:` and the reason |
73
+ | verification | `served` |
74
74
 
75
75
  Each network file states `Registry version: N`. Bump it in every change to
76
76
  the rows. Each file also states `Recorded on: YYYY-MM-DD`, the day of the
@@ -108,7 +108,7 @@ pull request:
108
108
  node scripts/pin-dex-registry.mjs --check registry/robinhood.md
109
109
  ```
110
110
 
111
- It prints `rows: N served, M refused, K not served` and
111
+ It prints `rows: N served, M refused` and
112
112
  `registry/robinhood.json up to date, registry version V`. It exits 1 when a
113
113
  row is refused or the committed copy differs, and names both versions.
114
114
 
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": "chain-insights.dex-registry.v1",
3
3
  "network": "robinhood",
4
- "registry_version": 6,
5
- "recorded_on": "2026-11-05",
4
+ "registry_version": 8,
5
+ "recorded_on": "2026-11-06",
6
6
  "rows": [
7
7
  {
8
8
  "dex": "aero",
@@ -285,12 +285,15 @@
285
285
  "uniswap-v2"
286
286
  ],
287
287
  "roles": {
288
- "0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f": "factory"
288
+ "0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f": "factory",
289
+ "0x89e5db8b5aa49aa85ac63f691524311aeb649eba": "router"
289
290
  },
290
291
  "factories": [
291
292
  "0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f"
292
293
  ],
293
- "routers": [],
294
+ "routers": [
295
+ "0x89e5db8b5aa49aa85ac63f691524311aeb649eba"
296
+ ],
294
297
  "example_pool": "0x4a6a85252a6f6b383a5f747259ee157e65ff1307",
295
298
  "pool_floor": 10000,
296
299
  "since_block": 0,
@@ -6,9 +6,9 @@ columns and the check are in the [README](README.md). The served copy is
6
6
  [robinhood.json](robinhood.json), written by
7
7
  `node scripts/pin-dex-registry.mjs registry/robinhood.md`.
8
8
 
9
- Registry version: 6.
9
+ Registry version: 8.
10
10
 
11
- Recorded on: 2026-11-05.
11
+ Recorded on: 2026-11-06.
12
12
 
13
13
  ## Rows
14
14
 
@@ -45,6 +45,7 @@ Recorded on: 2026-11-05.
45
45
  | swaphood | SwapHood | SwapHood, SwapHood Finance, SWT, swaphood.finance | gauge | solidly-v2 | factory | `0xe7206ecac3a51afe7e6179182ad4130a26068dd1` | 0 | - | 20 | [SwapHood contract addresses](https://swaphood-finance.gitbook.io/swaphood-finance-docs/contract-addresses.md) | served |
46
46
  | swaphood | SwapHood | | gauge | solidly-v2 | router | `0x8f8056fec03159ebcc4aee1b8ea5a61d8fe405fc` | 0 | - | - | [SwapHood contract addresses](https://swaphood-finance.gitbook.io/swaphood-finance-docs/contract-addresses.md) | served |
47
47
  | uniswap-v2 | Uniswap v2 | Uniswap v2, Uni v2 | plain | uniswap-v2 | factory | `0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f` | 0 | 0x4a6a85252a6f6b383a5f747259ee157e65ff1307 | 10000 | [Uniswap v2 deployments](https://developers.uniswap.org/docs/protocols/v2/deployments) | served |
48
+ | uniswap-v2 | Uniswap v2 | | plain | uniswap-v2 | router | `0x89e5db8b5aa49aa85ac63f691524311aeb649eba` | 8929 | - | - | [Sourcify UniswapV2Router02](https://sourcify.dev/server/v2/contract/4663/0x89e5db8b5aa49aa85ac63f691524311aeb649eba) | served |
48
49
  | uniswap-v3 | Uniswap v3 | Uniswap v3, Uni v3 | plain | uniswap-v3 | factory | `0x1f7d7550b1b028f7571e69a784071f0205fd2efa` | 0 | 0x10cc6bd38112cac182db90b6a71d8bb5939526ba | 200000 | [Uniswap v3 Robinhood deployment](https://developers.uniswap.org/docs/protocols/v3/deployments/v3-robinhood-chain-deployments) | served |
49
50
  | eth-usdg-router | unnamed ETH/USDG swap router (routes into Uniswap v3 and v4) | ETH/USDG router, ETH/USDG swap router, USDG swap router | plain | uniswap-v3 | factory | `0x1f7d7550b1b028f7571e69a784071f0205fd2efa` | 105000018 | 0x52e65b17fb6e5ba00ed806f37afcd2daa50271ca | - | [scout-agent finding 164](https://github.com/chainswarm/scout-agent/issues/164) | served |
50
51
  | eth-usdg-router | unnamed ETH/USDG swap router (routes into Uniswap v3 and v4) | | plain | uniswap-v3 | router | `0x7a39b98d31f84152bc724bc5ddb41dbcb338f2a5` | 105000018 | 0x52e65b17fb6e5ba00ed806f37afcd2daa50271ca | - | [scout-agent finding 164](https://github.com/chainswarm/scout-agent/issues/164) | served |
@@ -59,7 +60,6 @@ Recorded on: 2026-11-05.
59
60
  | swaap | Swaap v2 | Swaap, Swaap Finance, swaap.xyz, Balancer, Balancer v2, Balancer v2 vault | vault | balancer-v2 | manager | `0xd315a9c38ec871068fec378e4ce78af528c76293` | 0 | - | - | [Swaap docs](https://docs.swaap.xyz/) | served |
60
61
  | balancer-v3 | unnamed Balancer v3 vault | Balancer, Balancer v3, Balancer v3 vault | vault | balancer-v3 | manager | `0x28082618ba2073e602230188e4f4c46e9b2169eb` | 0 | - | - | [Sourcify verified source](https://sourcify.dev/server/v2/contract/4663/0x28082618ba2073e602230188e4f4c46e9b2169eb) | served |
61
62
  | ekubo | Ekubo | Ekubo, Ekubo Protocol, ekubo.org | vault | ekubo-core | manager | `0x00000000000014aa86c5d3c41765bb24e11bd701` | 33534 | - | - | [Ekubo robinhood deployment](https://github.com/EkuboProtocol/evm-contracts/blob/933c813ca154475a3c7eab8234869f6db151c682/broadcast/DeployAll.s.sol/4663/run-latest.json) | served |
62
- | ekubo | Ekubo | | vault | ekubo-core | positions | `0xda38ac72ce7220c4dd7719d114ef94edadb8f068` | 18272006 | - | - | [Ekubo robinhood Ve33 deployment](https://github.com/EkuboProtocol/evm-contracts/blob/933c813ca154475a3c7eab8234869f6db151c682/broadcast/DeployVe33.s.sol/4663/run-latest.json) | not served: the positions NFT creates no pool, holds no pool and forwards no swap; the registry serves the roles factory, manager and router only |
63
63
  | stock-token-market | unnamed stock-token market with one reserve holder | stock-token market, stock token market | vault | swapped-custody | manager | `0x2f4579ca81717d3d61bf8b6f06571877bbe54a07` | 461784 | - | - | [devops registry v29](https://github.com/chainswarm/devops/blob/e270ee1a3c8a2afc52e9d5549be5dbb8b98f0914/charts/chainswarm-indexer-evm-dex/registry/robinhood-v29.json) | served |
64
64
  | ramses | Ramses | Ramses, Ramses Exchange, RAM, ramses.xyz, Ramses DLMM | plain | trader-joe-lb | factory | `0xdcd5f77697914e27f56fd263ef82923c8524abac` | 0 | 0x06ffaa507a9c3e7025294a642f1e1c75da3dfb4a | 150 | [Ramses contract addresses](https://www.ramses.xyz/docs/contract-addresses) | served |
65
65
  | ramses | Ramses | | plain | uniswap-v2 | factory | `0x43b2bf9f33036a02fc7a00935571c2a6b0108e66` | 0 | - | - | [Ramses contract addresses](https://www.ramses.xyz/docs/contract-addresses) | served |
@@ -67,7 +67,6 @@ Recorded on: 2026-11-05.
67
67
  | sectorone | SectorOne | SectorOne, SectorOne DLMM | plain | trader-joe-lb | factory | `0x3d8dc63ddc9b992cfde89f7aea6f18717e84687d` | 0 | - | 30 | [DefiLlama traderJoeV2 registry](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/registries/traderJoeV2.js) | served |
68
68
  | hoodit | Hoodit | Hoodit, hoodit.xyz | plain | trader-joe-lb | factory | `0x22602d966defd638ee94e97a92e2eb0934c3fe1b` | 0 | - | 5 | [DefiLlama traderJoeV2 registry](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/registries/traderJoeV2.js) | served |
69
69
  | giga | GIGA | GIGA, GIGA DEX, GigaDEX, gigadex.fi | plain | uniswap-v2 | factory | `0x6fdf38f92ead1adfc04b73aaa947ab254f6c0916` | 0 | - | 15 | [HoodScan](https://hoodscan.co/project/giga) | served |
70
- | dyor | DYOR | DYOR, dyor.fun, DYORSwap | plain | uniswap-v2 | factory | `0x5818fddddb96bcd50bee4253f11b324e7dea961b` | 0 | - | - | [Mobula almanac](https://docs.mobula.io/almanac/robinhood-launchpads/dyorfun.md) | not served: the exchange name rests on the contract's own revert strings and one third-party page; a deployment file is awaited |
71
70
  | flap | Flap | Flap, Flap launchpad, flap.sh | launchpad | uniswap-v2 | factory | `0x0d1ebb179cdbca88d74c923c4255cb2b17474afd` | 0 | - | 100000 | [HoodScan](https://hoodscan.co/project/flap) | served |
72
71
  | curve | Curve | Curve, Curve Finance, CRV, curve.finance | plain | curve-stable | factory | `0x8271e06e5887fe5ba05234f5315c19f3ec90e8ad` | 0 | 0x7e0539140f16b3a8ed23ad69d6fea6a38fb8b299 | 25 | [curve-core deployments](https://github.com/curvefi/curve-core/blob/main/deployments/prod/robinhood.yaml) | served |
73
72
  | metric | Metric | Metric, Metric OMM, metric.xyz | plain | metric-omm | factory | `0x2e0a99a2e352043d1ca489cf45bf7b511bccc738` | 0 | 0x584ac6010b095bf99398fae8203a3260a03d2b30 | 30 | [Metric SDK addresses](https://github.com/Metricxyz/sdk/blob/main/src/addresses.ts) | served |
@@ -129,7 +128,6 @@ swaps it forwarded.
129
128
  | `0x3d6ea4e97b8ab9e1a1b4943febffe22d8c920091` | factory | read from the production node on 2026-10-25: its creation event names the launched token, its curve and the creator (sample transaction `0x77b1bcc700d5f1d7513d080d3fe265831529c237065fffed83e665f89cc3f019`, block 95,797,703); 2,182 curves, quoted in SPCX `0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea` and two other stock tokens. The example curve `0x1de3f839184cf48696cbb9cc283855eb32dc2c51` logged 1,028 trades in 7M blocks. No source names the operator, so the key stays `spcx` |
130
129
  | `0x190b452d16e12e3beedd76a030ea991fe3856c33` | router | the SPCX legs of the sample trade `0xe200a831908a9b937e08eb4c16fdefd016f606980b9ef71f788994c76020708e` run trader, this contract, curve. The trader stays the payer: the router is never a swap end |
131
130
  | `0x00000000000014aa86c5d3c41765bb24e11bd701` | manager | the Ekubo core, deployed at block 33,534 per Ekubo's robinhood deployment file. Read from the production node on 2026-10-25 over 20,000 blocks: 111 swaps and 65 position updates logged by the core itself, 28 pools initialized, each pool kept by a 32-byte pool id. Sample transaction `0x7926c9fab003029a42e7f398e3183611c49583a082b4aac781003cb43f5a96d9`, block 97,745,015 |
132
- | `0xda38ac72ce7220c4dd7719d114ef94edadb8f068` | positions | "Ekubo Ve33 Positions", deployed at block 18,272,006 with the core as its first argument per Ekubo's Ve33 deployment file. It owns the core's position updates and mints one NFT per position. It is not served: it creates no pool, holds no pool and forwards no swap, and a liquidity owner is the NFT's holder, never this contract |
133
131
  | `0x3d69104da2518f4833d71444d6611310f2d685f2` | factory | read on lane B's StarRocks on 2026-11-02: 827 `spcx-launchpad-v2` curves from block 92,760,418 (2026-10-19) to 104,473,613, each created by this contract. Sourcify verifies it as `LaunchFactory` from the same source path and compiler as the first SPCX factory, created at block 92,651,082 by `0xdaff80aadf44305fe95768de1aad1d8861c9f908`; the first was created by `0xb1748f1857bef8de020982aa33f6f9cc1b9ad3c1`, so the two share code, quote token and trade event, not a deployer. Its curve `0x94dc28d78ddbcfdffedb6825ba90b8c8c7b2ba65` (launch transaction `0x21302babf7065d3af00b755bb05bd0a29ea813f5f19767c4f675a74d420d0c6f`, block 100,172,602) holds 2,805 swap rows since 2026-10-28; the first, `0x7845d3a83929f66dce4bfac6e1ddcb7fc5a98f0b4f08b80f2008159100d1c128` at block 100,191,841, is a route through Uniswap v4 into the curve |
134
132
  | `0x3c7476e8be0efd5b9667421448a99e217b806e80` | router | Sourcify `LaunchRouter`, created at block 92,651,105 by the factory's deployer. In `0x459b6eb7423b3f0f8cb2480a5968b55ffb7211af7efdff7ce64f33e6a3765bd7` (block 100,227,315) it takes the trader's USDG, buys SPCX on Uniswap v4 and pays the curve: the trader stays the payer |
135
133
  | `0xc4210279fb1e1de24a87d6f5cc597c9422aef899` | factory | read on lane B's StarRocks on 2026-11-02: 570 `hoodclub-curve` curves from block 54,625,631 (2026-09-04) to 103,673,419; the factory created 1,710 contracts, a token, a curve and a fee vault per launch. Created at block 54,594,936 by `0xdef671f11c8a30818eb3d9cc9476eeec805f9058`; no source is verified and no project names it, so it is served as an unnamed launchpad. Its curves are paid and pay native ETH. The example curve `0x01e7afb5fc124f6b8270bcd2b7d203dcad68c861`, created with token `0x6966b6233f91790bebb1815a4d3acf55d82b3b49` in `0xb68bc059baa634df52a07570fe29dd61ac14cd6b346d8319edff0fc37feb40ea` (block 100,237,007, the creator's own buy), holds 290 swap rows since 2026-10-28 |
@@ -180,6 +178,12 @@ Uniswap v3 WETH/USDG pool `0x52e65b17fb6e5ba00ed806f37afcd2daa50271ca`.
180
178
  That factory stays Uniswap v3's: a lookup of its address still answers
181
179
  Uniswap v3, the first exchange that names it.
182
180
 
181
+ Registry version 7 (2026-11-05) adds Uniswap's v2 router
182
+ `0x89e5db8b5aa49aa85ac63f691524311aeb649eba`. Sourcify verifies
183
+ `UniswapV2Router02`, and its `factory()` returns the Uniswap v2 factory
184
+ `0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f`. The scout digest of 2026-11-05
185
+ named it as a router with no exchange row.
186
+
183
187
  Registry version 6 (2026-11-05) serves the rows of six scout-agent findings
184
188
  and adds the role `helper`: a contract of an exchange that the trail does not
185
189
  read. That is a position NFT, a gauge, a parts deployer, or a swap router of a
@@ -85,7 +85,7 @@ hand. When the tool and the memo differ, follow the tool: it reads the
85
85
  newest file.
86
86
 
87
87
  <!-- dex-registry:start -->
88
- Memo of the exchange registry, version 6, robinhood, recorded 2026-11-05.
88
+ Memo of the exchange registry, version 8, robinhood, recorded 2026-11-06.
89
89
 
90
90
  | Exchange | Key | Also written | Trail | Factories, or the manager | Router |
91
91
  |---|---|---|---|---|---|
@@ -98,7 +98,7 @@ Memo of the exchange registry, version 6, robinhood, recorded 2026-11-05.
98
98
  | Kittenswap | `kittenswap` | Kittenswap, KITTEN, KittenSwap | gauge | `0x45362763166cfed6174d312fa1449ea1fc37988a` | `0x7064c7bb85979f008212877c4ce41285ddf5374c` |
99
99
  | Morpheus | `morpheus` | Morpheus, Morpheus Farm | gauge | `0xd7cb0e0692f2d55a17ba81c1fe5501d66774fc4a` | none proven yet |
100
100
  | SwapHood | `swaphood` | SwapHood, SwapHood Finance, SWT, swaphood.finance | gauge | `0xe7206ecac3a51afe7e6179182ad4130a26068dd1` | `0x8f8056fec03159ebcc4aee1b8ea5a61d8fe405fc` |
101
- | Uniswap v2 | `uniswap-v2` | Uniswap v2, Uni v2 | plain | `0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f` | none |
101
+ | Uniswap v2 | `uniswap-v2` | Uniswap v2, Uni v2 | plain | `0x8bceaa40b9acdfaedf85adf4ff01f5ad6517937f` | `0x89e5db8b5aa49aa85ac63f691524311aeb649eba` |
102
102
  | Uniswap v3 | `uniswap-v3` | Uniswap v3, Uni v3 | plain | `0x1f7d7550b1b028f7571e69a784071f0205fd2efa` | none |
103
103
  | unnamed ETH/USDG swap router (routes into Uniswap v3 and v4) | `eth-usdg-router` | ETH/USDG router, ETH/USDG swap router, USDG swap router | plain | `0x1f7d7550b1b028f7571e69a784071f0205fd2efa` | `0x7a39b98d31f84152bc724bc5ddb41dbcb338f2a5` |
104
104
  | Uniswap v4 | `uniswap-v4` | Uniswap, UNI, Uniswap v4, Uni v4, PoolManager | vault | manager `0x8366a39cc670b4001a1121b8f6a443a643e40951` | the manager |
@@ -74,8 +74,8 @@ read: a token launched there, such as Mob, is never the launchpad's name.
74
74
  5. **The first pool** (L3): the launched contract's `ADDED_LIQUIDITY` links
75
75
  into a `:Pool`, oldest first. The first one is the graduation: the curve's
76
76
  money moved into an exchange pool.
77
- 6. When L3 is empty, say the graduation is not in the graph yet. Never guess
78
- a pool from the token's name.
77
+ 6. When L3 is empty, no liquidity link shows a graduation: say that plainly.
78
+ Never guess a pool from the token's name.
79
79
  7. After graduation the token trades on that pool. Load `chain-insights-dex`
80
80
  for the pool's exchange and its trail.
81
81
 
@@ -101,12 +101,9 @@ indexer finds them by their shape, with one rule for every operator:
101
101
  - **No name, no row.** `meta_dex_lookup` with F's address answers
102
102
  `matched: null`. For F that means "no exchange row", not "no data": read
103
103
  the graph below. Never give F a name you have not read.
104
- - **What the graph holds today.** The launches are rows of the rule
105
- `v4-launch-factory-v1` in the warehouse. The graph does not mark F yet:
106
- no `:Launchpad`, no `:Pool`, no rule name in its `labels`. The
107
- `:Launchpad` mark for a factory of two launches or more is coming in the
108
- graph's pools layer. Until a read of F shows it, do not ask by mark for
109
- F: read the shape from its links.
104
+ - **The mark.** A factory of two launches or more carries `:Launchpad` and
105
+ `:Protocol`, with the word `Launchpad` in `labels` and no name. A contract
106
+ of one launch does not.
110
107
 
111
108
  1. **The launches**: L1, anchored on F. Each `DEPLOYED_CONTRACT` link is a
112
109
  contract F created. Count the tokens to say whether F is a launchpad.
@@ -118,8 +115,8 @@ indexer finds them by their shape, with one rule for every operator:
118
115
  pool manager by a 32-byte pool id. It is not a contract of its own: say
119
116
  "a pool of the Uniswap v4 pool manager". Read the id from `pools` on a
120
117
  `SWAPPED` link that sold or bought the token, anchored on the creator.
121
- When no such link shows, say the graph does not serve that pool id yet.
122
- The creator and the launch transaction still answer who launched it.
118
+ When no such link shows, leave the pool out. The creator and the launch
119
+ transaction still answer who launched it.
123
120
  4. **The trades** are ordinary Uniswap v4 swaps on the pool manager. Load
124
121
  `chain-insights-dex-vault` and follow its trail. The pool manager is
125
122
  never the buyer, and no topology hop goes out of it.
@@ -69,7 +69,7 @@ agent is created on Uniswap's own v2 factory
69
69
  most of that factory's pairs are Virtuals agents.
70
70
 
71
71
  <!-- dex-registry:start -->
72
- The factories of the exchange registry, version 6, row `virtuals`:
72
+ The factories of the exchange registry, version 8, row `virtuals`:
73
73
 
74
74
  | Factory | Address |
75
75
  |---|---|
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-lookup-sH2DesLS.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\ntype 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. */\nfunction 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\ntype Member = { id?: unknown; ok?: unknown; results?: unknown; error?: unknown }\n\nfunction 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 Chain Insights server does not serve the token lookup yet (${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;AACtC,MAAa,2BAA2B;AACxC,MAAa,0BAA0B;AACvC,MAAa,gCACX;AAKF,MAAa,gCAAgC;CAC3C,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,iBAAiB;AAC9B,MAAa,YAAY;;AAEzB,MAAa,oBAAoB;AACjC,MAAa,aAAa;AAE1B,MAAa,qBAAqB;AAuDlC,MAAM,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