chain-insights 0.84.0 → 0.85.0

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.
package/dist/cli.cjs CHANGED
@@ -648,8 +648,8 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
648
648
  }
649
649
  console.log(formatToolsTable(visibleRemoteTools(tools)));
650
650
  const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await Promise.resolve().then(() => require("./dex-tool-Be9NAuD8.cjs")).then((n) => n.dex_tool_exports);
651
- const { META_TOKEN_LOOKUP_DESCRIPTION, META_TOKEN_LOOKUP_TITLE, META_TOKEN_LOOKUP_TOOL } = await Promise.resolve().then(() => require("./token-lookup-D-5GBEwF.cjs")).then((n) => n.token_lookup_exports);
652
- const { AML_DEPLOYER_SCREEN_DESCRIPTION, AML_DEPLOYER_SCREEN_TITLE, AML_DEPLOYER_SCREEN_TOOL } = await Promise.resolve().then(() => require("./deployer-screen-DQw3pC0E.cjs")).then((n) => n.deployer_screen_exports);
651
+ const { META_TOKEN_LOOKUP_DESCRIPTION, META_TOKEN_LOOKUP_TITLE, META_TOKEN_LOOKUP_TOOL } = await Promise.resolve().then(() => require("./token-lookup-Ckg-Rliv.cjs")).then((n) => n.token_lookup_exports);
652
+ const { AML_DEPLOYER_SCREEN_DESCRIPTION, AML_DEPLOYER_SCREEN_TITLE, AML_DEPLOYER_SCREEN_TOOL } = await Promise.resolve().then(() => require("./deployer-screen-9VSQsq1A.cjs")).then((n) => n.deployer_screen_exports);
653
653
  console.log("");
654
654
  console.log(formatToolsTable([
655
655
  {
@@ -709,7 +709,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
709
709
  return;
710
710
  }
711
711
  if (tool === "meta_token_lookup") {
712
- const { handleMetaTokenLookup } = await Promise.resolve().then(() => require("./token-lookup-D-5GBEwF.cjs")).then((n) => n.token_lookup_exports);
712
+ const { handleMetaTokenLookup } = await Promise.resolve().then(() => require("./token-lookup-Ckg-Rliv.cjs")).then((n) => n.token_lookup_exports);
713
713
  const { metaTokenLookupArgs } = await Promise.resolve().then(() => require("./call-args-DXEmPeE-.cjs"));
714
714
  const result = await withGraphMcpClient("chain-insights-cli-token-lookup", (client) => handleMetaTokenLookup(metaTokenLookupArgs(args), {
715
715
  graphQuery: async (queryArgs) => await client.callTool({
@@ -727,7 +727,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
727
727
  return;
728
728
  }
729
729
  if (tool === "aml_deployer_screen") {
730
- const { handleAmlDeployerScreen } = await Promise.resolve().then(() => require("./deployer-screen-DQw3pC0E.cjs")).then((n) => n.deployer_screen_exports);
730
+ const { handleAmlDeployerScreen } = await Promise.resolve().then(() => require("./deployer-screen-9VSQsq1A.cjs")).then((n) => n.deployer_screen_exports);
731
731
  const result = await withGraphMcpClient("chain-insights-cli-deployer-screen", (client) => handleAmlDeployerScreen({
732
732
  network: args["network"],
733
733
  address: args["address"]
@@ -755,7 +755,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
755
755
  return;
756
756
  }
757
757
  if (tool === "aml_exchange_deposit_check") {
758
- const { handleAmlExchangeDepositCheck } = await Promise.resolve().then(() => require("./exchange-deposit-check-ClPd7HQl.cjs")).then((n) => n.exchange_deposit_check_exports);
758
+ const { handleAmlExchangeDepositCheck } = await Promise.resolve().then(() => require("./exchange-deposit-check-DfqrUzIm.cjs")).then((n) => n.exchange_deposit_check_exports);
759
759
  const { loadExchangeRegistry } = await Promise.resolve().then(() => require("./exchange-registry-CT0rRW__.cjs")).then((n) => n.exchange_registry_exports);
760
760
  const result = await withGraphMcpClient("chain-insights-cli-exchange-deposit-check", (client) => handleAmlExchangeDepositCheck({
761
761
  network: args["network"],
package/dist/cli.mjs CHANGED
@@ -646,8 +646,8 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
646
646
  }
647
647
  console.log(formatToolsTable(visibleRemoteTools(tools)));
648
648
  const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await import("./dex-tool-7BK_gD6H.mjs").then((n) => n.a);
649
- const { META_TOKEN_LOOKUP_DESCRIPTION, META_TOKEN_LOOKUP_TITLE, META_TOKEN_LOOKUP_TOOL } = await import("./token-lookup-QpIv77P2.mjs").then((n) => n.l);
650
- const { AML_DEPLOYER_SCREEN_DESCRIPTION, AML_DEPLOYER_SCREEN_TITLE, AML_DEPLOYER_SCREEN_TOOL } = await import("./deployer-screen-e3IbG1Y_.mjs").then((n) => n.a);
649
+ const { META_TOKEN_LOOKUP_DESCRIPTION, META_TOKEN_LOOKUP_TITLE, META_TOKEN_LOOKUP_TOOL } = await import("./token-lookup-Dtid9MwW.mjs").then((n) => n.l);
650
+ const { AML_DEPLOYER_SCREEN_DESCRIPTION, AML_DEPLOYER_SCREEN_TITLE, AML_DEPLOYER_SCREEN_TOOL } = await import("./deployer-screen-Bd1sBcnt.mjs").then((n) => n.a);
651
651
  console.log("");
652
652
  console.log(formatToolsTable([
653
653
  {
@@ -707,7 +707,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
707
707
  return;
708
708
  }
709
709
  if (tool === "meta_token_lookup") {
710
- const { handleMetaTokenLookup } = await import("./token-lookup-QpIv77P2.mjs").then((n) => n.l);
710
+ const { handleMetaTokenLookup } = await import("./token-lookup-Dtid9MwW.mjs").then((n) => n.l);
711
711
  const { metaTokenLookupArgs } = await import("./call-args-CBqbYfOE.mjs");
712
712
  const result = await withGraphMcpClient("chain-insights-cli-token-lookup", (client) => handleMetaTokenLookup(metaTokenLookupArgs(args), {
713
713
  graphQuery: async (queryArgs) => await client.callTool({
@@ -725,7 +725,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
725
725
  return;
726
726
  }
727
727
  if (tool === "aml_deployer_screen") {
728
- const { handleAmlDeployerScreen } = await import("./deployer-screen-e3IbG1Y_.mjs").then((n) => n.a);
728
+ const { handleAmlDeployerScreen } = await import("./deployer-screen-Bd1sBcnt.mjs").then((n) => n.a);
729
729
  const result = await withGraphMcpClient("chain-insights-cli-deployer-screen", (client) => handleAmlDeployerScreen({
730
730
  network: args["network"],
731
731
  address: args["address"]
@@ -753,7 +753,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
753
753
  return;
754
754
  }
755
755
  if (tool === "aml_exchange_deposit_check") {
756
- const { handleAmlExchangeDepositCheck } = await import("./exchange-deposit-check-9bGrKwcX.mjs").then((n) => n.a);
756
+ const { handleAmlExchangeDepositCheck } = await import("./exchange-deposit-check-BgmQnC7m.mjs").then((n) => n.a);
757
757
  const { loadExchangeRegistry } = await import("./exchange-registry-CoLgHw6d.mjs").then((n) => n.r);
758
758
  const result = await withGraphMcpClient("chain-insights-cli-exchange-deposit-check", (client) => handleAmlExchangeDepositCheck({
759
759
  network: args["network"],
@@ -2,7 +2,7 @@ const require_rolldown_runtime = require("./rolldown-runtime-BW-eSwOZ.cjs");
2
2
  const require_answer_hint = require("./answer-hint-BlYEBq_Y.cjs");
3
3
  const require_dex_registry = require("./dex-registry-BhGJUG9_.cjs");
4
4
  const require_print_result = require("./print-result-BYppJlUi.cjs");
5
- const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
5
+ const require_token_lookup = require("./token-lookup-Ckg-Rliv.cjs");
6
6
  // src/mcp/deployer-screen.ts
7
7
  /**
8
8
  * aml_deployer_screen: who is behind a token or a wallet, as facts.
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.mjs";
2
2
  import { t as ANSWER_HINT } from "./answer-hint-vOE1O6Lf.mjs";
3
3
  import { d as normalizeDexNetwork, r as DexRegistryError } from "./dex-registry-BY67f4Ul.mjs";
4
4
  import { i as isEpochMs, o as utcText } from "./print-result-IFARsMnL.mjs";
5
- import { c as refusalOf, s as membersOf } from "./token-lookup-QpIv77P2.mjs";
5
+ import { c as refusalOf, s as membersOf } from "./token-lookup-Dtid9MwW.mjs";
6
6
  // src/mcp/deployer-screen.ts
7
7
  /**
8
8
  * aml_deployer_screen: who is behind a token or a wallet, as facts.
@@ -434,4 +434,4 @@ async function handleAmlDeployerScreen(args, deps) {
434
434
  }
435
435
  export { deployer_screen_exports as a, AML_DEPLOYER_SCREEN_TOOL as i, AML_DEPLOYER_SCREEN_DESCRIPTION as n, handleAmlDeployerScreen as o, AML_DEPLOYER_SCREEN_TITLE as r, AML_DEPLOYER_SCREEN_ANNOTATIONS as t };
436
436
 
437
- //# sourceMappingURL=deployer-screen-e3IbG1Y_.mjs.map
437
+ //# sourceMappingURL=deployer-screen-Bd1sBcnt.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deployer-screen-e3IbG1Y_.mjs","names":[],"sources":["../src/mcp/deployer-screen.ts"],"sourcesContent":["/**\n * aml_deployer_screen: who is behind a token or a wallet, as facts.\n *\n * A local tool of the proxy. It sends one graph_query_batch with two reads on\n * USE topology, both anchored on the address:\n *\n * token the address as a contract: its first creation (DEPLOYED_CONTRACT),\n * the launcher (the transaction's sender), the launcher's first funder\n * of all time and its first inbound bridge deposit;\n * wallet the address as the launcher itself: the same funder and bridge reads.\n *\n * The funder is the launcher's earliest inbound FLOWED_TO. On a lane whose\n * money family lists ROUTED_TO (the three link levels) it is the earliest of\n * its inbound FLOWED_TO and ROUTED_TO from another address: a launcher funded\n * by the proceeds of a swap names the payer of that swap. A self route (the\n * launcher swapped for itself) is never the funder: it spent money the\n * launcher already held, so the search goes on to what paid it in. Any other\n * lane gets the reads of 0.82.0, byte for byte.\n *\n * The token read answers first when it holds a row; the wallet read answers\n * otherwise. The tool returns facts and never a score, a level or a verdict:\n * the description below is the contract with every host, Claude Desktop chat\n * included, which reads no skill.\n */\n\nimport { ANSWER_HINT } from './answer-hint.js'\nimport { DexRegistryError, normalizeDexNetwork } from './dex-registry.js'\nimport type { SwapLinkShape } from './layer-routing.js'\nimport { isEpochMs, utcText } from './timestamp-text.js'\nimport {\n membersOf,\n refusalOf,\n type GraphAnswer,\n type Member,\n type TokenToolDependencies,\n} from './token-lookup.js'\n\nexport const AML_DEPLOYER_SCREEN_TOOL = 'aml_deployer_screen' as const\nexport const AML_DEPLOYER_SCREEN_SCHEMA = 'chain-insights.aml-deployer-screen.v1' as const\nexport const AML_DEPLOYER_SCREEN_TITLE = 'Deployer screen'\nexport const AML_DEPLOYER_SCREEN_DESCRIPTION =\n 'Facts only, no score and no verdict: screens who is behind a token or a wallet. ' +\n 'For a token contract it returns the creation transaction and the launcher (the wallet that sent it); ' +\n 'for a wallet, that wallet as the launcher. Then the launcher\\'s first funder of all time and what kind of ' +\n 'wallet that funder is (wallet, contract, bridge, bundler, launchpad, exchange, mixer, scam), how many addresses the ' +\n 'funder ever paid, the sanctions, scam, victim and risk labels on each, and the first inbound bridge deposit. ' +\n 'The caller decides. A fresh launcher funded by a wallet that paid few addresses is the pattern to look at; ' +\n 'a funder that paid thousands is shared infrastructure. A launcher that is a bundler hides the real sender: ' +\n 'launcher_resolved is then false. On a lane whose money family lists ROUTED_TO the first funder may have paid ' +\n 'through a swap (funded_via swap): it paid, a router and a pool swapped, the launcher got another asset; a swap ' +\n 'the launcher made for itself is never its funder. not_covered lists what the graph cannot see yet.'\nexport const AML_DEPLOYER_SCREEN_ANNOTATIONS = {\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n} as const\nexport const AML_DEPLOYER_SCREEN_ARGS = ['network', 'address'] as const\n\n/** What the two reads cannot see yet, named in every answer. */\nexport const NOT_COVERED = ['exploit_labels', 'ml_labels', 'bridge_sender', 'ethereum_history'] as const\n\nexport type CrimeKind = 'sanctioned' | 'scam' | 'victim' | 'issuer_frozen' | 'risk'\nexport interface Crime {\n kind: CrimeKind\n value: string\n level: string | null\n}\n\nexport interface Party {\n address: string\n roles: string[]\n crime: Crime[]\n first_activity: number | null\n first_activity_utc: string | null\n degree_in: number | null\n degree_out: number | null\n}\n\nexport type FunderKind = 'scam' | 'mixer' | 'exchange' | 'bridge' | 'bundler' | 'launchpad' | 'contract' | 'wallet'\n\nexport interface Funder {\n address: string\n kind: FunderKind\n roles: string[]\n crime: Crime[]\n degree_out: number | null\n first_activity: number | null\n first_activity_utc: string | null\n funded_at: number | null\n funded_at_utc: string | null\n funding_tx_count: number | null\n funding_usd: number | null\n /**\n * On a lane with the levels only: `transfer` when the first money came on\n * FLOWED_TO, `swap` when on ROUTED_TO (the funder paid, the launcher got the\n * bought asset; funding_usd is then what the launcher got).\n */\n funded_via?: 'transfer' | 'swap'\n}\n\nexport interface Creation {\n tx: string | null\n block: number | null\n time: number | null\n time_utc: string | null\n deployer: string | null\n factory: string | null\n mode: 'direct' | 'factory'\n}\n\nexport interface BridgedIn {\n chain: string | null\n bridge: string | null\n kind: string | null\n asset: string | null\n first_block: number | null\n}\n\nexport interface AmlDeployerScreenResult {\n schema: typeof AML_DEPLOYER_SCREEN_SCHEMA\n tool: typeof AML_DEPLOYER_SCREEN_TOOL\n network: string\n input: string\n /** false when the graph holds no node for the address: every fact below is then null. */\n found: boolean\n input_kind: 'token' | 'wallet' | null\n token: { address: string; roles: string[] } | null\n creation: Creation | null\n launcher: Party | null\n launcher_resolved: boolean | null\n first_funder: Funder | null\n bridged_in: BridgedIn | null\n not_covered: string[]\n hint: string\n}\n\nexport type DeployerScreenDependencies = Pick<\n TokenToolDependencies,\n 'graphQueryBatch' | 'unavailable' | 'describeFailure'\n> & {\n /**\n * The lane's graph shape (`meta_network_capabilities`, kept by the proxy).\n * The funder read walks ROUTED_TO only when it answers `levels`; absent,\n * `route` or a read that throws keeps the reads of 0.82.0.\n */\n linkShape?: (network: string) => Promise<SwapLinkShape> | SwapLinkShape\n}\n\nexport type AmlDeployerScreenToolResult = {\n content: Array<{ type: 'text'; text: string }>\n structuredContent?: Record<string, unknown>\n isError: boolean\n}\n\n// The only address form ever written into a read: 0x and 40 lowercase hex.\nconst ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/\nconst ADDRESS_READ = /^0x[0-9a-f]{40}$/\n\n// The funder's first inbound flow and the first inbound bridge deposit of the\n// launcher `l`, and the columns both reads return about them.\nconst FUNDER_READ = 'OPTIONAL MATCH (f:Address)-[e:FLOWED_TO]->(l)'\n// On a lane with the levels: the first money from another address, funds or a\n// swap route; the self route is left out (it spent what the launcher held).\nconst LEVELS_FUNDER_READ =\n 'OPTIONAL MATCH (f:Address)-[e:FLOWED_TO|ROUTED_TO]->(l) WHERE f.address <> l.address'\n// What the launcher got: a route carries it in bought_usd_sum, a FLOWED_TO in\n// amount_usd_sum; and which link it came on.\nconst LEVELS_FUNDING_COLUMNS =\n 'coalesce(e.bought_usd_sum, e.amount_usd_sum) AS funding_usd, type(e) AS funding_link'\nconst BRIDGE_READ =\n \"OPTIONAL MATCH (ch:Chain)-[b:BRIDGED]->(l) WHERE b.kind IN ['TOKEN_DEPOSIT','NATIVE_DEPOSIT']\"\nconst PARTY_COLUMNS = [\n 'labels(l) AS launcher_roles',\n 'l.first_activity_timestamp AS launcher_first_activity',\n 'l.degree_in AS launcher_degree_in',\n 'l.degree_out AS launcher_degree_out',\n 'l.is_sanctioned AS launcher_is_sanctioned',\n 'l.is_scam AS launcher_is_scam',\n 'l.is_victim AS launcher_is_victim',\n 'l.is_issuer_frozen AS launcher_is_issuer_frozen',\n 'l.label_risk_labels AS launcher_risk_labels',\n 'l.label_risk_levels AS launcher_risk_levels',\n 'f.address AS funder',\n 'labels(f) AS funder_roles',\n 'f.degree_out AS funder_degree_out',\n 'f.first_activity_timestamp AS funder_first_activity',\n 'f.is_sanctioned AS funder_is_sanctioned',\n 'f.is_scam AS funder_is_scam',\n 'f.is_victim AS funder_is_victim',\n 'f.is_issuer_frozen AS funder_is_issuer_frozen',\n 'f.label_risk_labels AS funder_risk_labels',\n 'f.label_risk_levels AS funder_risk_levels',\n 'e.first_seen_timestamp AS funded_at',\n 'e.tx_count AS funding_tx_count',\n 'e.amount_usd_sum AS funding_usd',\n 'ch.network AS bridged_chain',\n 'ch.address AS bridged_bridge',\n 'b.kind AS bridged_kind',\n 'b.asset AS bridged_asset',\n 'b.first_height AS bridged_first_block',\n].join(', ')\nconst TOKEN_COLUMNS = [\n 't.address AS token',\n 'labels(t) AS token_roles',\n 'c.tx_origin AS launcher',\n 'c.deployer_address AS deployer',\n 'c.factory_address AS factory',\n 'c.kind AS creation_kind',\n 'c.tx_id AS creation_tx',\n 'c.block_height AS creation_block',\n 'c.block_timestamp AS creation_time',\n].join(', ')\n\nfunction assertReadAddress(address: string): void {\n if (!ADDRESS_READ.test(address)) {\n throw new Error(`deployer screen: ${JSON.stringify(address)} is not a lowercase 0x address`)\n }\n}\n\n/** The token read: the address as a contract, its first creation and who sent it. */\nexport function tokenScreenQuery(address: string, shape: SwapLinkShape = 'route'): string {\n assertReadAddress(address)\n return [\n `USE topology MATCH (t:Address {address:'${address}'})<-[c:DEPLOYED_CONTRACT]-(:Address)`,\n 'WITH t, c ORDER BY c.block_height LIMIT 1',\n 'MATCH (l:Address {address: c.tx_origin})',\n funderRead(shape),\n 'WITH t, c, l, f, e ORDER BY e.first_seen_timestamp LIMIT 1',\n BRIDGE_READ,\n 'WITH t, c, l, f, e, ch, b ORDER BY b.first_height LIMIT 1',\n `RETURN ${TOKEN_COLUMNS}, ${partyColumns(shape)} LIMIT 1`,\n ].join(' ')\n}\n\nfunction funderRead(shape: SwapLinkShape): string {\n return shape === 'levels' ? LEVELS_FUNDER_READ : FUNDER_READ\n}\n\nfunction partyColumns(shape: SwapLinkShape): string {\n return shape === 'levels'\n ? PARTY_COLUMNS.replace('e.amount_usd_sum AS funding_usd', LEVELS_FUNDING_COLUMNS)\n : PARTY_COLUMNS\n}\n\n/** The wallet read: the address as the launcher itself. */\nexport function walletScreenQuery(address: string, shape: SwapLinkShape = 'route'): string {\n assertReadAddress(address)\n return [\n `USE topology MATCH (l:Address {address:'${address}'})`,\n funderRead(shape),\n 'WITH l, f, e ORDER BY e.first_seen_timestamp LIMIT 1',\n BRIDGE_READ,\n 'WITH l, f, e, ch, b ORDER BY b.first_height LIMIT 1',\n `RETURN l.address AS launcher, ${partyColumns(shape)} LIMIT 1`,\n ].join(' ')\n}\n\n/** The one batch the tool sends: members `token` and `wallet`. */\nexport function deployerScreenQueries(\n address: string,\n shape: SwapLinkShape = 'route'\n): Array<{ id: 'token' | 'wallet'; query: string }> {\n return [\n { id: 'token', query: tokenScreenQuery(address, shape) },\n { id: 'wallet', query: walletScreenQuery(address, shape) },\n ]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nconst textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value.trim() : 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_INPUT.test(value.trim()) ? value.trim().toLowerCase() : null\n\nconst utcOrNull = (ms: number | null): string | null => (isEpochMs(ms) ? utcText(ms) : null)\n\n/**\n * A label from a third-party explorer tag source is training data, never served.\n * The graph is not meant to carry one; this drops it if it ever does.\n */\nexport function isServedLabel(value: string): boolean {\n const lower = value.trim().toLowerCase()\n return !(lower.startsWith('etherscan') || lower.startsWith('data:etherscan'))\n}\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : []\n\n/** labels(n) minus Address, with an unserved label dropped. */\nfunction rolesOf(value: unknown): string[] {\n return strings(value).filter((role) => role !== 'Address' && isServedLabel(role))\n}\n\n// The flag of each judgement mark, and the mark's label word served as its value.\nconst FLAG_CRIMES: Array<[CrimeKind, string, string]> = [\n ['sanctioned', 'is_sanctioned', 'Sanctioned'],\n ['scam', 'is_scam', 'Scam'],\n ['victim', 'is_victim', 'Victim'],\n ['issuer_frozen', 'is_issuer_frozen', 'IssuerFrozen'],\n]\n\n/** The flags that are true, then one risk entry per served risk label with its level. */\nfunction crimeOf(row: Record<string, unknown>, prefix: 'launcher' | 'funder'): Crime[] {\n const crime: Crime[] = []\n for (const [kind, flag, value] of FLAG_CRIMES) {\n if (row[`${prefix}_${flag}`] === true) crime.push({ kind, value, level: null })\n }\n const labels = Array.isArray(row[`${prefix}_risk_labels`]) ? (row[`${prefix}_risk_labels`] as unknown[]) : []\n const levels = Array.isArray(row[`${prefix}_risk_levels`]) ? (row[`${prefix}_risk_levels`] as unknown[]) : []\n labels.forEach((label, at) => {\n if (typeof label !== 'string' || label.trim() === '' || !isServedLabel(label)) return\n crime.push({ kind: 'risk', value: label, level: textOrNull(levels[at]) })\n })\n return crime\n}\n\n/** The funder kinds, first match wins; a contract with no role is 'contract', no match is a plain wallet. */\nexport const FUNDER_KIND_RULES: ReadonlyArray<\n readonly [FunderKind, (roles: readonly string[], isScam: boolean) => boolean]\n> = [\n ['scam', (roles, isScam) => isScam || roles.includes('Scam')],\n ['mixer', (roles) => roles.includes('Mixer')],\n ['exchange', (roles) => roles.includes('Exchange')],\n ['bridge', (roles) => roles.includes('Bridge')],\n ['bundler', (roles) => roles.includes('Bundler')],\n ['launchpad', (roles) => roles.includes('Pool') || roles.includes('Protocol')],\n ['contract', (roles) => roles.includes('Contract')],\n]\n\nexport function funderKind(roles: readonly string[], isScam = false): FunderKind {\n return FUNDER_KIND_RULES.find(([, rule]) => rule(roles, isScam))?.[0] ?? 'wallet'\n}\n\nfunction partyOf(row: Record<string, unknown>): Party | null {\n const address = addressOrNull(row.launcher)\n if (!address) return null\n const firstActivity = numberOrNull(row.launcher_first_activity)\n return {\n address,\n roles: rolesOf(row.launcher_roles),\n crime: crimeOf(row, 'launcher'),\n first_activity: firstActivity,\n first_activity_utc: utcOrNull(firstActivity),\n degree_in: numberOrNull(row.launcher_degree_in),\n degree_out: numberOrNull(row.launcher_degree_out),\n }\n}\n\nfunction funderOf(row: Record<string, unknown>): Funder | null {\n const address = addressOrNull(row.funder)\n if (!address) return null\n const roles = rolesOf(row.funder_roles)\n const firstActivity = numberOrNull(row.funder_first_activity)\n const fundedAt = numberOrNull(row.funded_at)\n return {\n address,\n kind: funderKind(roles, row.funder_is_scam === true),\n roles,\n crime: crimeOf(row, 'funder'),\n degree_out: numberOrNull(row.funder_degree_out),\n first_activity: firstActivity,\n first_activity_utc: utcOrNull(firstActivity),\n funded_at: fundedAt,\n funded_at_utc: utcOrNull(fundedAt),\n funding_tx_count: numberOrNull(row.funding_tx_count),\n funding_usd: numberOrNull(row.funding_usd),\n // Only a levels read returns funding_link; a read of before adds no key.\n ...(row.funding_link === 'ROUTED_TO'\n ? { funded_via: 'swap' as const }\n : row.funding_link === 'FLOWED_TO'\n ? { funded_via: 'transfer' as const }\n : {}),\n }\n}\n\nfunction bridgedInOf(row: Record<string, unknown>): BridgedIn | null {\n const chain = textOrNull(row.bridged_chain)\n const kind = textOrNull(row.bridged_kind)\n if (!chain && !kind) return null\n const asset = textOrNull(row.bridged_asset)\n return {\n chain,\n bridge: addressOrNull(row.bridged_bridge) ?? textOrNull(row.bridged_bridge),\n kind,\n asset: addressOrNull(asset) ?? asset,\n first_block: numberOrNull(row.bridged_first_block),\n }\n}\n\nfunction creationOf(row: Record<string, unknown>): Creation {\n const factory = addressOrNull(row.factory)\n const kind = textOrNull(row.creation_kind)\n const time = numberOrNull(row.creation_time)\n return {\n tx: textOrNull(row.creation_tx)?.toLowerCase() ?? null,\n block: numberOrNull(row.creation_block),\n time,\n time_utc: utcOrNull(time),\n deployer: addressOrNull(row.deployer),\n factory,\n mode: kind === 'factory' || (kind !== 'direct' && factory !== null) ? 'factory' : 'direct',\n }\n}\n\n/** The first row of a member that names a launcher, or null when it has none. */\nfunction launcherRow(member: Member | undefined): Record<string, unknown> | null {\n if (!member || !Array.isArray(member.results)) return null\n return member.results.find((row) => isRecord(row) && addressOrNull(row.launcher) !== null) ?? null\n}\n\nconst answered = (member: Member | undefined): boolean =>\n member?.ok === true && Array.isArray(member.results)\n\nfunction memberFailure(id: string, member: Member | undefined): string {\n if (!member) return `the ${id} read is missing from the batch answer`\n return typeof member.error === 'string' && member.error.trim() !== ''\n ? member.error\n : `the ${id} read did not answer`\n}\n\n/** The screen built from the two batch members, or why it cannot be. */\nexport function screenFromMembers(\n network: string,\n input: string,\n members: Map<string, Member>\n): { result: AmlDeployerScreenResult } | { failure: string } {\n const token = members.get('token')\n const wallet = members.get('wallet')\n const base = {\n schema: AML_DEPLOYER_SCREEN_SCHEMA,\n tool: AML_DEPLOYER_SCREEN_TOOL,\n network,\n input,\n not_covered: [...NOT_COVERED] as string[],\n }\n\n // A token read that failed cannot be told from \"not a token\": no fallback.\n if (!answered(token)) return { failure: memberFailure('token', token) }\n const tokenRow = launcherRow(token)\n if (tokenRow) {\n const launcher = partyOf(tokenRow)!\n const result = {\n ...base,\n found: true,\n input_kind: 'token' as const,\n token: {\n address: addressOrNull(tokenRow.token) ?? input,\n roles: rolesOf(tokenRow.token_roles),\n },\n creation: creationOf(tokenRow),\n launcher,\n launcher_resolved: !launcher.roles.includes('Bundler'),\n first_funder: funderOf(tokenRow),\n bridged_in: bridgedInOf(tokenRow),\n }\n return { result: { ...result, hint: hintFor(result) } }\n }\n\n if (!answered(wallet)) return { failure: memberFailure('wallet', wallet) }\n const walletRow = launcherRow(wallet)\n if (walletRow) {\n const launcher = partyOf(walletRow)!\n const result = {\n ...base,\n found: true,\n input_kind: 'wallet' as const,\n token: null,\n creation: null,\n launcher,\n launcher_resolved: !launcher.roles.includes('Bundler'),\n first_funder: funderOf(walletRow),\n bridged_in: bridgedInOf(walletRow),\n }\n return { result: { ...result, hint: hintFor(result) } }\n }\n\n const result = {\n ...base,\n found: false,\n input_kind: null,\n token: null,\n creation: null,\n launcher: null,\n launcher_resolved: null,\n first_funder: null,\n bridged_in: null,\n }\n return { result: { ...result, hint: hintFor(result) } }\n}\n\nconst FACTS_ONLY =\n 'Report these as facts. Give no score, no risk level and no verdict of your own: the user decides.'\n\nfunction hintFor(result: Omit<AmlDeployerScreenResult, 'hint'>): string {\n const parts: string[] = [ANSWER_HINT]\n if (!result.found) {\n parts.push(\n `${result.input} is not in the Chain Insights Graph of ${result.network}: no flow, creation or bridge touches it. ` +\n 'Say so in one line. That is not proof the address is clean, and it is not proof it is a token. ' +\n 'Check the network and the address with the user.'\n )\n return parts.join(' ')\n }\n parts.push(FACTS_ONLY)\n if (result.input_kind === 'wallet' && result.launcher?.roles.some((r) => r === 'Contract' || r === 'Token')) {\n parts.push(\n 'The address is a contract, but the graph holds no creation record for it, so it was screened as a wallet.'\n )\n }\n if (result.launcher_resolved === false) {\n parts.push(\n 'The launcher is a bundler: it sends transactions for others, so the person behind the launch is not known from this read.'\n )\n }\n if (!result.first_funder) parts.push('The launcher has no inbound flow in the graph: no first funder.')\n if (result.first_funder?.funded_via === 'swap') {\n parts.push(\n 'The first funder paid the launcher through a swap: say it paid one asset and the launcher got another, and never name a router or a pool as the funder.'\n )\n }\n parts.push(`not_covered names what the graph cannot see yet (${NOT_COVERED.join(', ')}); say so when it matters.`)\n return parts.join(' ')\n}\n\nfunction errorResult(text: string): AmlDeployerScreenToolResult {\n return { content: [{ type: 'text', text }], isError: true }\n}\n\nfunction textResult(structured: AmlDeployerScreenResult): AmlDeployerScreenToolResult {\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/** aml_deployer_screen, {network, address}. Every argument is checked before a read is sent. */\nexport async function handleAmlDeployerScreen(\n args: unknown,\n deps: DeployerScreenDependencies\n): Promise<AmlDeployerScreenToolResult> {\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 const raw = typeof record.address === 'string' ? record.address.trim() : ''\n if (!ADDRESS_INPUT.test(raw)) {\n return errorResult(\n 'invalid_address: address is required: a token contract or a wallet, 0x plus 40 hex characters. ' +\n 'A ticker or a name is not an address: call meta_token_lookup first.'\n )\n }\n const address = raw.toLowerCase()\n\n const unavailable = await deps.unavailable?.()\n if (unavailable) {\n return errorResult(\n `No deployer screen read was sent: ${unavailable} There is no answer yet, which is not \"not found\": try again later.`\n )\n }\n\n // The lane's shape first: a read that fails keeps the reads of 0.82.0.\n let shape: SwapLinkShape = 'route'\n if (deps.linkShape) {\n try {\n shape = await deps.linkShape(network)\n } catch {\n shape = 'route'\n }\n }\n\n let answer: GraphAnswer\n try {\n answer = await deps.graphQueryBatch({ network, queries: deployerScreenQueries(address, shape) })\n } catch (err) {\n return errorResult(\n `The deployer screen read failed: ${deps.describeFailure(err)} This is not \"not found\": send the same screen again once.`\n )\n }\n const members = membersOf(answer)\n if (members.size === 0) {\n const text = answer.isError === true ? refusalOf(answer).text : 'the batch answer held no reads'\n return errorResult(`The deployer screen read failed: ${text} This is not \"not found\".`)\n }\n const screen = screenFromMembers(network, address, members)\n if ('failure' in screen) {\n return errorResult(\n `The deployer screen read failed: ${screen.failure} This is not \"not found\": send the same screen again once.`\n )\n }\n return textResult(screen.result)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,kCACX;AAUF,MAAa,kCAAkC;CAC7C,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,cAAc;CAAC;CAAkB;CAAa;CAAiB;AAAkB;AAgG9F,MAAM,gBAAgB;AACtB,MAAM,eAAe;AAIrB,MAAM,cAAc;AAGpB,MAAM,qBACJ;AAGF,MAAM,yBACJ;AACF,MAAM,cACJ;AACF,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AACX,MAAM,g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":["/**\n * aml_deployer_screen: who is behind a token or a wallet, as facts.\n *\n * A local tool of the proxy. It sends one graph_query_batch with two reads on\n * USE topology, both anchored on the address:\n *\n * token the address as a contract: its first creation (DEPLOYED_CONTRACT),\n * the launcher (the transaction's sender), the launcher's first funder\n * of all time and its first inbound bridge deposit;\n * wallet the address as the launcher itself: the same funder and bridge reads.\n *\n * The funder is the launcher's earliest inbound FLOWED_TO. On a lane whose\n * money family lists ROUTED_TO (the three link levels) it is the earliest of\n * its inbound FLOWED_TO and ROUTED_TO from another address: a launcher funded\n * by the proceeds of a swap names the payer of that swap. A self route (the\n * launcher swapped for itself) is never the funder: it spent money the\n * launcher already held, so the search goes on to what paid it in. Any other\n * lane gets the reads of 0.82.0, byte for byte.\n *\n * The token read answers first when it holds a row; the wallet read answers\n * otherwise. The tool returns facts and never a score, a level or a verdict:\n * the description below is the contract with every host, Claude Desktop chat\n * included, which reads no skill.\n */\n\nimport { ANSWER_HINT } from './answer-hint.js'\nimport { DexRegistryError, normalizeDexNetwork } from './dex-registry.js'\nimport type { SwapLinkShape } from './layer-routing.js'\nimport { isEpochMs, utcText } from './timestamp-text.js'\nimport {\n membersOf,\n refusalOf,\n type GraphAnswer,\n type Member,\n type TokenToolDependencies,\n} from './token-lookup.js'\n\nexport const AML_DEPLOYER_SCREEN_TOOL = 'aml_deployer_screen' as const\nexport const AML_DEPLOYER_SCREEN_SCHEMA = 'chain-insights.aml-deployer-screen.v1' as const\nexport const AML_DEPLOYER_SCREEN_TITLE = 'Deployer screen'\nexport const AML_DEPLOYER_SCREEN_DESCRIPTION =\n 'Facts only, no score and no verdict: screens who is behind a token or a wallet. ' +\n 'For a token contract it returns the creation transaction and the launcher (the wallet that sent it); ' +\n 'for a wallet, that wallet as the launcher. Then the launcher\\'s first funder of all time and what kind of ' +\n 'wallet that funder is (wallet, contract, bridge, bundler, launchpad, exchange, mixer, scam), how many addresses the ' +\n 'funder ever paid, the sanctions, scam, victim and risk labels on each, and the first inbound bridge deposit. ' +\n 'The caller decides. A fresh launcher funded by a wallet that paid few addresses is the pattern to look at; ' +\n 'a funder that paid thousands is shared infrastructure. A launcher that is a bundler hides the real sender: ' +\n 'launcher_resolved is then false. On a lane whose money family lists ROUTED_TO the first funder may have paid ' +\n 'through a swap (funded_via swap): it paid, a router and a pool swapped, the launcher got another asset; a swap ' +\n 'the launcher made for itself is never its funder. not_covered lists what the graph cannot see yet.'\nexport const AML_DEPLOYER_SCREEN_ANNOTATIONS = {\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n} as const\nexport const AML_DEPLOYER_SCREEN_ARGS = ['network', 'address'] as const\n\n/** What the two reads cannot see yet, named in every answer. */\nexport const NOT_COVERED = ['exploit_labels', 'ml_labels', 'bridge_sender', 'ethereum_history'] as const\n\nexport type CrimeKind = 'sanctioned' | 'scam' | 'victim' | 'issuer_frozen' | 'risk'\nexport interface Crime {\n kind: CrimeKind\n value: string\n level: string | null\n}\n\nexport interface Party {\n address: string\n roles: string[]\n crime: Crime[]\n first_activity: number | null\n first_activity_utc: string | null\n degree_in: number | null\n degree_out: number | null\n}\n\nexport type FunderKind = 'scam' | 'mixer' | 'exchange' | 'bridge' | 'bundler' | 'launchpad' | 'contract' | 'wallet'\n\nexport interface Funder {\n address: string\n kind: FunderKind\n roles: string[]\n crime: Crime[]\n degree_out: number | null\n first_activity: number | null\n first_activity_utc: string | null\n funded_at: number | null\n funded_at_utc: string | null\n funding_tx_count: number | null\n funding_usd: number | null\n /**\n * On a lane with the levels only: `transfer` when the first money came on\n * FLOWED_TO, `swap` when on ROUTED_TO (the funder paid, the launcher got the\n * bought asset; funding_usd is then what the launcher got).\n */\n funded_via?: 'transfer' | 'swap'\n}\n\nexport interface Creation {\n tx: string | null\n block: number | null\n time: number | null\n time_utc: string | null\n deployer: string | null\n factory: string | null\n mode: 'direct' | 'factory'\n}\n\nexport interface BridgedIn {\n chain: string | null\n bridge: string | null\n kind: string | null\n asset: string | null\n first_block: number | null\n}\n\nexport interface AmlDeployerScreenResult {\n schema: typeof AML_DEPLOYER_SCREEN_SCHEMA\n tool: typeof AML_DEPLOYER_SCREEN_TOOL\n network: string\n input: string\n /** false when the graph holds no node for the address: every fact below is then null. */\n found: boolean\n input_kind: 'token' | 'wallet' | null\n token: { address: string; roles: string[] } | null\n creation: Creation | null\n launcher: Party | null\n launcher_resolved: boolean | null\n first_funder: Funder | null\n bridged_in: BridgedIn | null\n not_covered: string[]\n hint: string\n}\n\nexport type DeployerScreenDependencies = Pick<\n TokenToolDependencies,\n 'graphQueryBatch' | 'unavailable' | 'describeFailure'\n> & {\n /**\n * The lane's graph shape (`meta_network_capabilities`, kept by the proxy).\n * The funder read walks ROUTED_TO only when it answers `levels`; absent,\n * `route` or a read that throws keeps the reads of 0.82.0.\n */\n linkShape?: (network: string) => Promise<SwapLinkShape> | SwapLinkShape\n}\n\nexport type AmlDeployerScreenToolResult = {\n content: Array<{ type: 'text'; text: string }>\n structuredContent?: Record<string, unknown>\n isError: boolean\n}\n\n// The only address form ever written into a read: 0x and 40 lowercase hex.\nconst ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/\nconst ADDRESS_READ = /^0x[0-9a-f]{40}$/\n\n// The funder's first inbound flow and the first inbound bridge deposit of the\n// launcher `l`, and the columns both reads return about them.\nconst FUNDER_READ = 'OPTIONAL MATCH (f:Address)-[e:FLOWED_TO]->(l)'\n// On a lane with the levels: the first money from another address, funds or a\n// swap route; the self route is left out (it spent what the launcher held).\nconst LEVELS_FUNDER_READ =\n 'OPTIONAL MATCH (f:Address)-[e:FLOWED_TO|ROUTED_TO]->(l) WHERE f.address <> l.address'\n// What the launcher got: a route carries it in bought_usd_sum, a FLOWED_TO in\n// amount_usd_sum; and which link it came on.\nconst LEVELS_FUNDING_COLUMNS =\n 'coalesce(e.bought_usd_sum, e.amount_usd_sum) AS funding_usd, type(e) AS funding_link'\nconst BRIDGE_READ =\n \"OPTIONAL MATCH (ch:Chain)-[b:BRIDGED]->(l) WHERE b.kind IN ['TOKEN_DEPOSIT','NATIVE_DEPOSIT']\"\nconst PARTY_COLUMNS = [\n 'labels(l) AS launcher_roles',\n 'l.first_activity_timestamp AS launcher_first_activity',\n 'l.degree_in AS launcher_degree_in',\n 'l.degree_out AS launcher_degree_out',\n 'l.is_sanctioned AS launcher_is_sanctioned',\n 'l.is_scam AS launcher_is_scam',\n 'l.is_victim AS launcher_is_victim',\n 'l.is_issuer_frozen AS launcher_is_issuer_frozen',\n 'l.label_risk_labels AS launcher_risk_labels',\n 'l.label_risk_levels AS launcher_risk_levels',\n 'f.address AS funder',\n 'labels(f) AS funder_roles',\n 'f.degree_out AS funder_degree_out',\n 'f.first_activity_timestamp AS funder_first_activity',\n 'f.is_sanctioned AS funder_is_sanctioned',\n 'f.is_scam AS funder_is_scam',\n 'f.is_victim AS funder_is_victim',\n 'f.is_issuer_frozen AS funder_is_issuer_frozen',\n 'f.label_risk_labels AS funder_risk_labels',\n 'f.label_risk_levels AS funder_risk_levels',\n 'e.first_seen_timestamp AS funded_at',\n 'e.tx_count AS funding_tx_count',\n 'e.amount_usd_sum AS funding_usd',\n 'ch.network AS bridged_chain',\n 'ch.address AS bridged_bridge',\n 'b.kind AS bridged_kind',\n 'b.asset AS bridged_asset',\n 'b.first_height AS bridged_first_block',\n].join(', ')\nconst TOKEN_COLUMNS = [\n 't.address AS token',\n 'labels(t) AS token_roles',\n 'c.tx_origin AS launcher',\n 'c.deployer_address AS deployer',\n 'c.factory_address AS factory',\n 'c.kind AS creation_kind',\n 'c.tx_id AS creation_tx',\n 'c.block_height AS creation_block',\n 'c.block_timestamp AS creation_time',\n].join(', ')\n\nfunction assertReadAddress(address: string): void {\n if (!ADDRESS_READ.test(address)) {\n throw new Error(`deployer screen: ${JSON.stringify(address)} is not a lowercase 0x address`)\n }\n}\n\n/** The token read: the address as a contract, its first creation and who sent it. */\nexport function tokenScreenQuery(address: string, shape: SwapLinkShape = 'route'): string {\n assertReadAddress(address)\n return [\n `USE topology MATCH (t:Address {address:'${address}'})<-[c:DEPLOYED_CONTRACT]-(:Address)`,\n 'WITH t, c ORDER BY c.block_height LIMIT 1',\n 'MATCH (l:Address {address: c.tx_origin})',\n funderRead(shape),\n 'WITH t, c, l, f, e ORDER BY e.first_seen_timestamp LIMIT 1',\n BRIDGE_READ,\n 'WITH t, c, l, f, e, ch, b ORDER BY b.first_height LIMIT 1',\n `RETURN ${TOKEN_COLUMNS}, ${partyColumns(shape)} LIMIT 1`,\n ].join(' ')\n}\n\nfunction funderRead(shape: SwapLinkShape): string {\n return shape === 'levels' ? LEVELS_FUNDER_READ : FUNDER_READ\n}\n\nfunction partyColumns(shape: SwapLinkShape): string {\n return shape === 'levels'\n ? PARTY_COLUMNS.replace('e.amount_usd_sum AS funding_usd', LEVELS_FUNDING_COLUMNS)\n : PARTY_COLUMNS\n}\n\n/** The wallet read: the address as the launcher itself. */\nexport function walletScreenQuery(address: string, shape: SwapLinkShape = 'route'): string {\n assertReadAddress(address)\n return [\n `USE topology MATCH (l:Address {address:'${address}'})`,\n funderRead(shape),\n 'WITH l, f, e ORDER BY e.first_seen_timestamp LIMIT 1',\n BRIDGE_READ,\n 'WITH l, f, e, ch, b ORDER BY b.first_height LIMIT 1',\n `RETURN l.address AS launcher, ${partyColumns(shape)} LIMIT 1`,\n ].join(' ')\n}\n\n/** The one batch the tool sends: members `token` and `wallet`. */\nexport function deployerScreenQueries(\n address: string,\n shape: SwapLinkShape = 'route'\n): Array<{ id: 'token' | 'wallet'; query: string }> {\n return [\n { id: 'token', query: tokenScreenQuery(address, shape) },\n { id: 'wallet', query: walletScreenQuery(address, shape) },\n ]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nconst textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value.trim() : 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_INPUT.test(value.trim()) ? value.trim().toLowerCase() : null\n\nconst utcOrNull = (ms: number | null): string | null => (isEpochMs(ms) ? utcText(ms) : null)\n\n/**\n * A label from a third-party explorer tag source is training data, never served.\n * The graph is not meant to carry one; this drops it if it ever does.\n */\nexport function isServedLabel(value: string): boolean {\n const lower = value.trim().toLowerCase()\n return !(lower.startsWith('etherscan') || lower.startsWith('data:etherscan'))\n}\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : []\n\n/** labels(n) minus Address, with an unserved label dropped. */\nfunction rolesOf(value: unknown): string[] {\n return strings(value).filter((role) => role !== 'Address' && isServedLabel(role))\n}\n\n// The flag of each judgement mark, and the mark's label word served as its value.\nconst FLAG_CRIMES: Array<[CrimeKind, string, string]> = [\n ['sanctioned', 'is_sanctioned', 'Sanctioned'],\n ['scam', 'is_scam', 'Scam'],\n ['victim', 'is_victim', 'Victim'],\n ['issuer_frozen', 'is_issuer_frozen', 'IssuerFrozen'],\n]\n\n/** The flags that are true, then one risk entry per served risk label with its level. */\nfunction crimeOf(row: Record<string, unknown>, prefix: 'launcher' | 'funder'): Crime[] {\n const crime: Crime[] = []\n for (const [kind, flag, value] of FLAG_CRIMES) {\n if (row[`${prefix}_${flag}`] === true) crime.push({ kind, value, level: null })\n }\n const labels = Array.isArray(row[`${prefix}_risk_labels`]) ? (row[`${prefix}_risk_labels`] as unknown[]) : []\n const levels = Array.isArray(row[`${prefix}_risk_levels`]) ? (row[`${prefix}_risk_levels`] as unknown[]) : []\n labels.forEach((label, at) => {\n if (typeof label !== 'string' || label.trim() === '' || !isServedLabel(label)) return\n crime.push({ kind: 'risk', value: label, level: textOrNull(levels[at]) })\n })\n return crime\n}\n\n/** The funder kinds, first match wins; a contract with no role is 'contract', no match is a plain wallet. */\nexport const FUNDER_KIND_RULES: ReadonlyArray<\n readonly [FunderKind, (roles: readonly string[], isScam: boolean) => boolean]\n> = [\n ['scam', (roles, isScam) => isScam || roles.includes('Scam')],\n ['mixer', (roles) => roles.includes('Mixer')],\n ['exchange', (roles) => roles.includes('Exchange')],\n ['bridge', (roles) => roles.includes('Bridge')],\n ['bundler', (roles) => roles.includes('Bundler')],\n ['launchpad', (roles) => roles.includes('Pool') || roles.includes('Protocol')],\n ['contract', (roles) => roles.includes('Contract')],\n]\n\nexport function funderKind(roles: readonly string[], isScam = false): FunderKind {\n return FUNDER_KIND_RULES.find(([, rule]) => rule(roles, isScam))?.[0] ?? 'wallet'\n}\n\nfunction partyOf(row: Record<string, unknown>): Party | null {\n const address = addressOrNull(row.launcher)\n if (!address) return null\n const firstActivity = numberOrNull(row.launcher_first_activity)\n return {\n address,\n roles: rolesOf(row.launcher_roles),\n crime: crimeOf(row, 'launcher'),\n first_activity: firstActivity,\n first_activity_utc: utcOrNull(firstActivity),\n degree_in: numberOrNull(row.launcher_degree_in),\n degree_out: numberOrNull(row.launcher_degree_out),\n }\n}\n\nfunction funderOf(row: Record<string, unknown>): Funder | null {\n const address = addressOrNull(row.funder)\n if (!address) return null\n const roles = rolesOf(row.funder_roles)\n const firstActivity = numberOrNull(row.funder_first_activity)\n const fundedAt = numberOrNull(row.funded_at)\n return {\n address,\n kind: funderKind(roles, row.funder_is_scam === true),\n roles,\n crime: crimeOf(row, 'funder'),\n degree_out: numberOrNull(row.funder_degree_out),\n first_activity: firstActivity,\n first_activity_utc: utcOrNull(firstActivity),\n funded_at: fundedAt,\n funded_at_utc: utcOrNull(fundedAt),\n funding_tx_count: numberOrNull(row.funding_tx_count),\n funding_usd: numberOrNull(row.funding_usd),\n // Only a levels read returns funding_link; a read of before adds no key.\n ...(row.funding_link === 'ROUTED_TO'\n ? { funded_via: 'swap' as const }\n : row.funding_link === 'FLOWED_TO'\n ? { funded_via: 'transfer' as const }\n : {}),\n }\n}\n\nfunction bridgedInOf(row: Record<string, unknown>): BridgedIn | null {\n const chain = textOrNull(row.bridged_chain)\n const kind = textOrNull(row.bridged_kind)\n if (!chain && !kind) return null\n const asset = textOrNull(row.bridged_asset)\n return {\n chain,\n bridge: addressOrNull(row.bridged_bridge) ?? textOrNull(row.bridged_bridge),\n kind,\n asset: addressOrNull(asset) ?? asset,\n first_block: numberOrNull(row.bridged_first_block),\n }\n}\n\nfunction creationOf(row: Record<string, unknown>): Creation {\n const factory = addressOrNull(row.factory)\n const kind = textOrNull(row.creation_kind)\n const time = numberOrNull(row.creation_time)\n return {\n tx: textOrNull(row.creation_tx)?.toLowerCase() ?? null,\n block: numberOrNull(row.creation_block),\n time,\n time_utc: utcOrNull(time),\n deployer: addressOrNull(row.deployer),\n factory,\n mode: kind === 'factory' || (kind !== 'direct' && factory !== null) ? 'factory' : 'direct',\n }\n}\n\n/** The first row of a member that names a launcher, or null when it has none. */\nfunction launcherRow(member: Member | undefined): Record<string, unknown> | null {\n if (!member || !Array.isArray(member.results)) return null\n return member.results.find((row) => isRecord(row) && addressOrNull(row.launcher) !== null) ?? null\n}\n\nconst answered = (member: Member | undefined): boolean =>\n member?.ok === true && Array.isArray(member.results)\n\nfunction memberFailure(id: string, member: Member | undefined): string {\n if (!member) return `the ${id} read is missing from the batch answer`\n return typeof member.error === 'string' && member.error.trim() !== ''\n ? member.error\n : `the ${id} read did not answer`\n}\n\n/** The screen built from the two batch members, or why it cannot be. */\nexport function screenFromMembers(\n network: string,\n input: string,\n members: Map<string, Member>\n): { result: AmlDeployerScreenResult } | { failure: string } {\n const token = members.get('token')\n const wallet = members.get('wallet')\n const base = {\n schema: AML_DEPLOYER_SCREEN_SCHEMA,\n tool: AML_DEPLOYER_SCREEN_TOOL,\n network,\n input,\n not_covered: [...NOT_COVERED] as string[],\n }\n\n // A token read that failed cannot be told from \"not a token\": no fallback.\n if (!answered(token)) return { failure: memberFailure('token', token) }\n const tokenRow = launcherRow(token)\n if (tokenRow) {\n const launcher = partyOf(tokenRow)!\n const result = {\n ...base,\n found: true,\n input_kind: 'token' as const,\n token: {\n address: addressOrNull(tokenRow.token) ?? input,\n roles: rolesOf(tokenRow.token_roles),\n },\n creation: creationOf(tokenRow),\n launcher,\n launcher_resolved: !launcher.roles.includes('Bundler'),\n first_funder: funderOf(tokenRow),\n bridged_in: bridgedInOf(tokenRow),\n }\n return { result: { ...result, hint: hintFor(result) } }\n }\n\n if (!answered(wallet)) return { failure: memberFailure('wallet', wallet) }\n const walletRow = launcherRow(wallet)\n if (walletRow) {\n const launcher = partyOf(walletRow)!\n const result = {\n ...base,\n found: true,\n input_kind: 'wallet' as const,\n token: null,\n creation: null,\n launcher,\n launcher_resolved: !launcher.roles.includes('Bundler'),\n first_funder: funderOf(walletRow),\n bridged_in: bridgedInOf(walletRow),\n }\n return { result: { ...result, hint: hintFor(result) } }\n }\n\n const result = {\n ...base,\n found: false,\n input_kind: null,\n token: null,\n creation: null,\n launcher: null,\n launcher_resolved: null,\n first_funder: null,\n bridged_in: null,\n }\n return { result: { ...result, hint: hintFor(result) } }\n}\n\nconst FACTS_ONLY =\n 'Report these as facts. Give no score, no risk level and no verdict of your own: the user decides.'\n\nfunction hintFor(result: Omit<AmlDeployerScreenResult, 'hint'>): string {\n const parts: string[] = [ANSWER_HINT]\n if (!result.found) {\n parts.push(\n `${result.input} is not in the Chain Insights Graph of ${result.network}: no flow, creation or bridge touches it. ` +\n 'Say so in one line. That is not proof the address is clean, and it is not proof it is a token. ' +\n 'Check the network and the address with the user.'\n )\n return parts.join(' ')\n }\n parts.push(FACTS_ONLY)\n if (result.input_kind === 'wallet' && result.launcher?.roles.some((r) => r === 'Contract' || r === 'Token')) {\n parts.push(\n 'The address is a contract, but the graph holds no creation record for it, so it was screened as a wallet.'\n )\n }\n if (result.launcher_resolved === false) {\n parts.push(\n 'The launcher is a bundler: it sends transactions for others, so the person behind the launch is not known from this read.'\n )\n }\n if (!result.first_funder) parts.push('The launcher has no inbound flow in the graph: no first funder.')\n if (result.first_funder?.funded_via === 'swap') {\n parts.push(\n 'The first funder paid the launcher through a swap: say it paid one asset and the launcher got another, and never name a router or a pool as the funder.'\n )\n }\n parts.push(`not_covered names what the graph cannot see yet (${NOT_COVERED.join(', ')}); say so when it matters.`)\n return parts.join(' ')\n}\n\nfunction errorResult(text: string): AmlDeployerScreenToolResult {\n return { content: [{ type: 'text', text }], isError: true }\n}\n\nfunction textResult(structured: AmlDeployerScreenResult): AmlDeployerScreenToolResult {\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/** aml_deployer_screen, {network, address}. Every argument is checked before a read is sent. */\nexport async function handleAmlDeployerScreen(\n args: unknown,\n deps: DeployerScreenDependencies\n): Promise<AmlDeployerScreenToolResult> {\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 const raw = typeof record.address === 'string' ? record.address.trim() : ''\n if (!ADDRESS_INPUT.test(raw)) {\n return errorResult(\n 'invalid_address: address is required: a token contract or a wallet, 0x plus 40 hex characters. ' +\n 'A ticker or a name is not an address: call meta_token_lookup first.'\n )\n }\n const address = raw.toLowerCase()\n\n const unavailable = await deps.unavailable?.()\n if (unavailable) {\n return errorResult(\n `No deployer screen read was sent: ${unavailable} There is no answer yet, which is not \"not found\": try again later.`\n )\n }\n\n // The lane's shape first: a read that fails keeps the reads of 0.82.0.\n let shape: SwapLinkShape = 'route'\n if (deps.linkShape) {\n try {\n shape = await deps.linkShape(network)\n } catch {\n shape = 'route'\n }\n }\n\n let answer: GraphAnswer\n try {\n answer = await deps.graphQueryBatch({ network, queries: deployerScreenQueries(address, shape) })\n } catch (err) {\n return errorResult(\n `The deployer screen read failed: ${deps.describeFailure(err)} This is not \"not found\": send the same screen again once.`\n )\n }\n const members = membersOf(answer)\n if (members.size === 0) {\n const text = answer.isError === true ? refusalOf(answer).text : 'the batch answer held no reads'\n return errorResult(`The deployer screen read failed: ${text} This is not \"not found\".`)\n }\n const screen = screenFromMembers(network, address, members)\n if ('failure' in screen) {\n return errorResult(\n `The deployer screen read failed: ${screen.failure} This is not \"not found\": send the same screen again once.`\n )\n }\n return textResult(screen.result)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,4BAA4B;AACzC,MAAa,kCACX;AAUF,MAAa,kCAAkC;CAC7C,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,cAAc;CAAC;CAAkB;CAAa;CAAiB;AAAkB;AAgG9F,MAAM,gBAAgB;AACtB,MAAM,eAAe;AAIrB,MAAM,cAAc;AAGpB,MAAM,qBACJ;AAGF,MAAM,yBACJ;AACF,MAAM,cACJ;AACF,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AACX,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAS,kBAAkB,SAAuB;CAChD,IAAI,CAAC,aAAa,KAAK,OAAO,GAC5B,MAAM,IAAI,MAAM,oBAAoB,KAAK,UAAU,OAAO,EAAE,+BAA+B;AAE/F;;AAGA,SAAgB,iBAAiB,SAAiB,QAAuB,SAAiB;CACxF,kBAAkB,OAAO;CACzB,OAAO;EACL,2CAA2C,QAAQ;EACnD;EACA;EACA,WAAW,KAAK;EAChB;EACA;EACA;EACA,UAAU,cAAc,IAAI,aAAa,KAAK,EAAE;CAClD,CAAC,CAAC,KAAK,GAAG;AACZ;AAEA,SAAS,WAAW,OAA8B;CAChD,OAAO,UAAU,WAAW,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c,MAAM,KAAK,cAAc;CAC7C,IAAI,aACF,OAAO,YACL,qCAAqC,YAAY,oEACnD;CAIF,IAAI,QAAuB;CAC3B,IAAI,KAAK,WACP,IAAI;EACF,QAAQ,MAAM,KAAK,UAAU,OAAO;CACtC,QAAQ;EACN,QAAQ;CACV;CAGF,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,KAAK,gBAAgB;GAAE;GAAS,SAAS,sBAAsB,SAAS,KAAK;EAAE,CAAC;CACjG,SAAS,KAAK;EACZ,OAAO,YACL,oCAAoC,KAAK,gBAAgB,GAAG,EAAE,2DAChE;CACF;CACA,MAAM,UAAU,UAAU,MAAM;CAChC,IAAI,QAAQ,SAAS,GAEnB,OAAO,YAAY,oCADN,OAAO,YAAY,OAAO,UAAU,MAAM,CAAC,CAAC,OAAO,iCACJ,0BAA0B;CAExF,MAAM,SAAS,kBAAkB,SAAS,SAAS,OAAO;CAC1D,IAAI,aAAa,QACf,OAAO,YACL,oCAAoC,OAAO,QAAQ,2DACrD;CAEF,OAAO,WAAW,OAAO,MAAM;AACjC"}
@@ -5,7 +5,7 @@ import { n as exchangeOfWallet, t as exchangeOfLabels } from "./exchange-registr
5
5
  import { t as EXCHANGE_OPENING_RULE } from "./exchange-tool-Dc46SJ49.mjs";
6
6
  import { t as CEX_ROLES } from "./graph-schema-CRQuKya1.mjs";
7
7
  import { i as isEpochMs, o as utcText } from "./print-result-IFARsMnL.mjs";
8
- import { c as refusalOf, s as membersOf } from "./token-lookup-QpIv77P2.mjs";
8
+ import { c as refusalOf, s as membersOf } from "./token-lookup-Dtid9MwW.mjs";
9
9
  // src/mcp/exchange-deposit-check.ts
10
10
  /**
11
11
  * aml_exchange_deposit_check: is this address an exchange deposit, of which
@@ -389,4 +389,4 @@ async function handleAmlExchangeDepositCheck(args, deps) {
389
389
  }
390
390
  export { exchange_deposit_check_exports as a, AML_EXCHANGE_DEPOSIT_CHECK_TOOL as i, AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION as n, handleAmlExchangeDepositCheck as o, AML_EXCHANGE_DEPOSIT_CHECK_TITLE as r, AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS as t };
391
391
 
392
- //# sourceMappingURL=exchange-deposit-check-9bGrKwcX.mjs.map
392
+ //# sourceMappingURL=exchange-deposit-check-BgmQnC7m.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exchange-deposit-check-9bGrKwcX.mjs","names":[],"sources":["../src/mcp/exchange-deposit-check.ts"],"sourcesContent":["/**\n * aml_exchange_deposit_check: is this address an exchange deposit, of which\n * exchange, and into which hot wallet was it swept?\n *\n * A local tool of the proxy. It sends one graph_query_batch with six reads on\n * USE topology, all anchored on the address:\n *\n * node the address: its node labels, its label words and `cex_role`;\n * swept its `SWEPT` links: each hot wallet it swept into, with the sweep\n * count, the USD sum, the paths and the first and last sweep;\n * paid_by how many addresses paid it, and how many of them are exchange\n * wallets;\n * paid how many addresses it paid, and how many of them are exchange\n * wallets;\n * swapped on how many DEX pools it swapped;\n * approved how many spenders it approved.\n *\n * The last four are the behaviour of the address, as counts: what a host needs\n * to say why an address does or does not look like a deposit, without a guess.\n * A behaviour read that fails leaves its counts null; the check still answers.\n *\n * `SWEPT` (layer `cex_sweeps`) is drawn only from an address the deposit rule\n * judged a deposit, and `cex_role` comes from the exchange label's subtype. The\n * graph judges, this tool only reads.\n *\n * The exchange model's own guess rides beside them on the node (graph sync\n * layer `inferred`): `inferred_exchange_role`, an `ml:exchange-roles:<model>:\n * <basis>` entry in `inferred_sources`, and the time it was written. It is\n * never a label and never a SWEPT link. A sourced mark always wins; an\n * address with only the guess is answered as inferred, with the model, and\n * `is_deposit` stays false. The exchange is named from the lookup\n * file (src/mcp/exchange-registry.ts): the hot wallet it swept into, else a\n * label word.\n */\n\nimport { ANSWER_HINT } from './answer-hint.js'\nimport { DexRegistryError, normalizeDexNetwork } from './dex-registry.js'\nimport {\n exchangeOfLabels,\n exchangeOfWallet,\n type ExchangeEntry,\n type LoadedExchangeRegistry,\n} from './exchange-registry.js'\nimport { EXCHANGE_OPENING_RULE } from './exchange-tool.js'\nimport { CEX_ROLES } from './graph-schema.js'\nimport { isEpochMs, utcText } from './timestamp-text.js'\nimport { membersOf, refusalOf, type GraphAnswer, type Member } from './token-lookup.js'\n\nexport const AML_EXCHANGE_DEPOSIT_CHECK_TOOL = 'aml_exchange_deposit_check' as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA =\n 'chain-insights.aml-exchange-deposit-check.v1' as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_TITLE = 'Exchange deposit check'\n/**\n * What the graph's deposit rule holds an address to, in the words every host\n * reads. The rule judges; a host that re-judges from payer counts or volume\n * invents a rule (\"a real deposit has many payers\") and gets the reason wrong.\n */\n/** How a deposit address behaves: the answer to \"what makes an address a deposit address\". Every result carries it as deposit_profile. */\nexport const EXCHANGE_DEPOSIT_BEHAVIOUR =\n \"A deposit address is one customer's: everything it sends goes to the wallets of one exchange (a sweep into a hot wallet), few outside addresses ever pay it, it never swaps on a DEX, and it is no token, pool, router or smart account.\"\n\nexport const EXCHANGE_DEPOSIT_PROFILE =\n `${EXCHANGE_DEPOSIT_BEHAVIOUR} ` +\n 'The graph judges that, never you: the verdict is is_deposit, cex_role and swept. Give behaviour and does_not_fit_deposit as the facts behind it, and never set a threshold of your own for payers, volume or sweeps. ' +\n 'With no deposit mark an address is not shown to be a deposit, whoever says it is one; with found false it has no activity on the network, and the claim is unproven there.'\n\n/** The one rule for an inferred answer, in the description every host reads and in the skill. */\nexport const EXCHANGE_INFERRED_RULE =\n \"An answer with inferred: true is the exchange model's prediction, not a listed source: report the address as inferred by the model, with its version (inferred_model), never as a confirmed exchange address.\"\n\nexport const AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION =\n 'Checks one address: is it a deposit address of a centralized exchange (Binance, Bitget, Bybit, Coinbase, Gate, KuCoin, MEXC, OKX, ...), ' +\n 'of which exchange, and into which hot wallet was it swept, how many times, by which path and when. ' +\n 'It reads the SWEPT links of the address and its cex_role (deposit, hot_wallet, cold_wallet or withdrawal) on the graph, and its behaviour as counts ' +\n '(how many addresses paid it, how many it paid, how many of each are exchange wallets, the DEX pools it swapped on, the spenders it approved), anchored on the address: ' +\n 'six reads in one batch, billed as any read. Use it when a trail reaches an address that may be an exchange wallet, when the user asks where money entered an exchange, ' +\n 'or when someone says an address is an exchange deposit: a claim is never proof, the answer of this tool is. ' +\n `${EXCHANGE_DEPOSIT_PROFILE} ${EXCHANGE_INFERRED_RULE} ${EXCHANGE_OPENING_RULE}`\nexport const AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS = {\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n} as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_ARGS = ['network', 'address'] as const\n\n/** The most hot wallets one deposit's read returns. */\nexport const SWEPT_LIMIT = 20\n\nexport type CexRole = (typeof CEX_ROLES)[number]\n\n/** The roles the exchange model infers. */\nexport const INFERRED_EXCHANGE_ROLES = ['deposit', 'hot_wallet'] as const\nexport type InferredExchangeRole = (typeof INFERRED_EXCHANGE_ROLES)[number]\n\n/**\n * Why the model inferred the role, from the suffix of its source entry:\n * `rule` a deposit behind a listed hot wallet, `rule-p` a deposit behind a hot\n * wallet the model inferred, `p-hub` a hot wallet the model inferred.\n */\nexport const INFERRED_BASIS = {\n rule: 'listed_hot_wallet',\n 'rule-p': 'predicted_hot_wallet',\n 'p-hub': 'predicted',\n} as const\nexport type InferredBasis = (typeof INFERRED_BASIS)[keyof typeof INFERRED_BASIS]\n\n/** The prefix of the exchange model's entries in `inferred_sources`. */\nexport const EXCHANGE_MODEL_SOURCE_PREFIX = 'ml:exchange-roles:'\n\nexport interface InferredExchangeMark {\n role: InferredExchangeRole\n model: string\n basis: InferredBasis\n /** ISO time the graph wrote the guess, or null when it carries none. */\n at: string | null\n}\n\nexport interface Sweep {\n hot_wallet: string\n /** The exchange the hot wallet is listed for, or null when the lookup lists it for none. */\n hot_wallet_exchange: string | null\n hot_wallet_role: string | null\n sweep_count: number | null\n amount_usd_sum: number | null\n paths: string[]\n first_seen: number | null\n first_seen_utc: string | null\n last_seen: number | null\n last_seen_utc: string | null\n}\n\n/** The most links one behaviour read counts: a count equal to it means \"this many or more\". */\nexport const BEHAVIOUR_COUNT_CAP = 5000\n\n/**\n * How the address behaves, as counts of its links. A null count is a read that\n * did not answer. The counts take every link, also a dust one: the graph's\n * deposit rule, which ignores dust, is the judge, and these are its evidence.\n */\nexport interface DepositBehaviour {\n /** Addresses that ever paid it. */\n payers: number | null\n /** Of those, exchange wallets (a hot wallet, or another deposit). */\n payers_exchange: number | null\n /** Addresses it ever paid. */\n receivers: number | null\n /** Of those, exchange wallets. */\n receivers_exchange: number | null\n /** DEX pools it swapped on. */\n dex_pools: number | null\n /** Spenders it approved. */\n approvals: number | null\n /** A count equal to this means \"this many or more\". */\n count_cap: typeof BEHAVIOUR_COUNT_CAP\n}\n\nexport interface AmlExchangeDepositCheckResult {\n schema: typeof AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA\n tool: typeof AML_EXCHANGE_DEPOSIT_CHECK_TOOL\n network: string\n address: string\n /** false when the graph holds no node for the address. */\n found: boolean\n /** true when the address carries cex_role deposit or has a SWEPT link. */\n is_deposit: boolean\n cex_role: CexRole | null\n /** The exchange id, from the hot wallet it swept into, else from its label words. */\n exchange: string | null\n exchange_display: string | null\n labels: string[]\n swept: Sweep[]\n /** The behaviour counts; null when the graph holds no node for the address. */\n behaviour: DepositBehaviour | null\n /** What the counts show that a deposit address does not do. Empty for a deposit, and when nothing shows. */\n does_not_fit_deposit: string[]\n /** How any deposit address behaves: the same text in every answer, for a host asked what makes one. */\n deposit_profile: string\n /** Set only when no sourced mark exists and the exchange model inferred a role. */\n inferred?: true\n inferred_role?: InferredExchangeRole\n /** The model version, from its `ml:exchange-roles:` source entry. */\n inferred_model?: string\n inferred_basis?: InferredBasis\n inferred_at?: string | null\n hint: string\n}\n\nexport interface ExchangeDepositCheckDependencies {\n loadExchangeRegistry: (network: string) => Promise<LoadedExchangeRegistry>\n graphQueryBatch: (args: {\n network: string\n queries: Array<{ id: string; query: string }>\n }) => Promise<GraphAnswer>\n unavailable?: () => Promise<string | undefined> | string | undefined\n describeFailure: (err: unknown) => string\n}\n\nexport type AmlExchangeDepositCheckToolResult = {\n content: Array<{ type: 'text'; text: string }>\n structuredContent?: Record<string, unknown>\n isError: boolean\n}\n\nconst ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/\nconst ADDRESS_READ = /^0x[0-9a-f]{40}$/\n\nfunction assertReadAddress(address: string): void {\n if (!ADDRESS_READ.test(address)) {\n throw new Error(\n `exchange deposit check: ${JSON.stringify(address)} is not a lowercase 0x address`\n )\n }\n}\n\n/** The node read: the address, its marks, its cex_role and the exchange model's inferred role. */\nexport function depositNodeQuery(address: string): string {\n assertReadAddress(address)\n return (\n `USE topology MATCH (a:Address {address: \"${address}\"}) ` +\n 'RETURN a.address AS address, labels(a) AS node_labels, a.labels AS labels, a.cex_role AS cex_role, ' +\n 'a.inferred_exchange_role AS inferred_exchange_role, a.inferred_sources AS inferred_sources, ' +\n 'a.inferred_exchange_role_updated_timestamp AS inferred_exchange_role_updated_timestamp LIMIT 1'\n )\n}\n\n/** The swept read: each hot wallet the address swept into. */\nexport function depositSweptQuery(address: string): string {\n assertReadAddress(address)\n return (\n `USE topology MATCH (a:Address {address: \"${address}\"})-[s:SWEPT]->(h:Address) ` +\n 'RETURN h.address AS hot_wallet, h.labels AS hot_wallet_labels, h.cex_role AS hot_wallet_role, ' +\n 's.sweep_count AS sweep_count, s.amount_usd_sum AS amount_usd_sum, s.paths AS paths, ' +\n `s.first_seen_timestamp AS first_seen_timestamp, s.last_seen_timestamp AS last_seen_timestamp LIMIT ${SWEPT_LIMIT}`\n )\n}\n\n/** The behaviour reads: one count row each, over at most BEHAVIOUR_COUNT_CAP links. */\nexport function depositBehaviourQueries(\n address: string\n): Array<{ id: 'paid_by' | 'paid' | 'swapped' | 'approved'; query: string }> {\n assertReadAddress(address)\n const anchor = `(a:Address {address: \"${address}\"})`\n const exchange = 'sum(CASE WHEN b.is_exchange THEN 1 ELSE 0 END)'\n return [\n {\n id: 'paid_by',\n query:\n `USE topology MATCH ${anchor}<-[:FLOWED_TO]-(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n `RETURN count(b) AS payers, ${exchange} AS payers_exchange LIMIT 1`,\n },\n {\n id: 'paid',\n query:\n `USE topology MATCH ${anchor}-[:FLOWED_TO]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n `RETURN count(b) AS receivers, ${exchange} AS receivers_exchange LIMIT 1`,\n },\n {\n id: 'swapped',\n query:\n `USE topology MATCH ${anchor}-[:SWAPPED]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n 'RETURN count(b) AS dex_pools LIMIT 1',\n },\n {\n id: 'approved',\n query:\n `USE topology MATCH ${anchor}-[:APPROVED]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n 'RETURN count(b) AS approvals LIMIT 1',\n },\n ]\n}\n\n/** The one batch the tool sends: members `node`, `swept` and the four behaviour reads. */\nexport function depositCheckQueries(address: string): Array<{ id: string; query: string }> {\n return [\n { id: 'node', query: depositNodeQuery(address) },\n { id: 'swept', query: depositSweptQuery(address) },\n ...depositBehaviourQueries(address),\n ]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : []\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 textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value.trim() : null\n\nconst addressOrNull = (value: unknown): string | null =>\n typeof value === 'string' && ADDRESS_INPUT.test(value.trim()) ? value.trim().toLowerCase() : null\n\nconst utcOrNull = (ms: number | null): string | null => (isEpochMs(ms) ? utcText(ms) : null)\n\nfunction cexRoleOf(value: unknown): CexRole | null {\n const role = textOrNull(value)?.toLowerCase()\n return (CEX_ROLES as readonly string[]).includes(role ?? '') ? (role as CexRole) : null\n}\n\n/**\n * The exchange model's mark of a node row, or null. It needs both the role and\n * an `ml:exchange-roles:<model>:<basis>` source entry: a role with no entry of\n * the exchange model is no inferred mark. The model version may hold hyphens,\n * underscores and colons; the basis is the last part.\n */\nexport function inferredExchangeOf(\n row: Record<string, unknown> | undefined\n): InferredExchangeMark | null {\n const role = textOrNull(row?.inferred_exchange_role)?.toLowerCase()\n if (!(INFERRED_EXCHANGE_ROLES as readonly string[]).includes(role ?? '')) return null\n const marks: Array<{ model: string; basis: InferredBasis; suffix: string }> = []\n for (const source of strings(row?.inferred_sources)) {\n const entry = source.trim()\n if (!entry.startsWith(EXCHANGE_MODEL_SOURCE_PREFIX)) continue\n const rest = entry.slice(EXCHANGE_MODEL_SOURCE_PREFIX.length)\n const cut = rest.lastIndexOf(':')\n if (cut <= 0) continue\n const model = rest.slice(0, cut)\n const suffix = rest.slice(cut + 1)\n if (!Object.prototype.hasOwnProperty.call(INFERRED_BASIS, suffix)) continue\n marks.push({ model, basis: INFERRED_BASIS[suffix as keyof typeof INFERRED_BASIS], suffix })\n }\n // The entry that fits the role first: p-hub names a hot wallet, rule and rule-p a deposit.\n const fits = (suffix: string) => (role === 'hot_wallet') === (suffix === 'p-hub')\n const mark = marks.find((m) => fits(m.suffix)) ?? marks[0]\n if (!mark) return null\n const ms = numberOrNull(row?.inferred_exchange_role_updated_timestamp)\n return {\n role: role as InferredExchangeRole,\n model: mark.model,\n basis: mark.basis,\n at: isEpochMs(ms) ? new Date(ms).toISOString() : null,\n }\n}\n\nconst answered = (member: Member | undefined): boolean =>\n member?.ok === true && Array.isArray(member.results)\n\nconst rowsOf = (member: Member | undefined): Array<Record<string, unknown>> =>\n answered(member) ? (member!.results as unknown[]).filter(isRecord) : []\n\nfunction memberFailure(id: string, member: Member | undefined): string {\n if (!member) return `the ${id} read is missing from the batch answer`\n return typeof member.error === 'string' && member.error.trim() !== ''\n ? member.error\n : `the ${id} read did not answer`\n}\n\n/** The behaviour counts of the batch members; a member that did not answer leaves its counts null. */\nexport function behaviourFromMembers(members: Map<string, Member>): DepositBehaviour {\n const count = (id: string, column: string): number | null =>\n numberOrNull(rowsOf(members.get(id))[0]?.[column])\n return {\n payers: count('paid_by', 'payers'),\n payers_exchange: count('paid_by', 'payers_exchange'),\n receivers: count('paid', 'receivers'),\n receivers_exchange: count('paid', 'receivers_exchange'),\n dex_pools: count('swapped', 'dex_pools'),\n approvals: count('approved', 'approvals'),\n count_cap: BEHAVIOUR_COUNT_CAP,\n }\n}\n\n/** \"5000 or more\" at the cap, else the number. */\nfunction countText(count: number): string {\n return count >= BEHAVIOUR_COUNT_CAP ? `${BEHAVIOUR_COUNT_CAP} or more` : String(count)\n}\n\nconst plural = (count: number, one: string, many: string): string => (count === 1 ? one : many)\n\n/**\n * What the counts show that a deposit address does not do. Only what needs no\n * threshold: a swap, and a payment to an address that is no exchange wallet.\n * How many payers are \"few\" is the graph rule's to say, never this tool's.\n */\nexport function doesNotFitDeposit(behaviour: DepositBehaviour): string[] {\n const facts: string[] = []\n if (behaviour.dex_pools !== null && behaviour.dex_pools > 0) {\n facts.push(\n `it swapped on ${countText(behaviour.dex_pools)} DEX ${plural(behaviour.dex_pools, 'pool', 'pools')}`\n )\n }\n if (behaviour.receivers !== null && behaviour.receivers_exchange !== null) {\n const outside = behaviour.receivers - behaviour.receivers_exchange\n if (outside > 0) {\n // A capped receiver count makes the difference a floor too.\n const atCap = behaviour.receivers >= BEHAVIOUR_COUNT_CAP ? ' or more' : ''\n facts.push(\n `it paid ${outside}${atCap} ${plural(outside, 'address that is', 'addresses that are')} no exchange wallet`\n )\n }\n }\n return facts\n}\n\n/** The counts as one sentence, the read counts only. */\nexport function behaviourText(behaviour: DepositBehaviour): string {\n const parts: string[] = []\n if (behaviour.payers !== null) {\n parts.push(\n `${countText(behaviour.payers)} ${plural(behaviour.payers, 'address', 'addresses')} paid it` +\n (behaviour.payers_exchange !== null\n ? ` (${countText(behaviour.payers_exchange)} of them exchange wallets)`\n : '')\n )\n }\n if (behaviour.receivers !== null) {\n parts.push(\n `it paid ${countText(behaviour.receivers)} ${plural(behaviour.receivers, 'address', 'addresses')}` +\n (behaviour.receivers_exchange !== null\n ? ` (${countText(behaviour.receivers_exchange)} of them exchange wallets)`\n : '')\n )\n }\n if (behaviour.dex_pools !== null) {\n parts.push(\n `it swapped on ${countText(behaviour.dex_pools)} DEX ${plural(behaviour.dex_pools, 'pool', 'pools')}`\n )\n }\n if (behaviour.approvals !== null) {\n parts.push(\n `it approved ${countText(behaviour.approvals)} ${plural(behaviour.approvals, 'spender', 'spenders')}`\n )\n }\n return parts.join(', ')\n}\n\n/** The check built from the batch members and the lookup rows, or why it cannot be. */\nexport function depositCheckFromMembers(\n network: string,\n address: string,\n members: Map<string, Member>,\n rows: ExchangeEntry[]\n): { result: AmlExchangeDepositCheckResult } | { failure: string } {\n const node = members.get('node')\n const swept = members.get('swept')\n if (!answered(node)) return { failure: memberFailure('node', node) }\n if (!answered(swept)) return { failure: memberFailure('swept', swept) }\n\n const nodeRow = rowsOf(node)[0]\n const labels = strings(nodeRow?.labels)\n const sweeps: Sweep[] = []\n let exchange: ExchangeEntry | null = null\n for (const row of rowsOf(swept)) {\n const hot = addressOrNull(row.hot_wallet)\n if (!hot) continue\n const listed =\n exchangeOfWallet(hot, rows)?.entry ?? exchangeOfLabels(strings(row.hot_wallet_labels), rows)\n exchange ??= listed\n const first = numberOrNull(row.first_seen_timestamp)\n const last = numberOrNull(row.last_seen_timestamp)\n sweeps.push({\n hot_wallet: hot,\n hot_wallet_exchange: listed?.exchange ?? null,\n hot_wallet_role: textOrNull(row.hot_wallet_role),\n sweep_count: numberOrNull(row.sweep_count),\n amount_usd_sum: numberOrNull(row.amount_usd_sum),\n paths: strings(row.paths),\n first_seen: first,\n first_seen_utc: utcOrNull(first),\n last_seen: last,\n last_seen_utc: utcOrNull(last),\n })\n }\n sweeps.sort((a, b) => (b.sweep_count ?? 0) - (a.sweep_count ?? 0))\n exchange ??= exchangeOfLabels(labels, rows) ?? exchangeOfWallet(address, rows)?.entry ?? null\n const role = cexRoleOf(nodeRow?.cex_role)\n const found = nodeRow !== undefined || sweeps.length > 0\n const isDeposit = role === 'deposit' || sweeps.length > 0\n const behaviour = behaviourFromMembers(members)\n // A sourced mark always wins: the guess is read only for an address with none.\n const guess = role === null && sweeps.length === 0 ? inferredExchangeOf(nodeRow) : null\n const result: Omit<AmlExchangeDepositCheckResult, 'hint'> = {\n schema: AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA,\n tool: AML_EXCHANGE_DEPOSIT_CHECK_TOOL,\n network,\n address,\n found,\n is_deposit: isDeposit,\n cex_role: role ?? (sweeps.length > 0 ? ('deposit' as const) : null),\n exchange: exchange?.exchange ?? null,\n exchange_display: exchange?.display ?? null,\n labels,\n swept: sweeps,\n behaviour: found ? behaviour : null,\n does_not_fit_deposit: found && !isDeposit && !role ? doesNotFitDeposit(behaviour) : [],\n deposit_profile: EXCHANGE_DEPOSIT_BEHAVIOUR,\n ...(guess\n ? {\n inferred: true as const,\n inferred_role: guess.role,\n inferred_model: guess.model,\n inferred_basis: guess.basis,\n inferred_at: guess.at,\n }\n : {}),\n }\n return { result: { ...result, hint: `${hintFor(result)} ${PROFILE_HINT}` } }\n}\n\n/** Closes every hint: a host asked how a deposit address behaves answers from deposit_profile, not from its own idea of one. */\nconst PROFILE_HINT =\n 'Asked how a deposit address behaves, what makes an address one or what rules one out, answer with deposit_profile.'\n\n/** \" once\", \" 3 times\", or \"\" when the graph gave no count. */\nfunction timesText(count: number | null): string {\n if (count === null) return ''\n return count === 1 ? ' once' : ` ${count} times`\n}\n\nfunction hintFor(result: Omit<AmlExchangeDepositCheckResult, 'hint'>): string {\n const { address, network } = result\n const name = result.exchange_display ?? 'its exchange (name it from labels)'\n if (!result.found) {\n return (\n `${ANSWER_HINT} ${address} is not in the Chain Insights Graph of ${network}: no flow touches it. ` +\n 'Say so in one line, and check the network and the address with the user: name no other network yourself, and say nothing about what the check covers. ' +\n 'A claim that it is an exchange deposit address is unproven on this network: never repeat it as a fact.'\n )\n }\n if (result.is_deposit) {\n const top = result.swept[0]\n const into = top\n ? ` It swept${timesText(top.sweep_count)} into the hot wallet ${top.hot_wallet}` +\n (result.swept.length > 1\n ? `, and into ${result.swept.length - 1} more hot wallets (swept lists them)`\n : '') +\n '.'\n : ' The graph holds no SWEPT link of it yet: its sweeps are not drawn.'\n return (\n `${ANSWER_HINT} Say: \"${address} is a deposit address of ${name} on ${network}.\"${into} ` +\n 'This is where the money entered the exchange: the exchange can name the customer behind the deposit. ' +\n `${behaviourHint(result)}${EXCHANGE_OPENING_RULE}`\n )\n }\n if (result.inferred && result.inferred_role && result.inferred_model) {\n return inferredHint(result, result.inferred_role, result.inferred_model)\n }\n if (result.cex_role) {\n return (\n `${ANSWER_HINT} Say: \"${address} is a ${result.cex_role.replace('_', ' ')} of ${name} on ${network}, not a deposit address.\" ` +\n 'A trail that reaches it has entered the exchange: end the trail there.'\n )\n }\n const misfit =\n result.does_not_fit_deposit.length > 0\n ? `What a deposit address does not do, and this one did: ${result.does_not_fit_deposit.join('; ')}. `\n : 'Its counts alone rule nothing out; the missing mark does: the rule of the graph did not judge it a deposit. '\n return (\n `${ANSWER_HINT} ${address} carries no deposit mark: no SWEPT link and no cex_role. ` +\n 'Say that the graph shows no sweep of it into a listed exchange hot wallet. That is not proof the address belongs to no exchange; ' +\n `its labels and its links say what else it is. ${behaviourHint(result)}${misfit}` +\n 'Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.'\n )\n}\n\n/** Why the model holds its guess, in reader words. */\nconst INFERRED_BASIS_TEXT: Record<InferredBasis, string> = {\n listed_hot_wallet: 'The model placed it behind a listed exchange hot wallet.',\n predicted_hot_wallet: 'The model placed it behind a hot wallet the model itself inferred, which no listed source names either.',\n predicted: 'The model inferred it from how the address moves money.',\n}\n\n/** The hint of an address with no sourced mark and the exchange model's guess. */\nfunction inferredHint(\n result: Omit<AmlExchangeDepositCheckResult, 'hint'>,\n role: InferredExchangeRole,\n model: string\n): string {\n const { address, network } = result\n const what = role === 'deposit' ? 'an exchange deposit' : 'an exchange hot wallet'\n const basis = result.inferred_basis ? `${INFERRED_BASIS_TEXT[result.inferred_basis]} ` : ''\n const trail =\n role === 'deposit'\n ? 'The graph draws no SWEPT link for it, so no hot wallet is named: name none yourself. '\n : 'A trail that reaches it may have entered an exchange there: say so as inferred, and name no exchange the answer does not name. '\n return (\n `${ANSWER_HINT} Say: \"${address} is ${what}, inferred by model ${model}, on ${network}. ` +\n 'No listed source names it as an exchange address.\" ' +\n `${basis}${trail}` +\n 'Report it as inferred, never as a confirmed exchange address: is_deposit (false) and cex_role (null) are the sourced verdict, and the guess does not change them. ' +\n `${behaviourHint(result)}` +\n 'Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.'\n )\n}\n\n/** \"Its behaviour: ... . \" for a hint, or \"\" when no count was read. */\nfunction behaviourHint(result: Omit<AmlExchangeDepositCheckResult, 'hint'>): string {\n const text = result.behaviour ? behaviourText(result.behaviour) : ''\n return text === '' ? '' : `Its behaviour, as the graph counts it: ${text}. `\n}\n\nfunction errorResult(text: string): AmlExchangeDepositCheckToolResult {\n return { content: [{ type: 'text', text }], isError: true }\n}\n\nfunction textResult(structured: AmlExchangeDepositCheckResult): AmlExchangeDepositCheckToolResult {\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/** aml_exchange_deposit_check, {network, address}. Every argument is checked before a read is sent. */\nexport async function handleAmlExchangeDepositCheck(\n args: unknown,\n deps: ExchangeDepositCheckDependencies\n): Promise<AmlExchangeDepositCheckToolResult> {\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 const raw = typeof record.address === 'string' ? record.address.trim() : ''\n if (!ADDRESS_INPUT.test(raw)) {\n return errorResult(\n 'invalid_address: address is required: 0x plus 40 hex characters. ' +\n 'An exchange name is not an address: call meta_exchange_lookup for its wallets.'\n )\n }\n const address = raw.toLowerCase()\n\n const unavailable = await deps.unavailable?.()\n if (unavailable) {\n return errorResult(\n `No exchange deposit read was sent: ${unavailable} There is no answer yet, which is not \"no deposit\": try again later.`\n )\n }\n\n let rows: ExchangeEntry[] = []\n try {\n rows = (await deps.loadExchangeRegistry(network)).document.rows\n } catch {\n // The lookup only names the exchange; the graph read still answers.\n }\n\n let answer: GraphAnswer\n try {\n answer = await deps.graphQueryBatch({ network, queries: depositCheckQueries(address) })\n } catch (err) {\n return errorResult(\n `The exchange deposit read failed: ${deps.describeFailure(err)} This is not \"no deposit\": send the same check again once.`\n )\n }\n const members = membersOf(answer)\n if (members.size === 0) {\n const text = answer.isError === true ? refusalOf(answer).text : 'the batch answer held no reads'\n return errorResult(`The exchange deposit read failed: ${text} This is not \"no deposit\".`)\n }\n const check = depositCheckFromMembers(network, address, members, rows)\n if ('failure' in check) {\n return errorResult(\n `The exchange deposit read failed: ${check.failure} This is not \"no deposit\": send the same check again once.`\n )\n }\n return textResult(check.result)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,kCAAkC;AAC/C,MAAa,oCACX;AACF,MAAa,mCAAmC;;;;;;;AAOhD,MAAa,6BACX;AAWF,MAAa,yCACX,4zBAMG,GAfA,2BAA2B,kYAeF,iNAA6B;AAC3D,MAAa,yCAAyC;CACpD,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,cA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,OAAO;CAC9C,SAAS,KAAK;EACZ,OAAO,YACL,eAAe,mBAAmB,IAAI,UAAU,oBAAqB,IAAc,SACrF;CACF;CACA,MAAM,MAAM,OAAO,OAAO,YAAY,WAAW,OAAO,QAAQ,KAAK,IAAI;CACzE,IAAI,CAAC,cAAc,KAAK,GAAG,GACzB,OAAO,YACL,iJAEF;CAEF,MAAM,UAAU,IAAI,YAAY;CAEhC,MAAM,cAAc,MAAM,KAAK,cAAc;CAC7C,IAAI,aACF,OAAO,YACL,sCAAsC,YAAY,qEACpD;CAGF,IAAI,OAAwB,CAAC;CAC7B,IAAI;EACF,QAAQ,MAAM,KAAK,qBAAqB,OAAO,EAAA,CAAG,SAAS;CAC7D,QAAQ,CAER;CAEA,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,KAAK,gBAAgB;GAAE;GAAS,SAAS,oBAAoB,OAAO;EAAE,CAAC;CACxF,SAAS,KAAK;EACZ,OAAO,YACL,qCAAqC,KAAK,gBAAgB,GAAG,EAAE,2DACjE;CACF;CACA,MAAM,UAAU,UAAU,MAAM;CAChC,IAAI,QAAQ,SAAS,GAEnB,OAAO,YAAY,qCADN,OAAO,YAAY,OAAO,UAAU,MAAM,CAAC,CAAC,OAAO,iCACH,2BAA2B;CAE1F,MAAM,QAAQ,wBAAwB,SAAS,SAAS,SAAS,IAAI;CACrE,IAAI,aAAa,OACf,OAAO,YACL,qCAAqC,MAAM,QAAQ,2DACrD;CAEF,OAAO,WAAW,MAAM,MAAM;AAChC"}
1
+ {"version":3,"file":"exchange-deposit-check-BgmQnC7m.mjs","names":[],"sources":["../src/mcp/exchange-deposit-check.ts"],"sourcesContent":["/**\n * aml_exchange_deposit_check: is this address an exchange deposit, of which\n * exchange, and into which hot wallet was it swept?\n *\n * A local tool of the proxy. It sends one graph_query_batch with six reads on\n * USE topology, all anchored on the address:\n *\n * node the address: its node labels, its label words and `cex_role`;\n * swept its `SWEPT` links: each hot wallet it swept into, with the sweep\n * count, the USD sum, the paths and the first and last sweep;\n * paid_by how many addresses paid it, and how many of them are exchange\n * wallets;\n * paid how many addresses it paid, and how many of them are exchange\n * wallets;\n * swapped on how many DEX pools it swapped;\n * approved how many spenders it approved.\n *\n * The last four are the behaviour of the address, as counts: what a host needs\n * to say why an address does or does not look like a deposit, without a guess.\n * A behaviour read that fails leaves its counts null; the check still answers.\n *\n * `SWEPT` (layer `cex_sweeps`) is drawn only from an address the deposit rule\n * judged a deposit, and `cex_role` comes from the exchange label's subtype. The\n * graph judges, this tool only reads.\n *\n * The exchange model's own guess rides beside them on the node (graph sync\n * layer `inferred`): `inferred_exchange_role`, an `ml:exchange-roles:<model>:\n * <basis>` entry in `inferred_sources`, and the time it was written. It is\n * never a label and never a SWEPT link. A sourced mark always wins; an\n * address with only the guess is answered as inferred, with the model, and\n * `is_deposit` stays false. The exchange is named from the lookup\n * file (src/mcp/exchange-registry.ts): the hot wallet it swept into, else a\n * label word.\n */\n\nimport { ANSWER_HINT } from './answer-hint.js'\nimport { DexRegistryError, normalizeDexNetwork } from './dex-registry.js'\nimport {\n exchangeOfLabels,\n exchangeOfWallet,\n type ExchangeEntry,\n type LoadedExchangeRegistry,\n} from './exchange-registry.js'\nimport { EXCHANGE_OPENING_RULE } from './exchange-tool.js'\nimport { CEX_ROLES } from './graph-schema.js'\nimport { isEpochMs, utcText } from './timestamp-text.js'\nimport { membersOf, refusalOf, type GraphAnswer, type Member } from './token-lookup.js'\n\nexport const AML_EXCHANGE_DEPOSIT_CHECK_TOOL = 'aml_exchange_deposit_check' as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA =\n 'chain-insights.aml-exchange-deposit-check.v1' as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_TITLE = 'Exchange deposit check'\n/**\n * What the graph's deposit rule holds an address to, in the words every host\n * reads. The rule judges; a host that re-judges from payer counts or volume\n * invents a rule (\"a real deposit has many payers\") and gets the reason wrong.\n */\n/** How a deposit address behaves: the answer to \"what makes an address a deposit address\". Every result carries it as deposit_profile. */\nexport const EXCHANGE_DEPOSIT_BEHAVIOUR =\n \"A deposit address is one customer's: everything it sends goes to the wallets of one exchange (a sweep into a hot wallet), few outside addresses ever pay it, it never swaps on a DEX, and it is no token, pool, router or smart account.\"\n\nexport const EXCHANGE_DEPOSIT_PROFILE =\n `${EXCHANGE_DEPOSIT_BEHAVIOUR} ` +\n 'The graph judges that, never you: the verdict is is_deposit, cex_role and swept. Give behaviour and does_not_fit_deposit as the facts behind it, and never set a threshold of your own for payers, volume or sweeps. ' +\n 'With no deposit mark an address is not shown to be a deposit, whoever says it is one; with found false it has no activity on the network, and the claim is unproven there.'\n\n/** The one rule for an inferred answer, in the description every host reads and in the skill. */\nexport const EXCHANGE_INFERRED_RULE =\n \"An answer with inferred: true is the exchange model's prediction, not a listed source: report the address as inferred by the model, with its version (inferred_model), never as a confirmed exchange address.\"\n\nexport const AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION =\n 'Checks one address: is it a deposit address of a centralized exchange (Binance, Bitget, Bybit, Coinbase, Gate, KuCoin, MEXC, OKX, ...), ' +\n 'of which exchange, and into which hot wallet was it swept, how many times, by which path and when. ' +\n 'It reads the SWEPT links of the address and its cex_role (deposit, hot_wallet, cold_wallet or withdrawal) on the graph, and its behaviour as counts ' +\n '(how many addresses paid it, how many it paid, how many of each are exchange wallets, the DEX pools it swapped on, the spenders it approved), anchored on the address: ' +\n 'six reads in one batch, billed as any read. Use it when a trail reaches an address that may be an exchange wallet, when the user asks where money entered an exchange, ' +\n 'or when someone says an address is an exchange deposit: a claim is never proof, the answer of this tool is. ' +\n `${EXCHANGE_DEPOSIT_PROFILE} ${EXCHANGE_INFERRED_RULE} ${EXCHANGE_OPENING_RULE}`\nexport const AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS = {\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n} as const\nexport const AML_EXCHANGE_DEPOSIT_CHECK_ARGS = ['network', 'address'] as const\n\n/** The most hot wallets one deposit's read returns. */\nexport const SWEPT_LIMIT = 20\n\nexport type CexRole = (typeof CEX_ROLES)[number]\n\n/** The roles the exchange model infers. */\nexport const INFERRED_EXCHANGE_ROLES = ['deposit', 'hot_wallet'] as const\nexport type InferredExchangeRole = (typeof INFERRED_EXCHANGE_ROLES)[number]\n\n/**\n * Why the model inferred the role, from the suffix of its source entry:\n * `rule` a deposit behind a listed hot wallet, `rule-p` a deposit behind a hot\n * wallet the model inferred, `p-hub` a hot wallet the model inferred.\n */\nexport const INFERRED_BASIS = {\n rule: 'listed_hot_wallet',\n 'rule-p': 'predicted_hot_wallet',\n 'p-hub': 'predicted',\n} as const\nexport type InferredBasis = (typeof INFERRED_BASIS)[keyof typeof INFERRED_BASIS]\n\n/** The prefix of the exchange model's entries in `inferred_sources`. */\nexport const EXCHANGE_MODEL_SOURCE_PREFIX = 'ml:exchange-roles:'\n\nexport interface InferredExchangeMark {\n role: InferredExchangeRole\n model: string\n basis: InferredBasis\n /** ISO time the graph wrote the guess, or null when it carries none. */\n at: string | null\n}\n\nexport interface Sweep {\n hot_wallet: string\n /** The exchange the hot wallet is listed for, or null when the lookup lists it for none. */\n hot_wallet_exchange: string | null\n hot_wallet_role: string | null\n sweep_count: number | null\n amount_usd_sum: number | null\n paths: string[]\n first_seen: number | null\n first_seen_utc: string | null\n last_seen: number | null\n last_seen_utc: string | null\n}\n\n/** The most links one behaviour read counts: a count equal to it means \"this many or more\". */\nexport const BEHAVIOUR_COUNT_CAP = 5000\n\n/**\n * How the address behaves, as counts of its links. A null count is a read that\n * did not answer. The counts take every link, also a dust one: the graph's\n * deposit rule, which ignores dust, is the judge, and these are its evidence.\n */\nexport interface DepositBehaviour {\n /** Addresses that ever paid it. */\n payers: number | null\n /** Of those, exchange wallets (a hot wallet, or another deposit). */\n payers_exchange: number | null\n /** Addresses it ever paid. */\n receivers: number | null\n /** Of those, exchange wallets. */\n receivers_exchange: number | null\n /** DEX pools it swapped on. */\n dex_pools: number | null\n /** Spenders it approved. */\n approvals: number | null\n /** A count equal to this means \"this many or more\". */\n count_cap: typeof BEHAVIOUR_COUNT_CAP\n}\n\nexport interface AmlExchangeDepositCheckResult {\n schema: typeof AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA\n tool: typeof AML_EXCHANGE_DEPOSIT_CHECK_TOOL\n network: string\n address: string\n /** false when the graph holds no node for the address. */\n found: boolean\n /** true when the address carries cex_role deposit or has a SWEPT link. */\n is_deposit: boolean\n cex_role: CexRole | null\n /** The exchange id, from the hot wallet it swept into, else from its label words. */\n exchange: string | null\n exchange_display: string | null\n labels: string[]\n swept: Sweep[]\n /** The behaviour counts; null when the graph holds no node for the address. */\n behaviour: DepositBehaviour | null\n /** What the counts show that a deposit address does not do. Empty for a deposit, and when nothing shows. */\n does_not_fit_deposit: string[]\n /** How any deposit address behaves: the same text in every answer, for a host asked what makes one. */\n deposit_profile: string\n /** Set only when no sourced mark exists and the exchange model inferred a role. */\n inferred?: true\n inferred_role?: InferredExchangeRole\n /** The model version, from its `ml:exchange-roles:` source entry. */\n inferred_model?: string\n inferred_basis?: InferredBasis\n inferred_at?: string | null\n hint: string\n}\n\nexport interface ExchangeDepositCheckDependencies {\n loadExchangeRegistry: (network: string) => Promise<LoadedExchangeRegistry>\n graphQueryBatch: (args: {\n network: string\n queries: Array<{ id: string; query: string }>\n }) => Promise<GraphAnswer>\n unavailable?: () => Promise<string | undefined> | string | undefined\n describeFailure: (err: unknown) => string\n}\n\nexport type AmlExchangeDepositCheckToolResult = {\n content: Array<{ type: 'text'; text: string }>\n structuredContent?: Record<string, unknown>\n isError: boolean\n}\n\nconst ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/\nconst ADDRESS_READ = /^0x[0-9a-f]{40}$/\n\nfunction assertReadAddress(address: string): void {\n if (!ADDRESS_READ.test(address)) {\n throw new Error(\n `exchange deposit check: ${JSON.stringify(address)} is not a lowercase 0x address`\n )\n }\n}\n\n/** The node read: the address, its marks, its cex_role and the exchange model's inferred role. */\nexport function depositNodeQuery(address: string): string {\n assertReadAddress(address)\n return (\n `USE topology MATCH (a:Address {address: \"${address}\"}) ` +\n 'RETURN a.address AS address, labels(a) AS node_labels, a.labels AS labels, a.cex_role AS cex_role, ' +\n 'a.inferred_exchange_role AS inferred_exchange_role, a.inferred_sources AS inferred_sources, ' +\n 'a.inferred_exchange_role_updated_timestamp AS inferred_exchange_role_updated_timestamp LIMIT 1'\n )\n}\n\n/** The swept read: each hot wallet the address swept into. */\nexport function depositSweptQuery(address: string): string {\n assertReadAddress(address)\n return (\n `USE topology MATCH (a:Address {address: \"${address}\"})-[s:SWEPT]->(h:Address) ` +\n 'RETURN h.address AS hot_wallet, h.labels AS hot_wallet_labels, h.cex_role AS hot_wallet_role, ' +\n 's.sweep_count AS sweep_count, s.amount_usd_sum AS amount_usd_sum, s.paths AS paths, ' +\n `s.first_seen_timestamp AS first_seen_timestamp, s.last_seen_timestamp AS last_seen_timestamp LIMIT ${SWEPT_LIMIT}`\n )\n}\n\n/** The behaviour reads: one count row each, over at most BEHAVIOUR_COUNT_CAP links. */\nexport function depositBehaviourQueries(\n address: string\n): Array<{ id: 'paid_by' | 'paid' | 'swapped' | 'approved'; query: string }> {\n assertReadAddress(address)\n const anchor = `(a:Address {address: \"${address}\"})`\n const exchange = 'sum(CASE WHEN b.is_exchange THEN 1 ELSE 0 END)'\n return [\n {\n id: 'paid_by',\n query:\n `USE topology MATCH ${anchor}<-[:FLOWED_TO]-(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n `RETURN count(b) AS payers, ${exchange} AS payers_exchange LIMIT 1`,\n },\n {\n id: 'paid',\n query:\n `USE topology MATCH ${anchor}-[:FLOWED_TO]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n `RETURN count(b) AS receivers, ${exchange} AS receivers_exchange LIMIT 1`,\n },\n {\n id: 'swapped',\n query:\n `USE topology MATCH ${anchor}-[:SWAPPED]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n 'RETURN count(b) AS dex_pools LIMIT 1',\n },\n {\n id: 'approved',\n query:\n `USE topology MATCH ${anchor}-[:APPROVED]->(b:Address) WITH b LIMIT ${BEHAVIOUR_COUNT_CAP} ` +\n 'RETURN count(b) AS approvals LIMIT 1',\n },\n ]\n}\n\n/** The one batch the tool sends: members `node`, `swept` and the four behaviour reads. */\nexport function depositCheckQueries(address: string): Array<{ id: string; query: string }> {\n return [\n { id: 'node', query: depositNodeQuery(address) },\n { id: 'swept', query: depositSweptQuery(address) },\n ...depositBehaviourQueries(address),\n ]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : []\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 textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value.trim() : null\n\nconst addressOrNull = (value: unknown): string | null =>\n typeof value === 'string' && ADDRESS_INPUT.test(value.trim()) ? value.trim().toLowerCase() : null\n\nconst utcOrNull = (ms: number | null): string | null => (isEpochMs(ms) ? utcText(ms) : null)\n\nfunction cexRoleOf(value: unknown): CexRole | null {\n const role = textOrNull(value)?.toLowerCase()\n return (CEX_ROLES as readonly string[]).includes(role ?? '') ? (role as CexRole) : null\n}\n\n/**\n * The exchange model's mark of a node row, or null. It needs both the role and\n * an `ml:exchange-roles:<model>:<basis>` source entry: a role with no entry of\n * the exchange model is no inferred mark. The model version may hold hyphens,\n * underscores and colons; the basis is the last part.\n */\nexport function inferredExchangeOf(\n row: Record<string, unknown> | undefined\n): InferredExchangeMark | null {\n const role = textOrNull(row?.inferred_exchange_role)?.toLowerCase()\n if (!(INFERRED_EXCHANGE_ROLES as readonly string[]).includes(role ?? '')) return null\n const marks: Array<{ model: string; basis: InferredBasis; suffix: string }> = []\n for (const source of strings(row?.inferred_sources)) {\n const entry = source.trim()\n if (!entry.startsWith(EXCHANGE_MODEL_SOURCE_PREFIX)) continue\n const rest = entry.slice(EXCHANGE_MODEL_SOURCE_PREFIX.length)\n const cut = rest.lastIndexOf(':')\n if (cut <= 0) continue\n const model = rest.slice(0, cut)\n const suffix = rest.slice(cut + 1)\n if (!Object.prototype.hasOwnProperty.call(INFERRED_BASIS, suffix)) continue\n marks.push({ model, basis: INFERRED_BASIS[suffix as keyof typeof INFERRED_BASIS], suffix })\n }\n // The entry that fits the role first: p-hub names a hot wallet, rule and rule-p a deposit.\n const fits = (suffix: string) => (role === 'hot_wallet') === (suffix === 'p-hub')\n const mark = marks.find((m) => fits(m.suffix)) ?? marks[0]\n if (!mark) return null\n const ms = numberOrNull(row?.inferred_exchange_role_updated_timestamp)\n return {\n role: role as InferredExchangeRole,\n model: mark.model,\n basis: mark.basis,\n at: isEpochMs(ms) ? new Date(ms).toISOString() : null,\n }\n}\n\nconst answered = (member: Member | undefined): boolean =>\n member?.ok === true && Array.isArray(member.results)\n\nconst rowsOf = (member: Member | undefined): Array<Record<string, unknown>> =>\n answered(member) ? (member!.results as unknown[]).filter(isRecord) : []\n\nfunction memberFailure(id: string, member: Member | undefined): string {\n if (!member) return `the ${id} read is missing from the batch answer`\n return typeof member.error === 'string' && member.error.trim() !== ''\n ? member.error\n : `the ${id} read did not answer`\n}\n\n/** The behaviour counts of the batch members; a member that did not answer leaves its counts null. */\nexport function behaviourFromMembers(members: Map<string, Member>): DepositBehaviour {\n const count = (id: string, column: string): number | null =>\n numberOrNull(rowsOf(members.get(id))[0]?.[column])\n return {\n payers: count('paid_by', 'payers'),\n payers_exchange: count('paid_by', 'payers_exchange'),\n receivers: count('paid', 'receivers'),\n receivers_exchange: count('paid', 'receivers_exchange'),\n dex_pools: count('swapped', 'dex_pools'),\n approvals: count('approved', 'approvals'),\n count_cap: BEHAVIOUR_COUNT_CAP,\n }\n}\n\n/** \"5000 or more\" at the cap, else the number. */\nfunction countText(count: number): string {\n return count >= BEHAVIOUR_COUNT_CAP ? `${BEHAVIOUR_COUNT_CAP} or more` : String(count)\n}\n\nconst plural = (count: number, one: string, many: string): string => (count === 1 ? one : many)\n\n/**\n * What the counts show that a deposit address does not do. Only what needs no\n * threshold: a swap, and a payment to an address that is no exchange wallet.\n * How many payers are \"few\" is the graph rule's to say, never this tool's.\n */\nexport function doesNotFitDeposit(behaviour: DepositBehaviour): string[] {\n const facts: string[] = []\n if (behaviour.dex_pools !== null && behaviour.dex_pools > 0) {\n facts.push(\n `it swapped on ${countText(behaviour.dex_pools)} DEX ${plural(behaviour.dex_pools, 'pool', 'pools')}`\n )\n }\n if (behaviour.receivers !== null && behaviour.receivers_exchange !== null) {\n const outside = behaviour.receivers - behaviour.receivers_exchange\n if (outside > 0) {\n // A capped receiver count makes the difference a floor too.\n const atCap = behaviour.receivers >= BEHAVIOUR_COUNT_CAP ? ' or more' : ''\n facts.push(\n `it paid ${outside}${atCap} ${plural(outside, 'address that is', 'addresses that are')} no exchange wallet`\n )\n }\n }\n return facts\n}\n\n/** The counts as one sentence, the read counts only. */\nexport function behaviourText(behaviour: DepositBehaviour): string {\n const parts: string[] = []\n if (behaviour.payers !== null) {\n parts.push(\n `${countText(behaviour.payers)} ${plural(behaviour.payers, 'address', 'addresses')} paid it` +\n (behaviour.payers_exchange !== null\n ? ` (${countText(behaviour.payers_exchange)} of them exchange wallets)`\n : '')\n )\n }\n if (behaviour.receivers !== null) {\n parts.push(\n `it paid ${countText(behaviour.receivers)} ${plural(behaviour.receivers, 'address', 'addresses')}` +\n (behaviour.receivers_exchange !== null\n ? ` (${countText(behaviour.receivers_exchange)} of them exchange wallets)`\n : '')\n )\n }\n if (behaviour.dex_pools !== null) {\n parts.push(\n `it swapped on ${countText(behaviour.dex_pools)} DEX ${plural(behaviour.dex_pools, 'pool', 'pools')}`\n )\n }\n if (behaviour.approvals !== null) {\n parts.push(\n `it approved ${countText(behaviour.approvals)} ${plural(behaviour.approvals, 'spender', 'spenders')}`\n )\n }\n return parts.join(', ')\n}\n\n/** The check built from the batch members and the lookup rows, or why it cannot be. */\nexport function depositCheckFromMembers(\n network: string,\n address: string,\n members: Map<string, Member>,\n rows: ExchangeEntry[]\n): { result: AmlExchangeDepositCheckResult } | { failure: string } {\n const node = members.get('node')\n const swept = members.get('swept')\n if (!answered(node)) return { failure: memberFailure('node', node) }\n if (!answered(swept)) return { failure: memberFailure('swept', swept) }\n\n const nodeRow = rowsOf(node)[0]\n const labels = strings(nodeRow?.labels)\n const sweeps: Sweep[] = []\n let exchange: ExchangeEntry | null = null\n for (const row of rowsOf(swept)) {\n const hot = addressOrNull(row.hot_wallet)\n if (!hot) continue\n const listed =\n exchangeOfWallet(hot, rows)?.entry ?? exchangeOfLabels(strings(row.hot_wallet_labels), rows)\n exchange ??= listed\n const first = numberOrNull(row.first_seen_timestamp)\n const last = numberOrNull(row.last_seen_timestamp)\n sweeps.push({\n hot_wallet: hot,\n hot_wallet_exchange: listed?.exchange ?? null,\n hot_wallet_role: textOrNull(row.hot_wallet_role),\n sweep_count: numberOrNull(row.sweep_count),\n amount_usd_sum: numberOrNull(row.amount_usd_sum),\n paths: strings(row.paths),\n first_seen: first,\n first_seen_utc: utcOrNull(first),\n last_seen: last,\n last_seen_utc: utcOrNull(last),\n })\n }\n sweeps.sort((a, b) => (b.sweep_count ?? 0) - (a.sweep_count ?? 0))\n exchange ??= exchangeOfLabels(labels, rows) ?? exchangeOfWallet(address, rows)?.entry ?? null\n const role = cexRoleOf(nodeRow?.cex_role)\n const found = nodeRow !== undefined || sweeps.length > 0\n const isDeposit = role === 'deposit' || sweeps.length > 0\n const behaviour = behaviourFromMembers(members)\n // A sourced mark always wins: the guess is read only for an address with none.\n const guess = role === null && sweeps.length === 0 ? inferredExchangeOf(nodeRow) : null\n const result: Omit<AmlExchangeDepositCheckResult, 'hint'> = {\n schema: AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA,\n tool: AML_EXCHANGE_DEPOSIT_CHECK_TOOL,\n network,\n address,\n found,\n is_deposit: isDeposit,\n cex_role: role ?? (sweeps.length > 0 ? ('deposit' as const) : null),\n exchange: exchange?.exchange ?? null,\n exchange_display: exchange?.display ?? null,\n labels,\n swept: sweeps,\n behaviour: found ? behaviour : null,\n does_not_fit_deposit: found && !isDeposit && !role ? doesNotFitDeposit(behaviour) : [],\n deposit_profile: EXCHANGE_DEPOSIT_BEHAVIOUR,\n ...(guess\n ? {\n inferred: true as const,\n inferred_role: guess.role,\n inferred_model: guess.model,\n inferred_basis: guess.basis,\n inferred_at: guess.at,\n }\n : {}),\n }\n return { result: { ...result, hint: `${hintFor(result)} ${PROFILE_HINT}` } }\n}\n\n/** Closes every hint: a host asked how a deposit address behaves answers from deposit_profile, not from its own idea of one. */\nconst PROFILE_HINT =\n 'Asked how a deposit address behaves, what makes an address one or what rules one out, answer with deposit_profile.'\n\n/** \" once\", \" 3 times\", or \"\" when the graph gave no count. */\nfunction timesText(count: number | null): string {\n if (count === null) return ''\n return count === 1 ? ' once' : ` ${count} times`\n}\n\nfunction hintFor(result: Omit<AmlExchangeDepositCheckResult, 'hint'>): string {\n const { address, network } = result\n const name = result.exchange_display ?? 'its exchange (name it from labels)'\n if (!result.found) {\n return (\n `${ANSWER_HINT} ${address} is not in the Chain Insights Graph of ${network}: no flow touches it. ` +\n 'Say so in one line, and check the network and the address with the user: name no other network yourself, and say nothing about what the check covers. ' +\n 'A claim that it is an exchange deposit address is unproven on this network: never repeat it as a fact.'\n )\n }\n if (result.is_deposit) {\n const top = result.swept[0]\n const into = top\n ? ` It swept${timesText(top.sweep_count)} into the hot wallet ${top.hot_wallet}` +\n (result.swept.length > 1\n ? `, and into ${result.swept.length - 1} more hot wallets (swept lists them)`\n : '') +\n '.'\n : ' The graph holds no SWEPT link of it yet: its sweeps are not drawn.'\n return (\n `${ANSWER_HINT} Say: \"${address} is a deposit address of ${name} on ${network}.\"${into} ` +\n 'This is where the money entered the exchange: the exchange can name the customer behind the deposit. ' +\n `${behaviourHint(result)}${EXCHANGE_OPENING_RULE}`\n )\n }\n if (result.inferred && result.inferred_role && result.inferred_model) {\n return inferredHint(result, result.inferred_role, result.inferred_model)\n }\n if (result.cex_role) {\n return (\n `${ANSWER_HINT} Say: \"${address} is a ${result.cex_role.replace('_', ' ')} of ${name} on ${network}, not a deposit address.\" ` +\n 'A trail that reaches it has entered the exchange: end the trail there.'\n )\n }\n const misfit =\n result.does_not_fit_deposit.length > 0\n ? `What a deposit address does not do, and this one did: ${result.does_not_fit_deposit.join('; ')}. `\n : 'Its counts alone rule nothing out; the missing mark does: the rule of the graph did not judge it a deposit. '\n return (\n `${ANSWER_HINT} ${address} carries no deposit mark: no SWEPT link and no cex_role. ` +\n 'Say that the graph shows no sweep of it into a listed exchange hot wallet. That is not proof the address belongs to no exchange; ' +\n `its labels and its links say what else it is. ${behaviourHint(result)}${misfit}` +\n 'Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.'\n )\n}\n\n/** Why the model holds its guess, in reader words. */\nconst INFERRED_BASIS_TEXT: Record<InferredBasis, string> = {\n listed_hot_wallet: 'The model placed it behind a listed exchange hot wallet.',\n predicted_hot_wallet: 'The model placed it behind a hot wallet the model itself inferred, which no listed source names either.',\n predicted: 'The model inferred it from how the address moves money.',\n}\n\n/** The hint of an address with no sourced mark and the exchange model's guess. */\nfunction inferredHint(\n result: Omit<AmlExchangeDepositCheckResult, 'hint'>,\n role: InferredExchangeRole,\n model: string\n): string {\n const { address, network } = result\n const what = role === 'deposit' ? 'an exchange deposit' : 'an exchange hot wallet'\n const basis = result.inferred_basis ? `${INFERRED_BASIS_TEXT[result.inferred_basis]} ` : ''\n const trail =\n role === 'deposit'\n ? 'The graph draws no SWEPT link for it, so no hot wallet is named: name none yourself. '\n : 'A trail that reaches it may have entered an exchange there: say so as inferred, and name no exchange the answer does not name. '\n return (\n `${ANSWER_HINT} Say: \"${address} is ${what}, inferred by model ${model}, on ${network}. ` +\n 'No listed source names it as an exchange address.\" ' +\n `${basis}${trail}` +\n 'Report it as inferred, never as a confirmed exchange address: is_deposit (false) and cex_role (null) are the sourced verdict, and the guess does not change them. ' +\n `${behaviourHint(result)}` +\n 'Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.'\n )\n}\n\n/** \"Its behaviour: ... . \" for a hint, or \"\" when no count was read. */\nfunction behaviourHint(result: Omit<AmlExchangeDepositCheckResult, 'hint'>): string {\n const text = result.behaviour ? behaviourText(result.behaviour) : ''\n return text === '' ? '' : `Its behaviour, as the graph counts it: ${text}. `\n}\n\nfunction errorResult(text: string): AmlExchangeDepositCheckToolResult {\n return { content: [{ type: 'text', text }], isError: true }\n}\n\nfunction textResult(structured: AmlExchangeDepositCheckResult): AmlExchangeDepositCheckToolResult {\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/** aml_exchange_deposit_check, {network, address}. Every argument is checked before a read is sent. */\nexport async function handleAmlExchangeDepositCheck(\n args: unknown,\n deps: ExchangeDepositCheckDependencies\n): Promise<AmlExchangeDepositCheckToolResult> {\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 const raw = typeof record.address === 'string' ? record.address.trim() : ''\n if (!ADDRESS_INPUT.test(raw)) {\n return errorResult(\n 'invalid_address: address is required: 0x plus 40 hex characters. ' +\n 'An exchange name is not an address: call meta_exchange_lookup for its wallets.'\n )\n }\n const address = raw.toLowerCase()\n\n const unavailable = await deps.unavailable?.()\n if (unavailable) {\n return errorResult(\n `No exchange deposit read was sent: ${unavailable} There is no answer yet, which is not \"no deposit\": try again later.`\n )\n }\n\n let rows: ExchangeEntry[] = []\n try {\n rows = (await deps.loadExchangeRegistry(network)).document.rows\n } catch {\n // The lookup only names the exchange; the graph read still answers.\n }\n\n let answer: GraphAnswer\n try {\n answer = await deps.graphQueryBatch({ network, queries: depositCheckQueries(address) })\n } catch (err) {\n return errorResult(\n `The exchange deposit read failed: ${deps.describeFailure(err)} This is not \"no deposit\": send the same check again once.`\n )\n }\n const members = membersOf(answer)\n if (members.size === 0) {\n const text = answer.isError === true ? refusalOf(answer).text : 'the batch answer held no reads'\n return errorResult(`The exchange deposit read failed: ${text} This is not \"no deposit\".`)\n }\n const check = depositCheckFromMembers(network, address, members, rows)\n if ('failure' in check) {\n return errorResult(\n `The exchange deposit read failed: ${check.failure} This is not \"no deposit\": send the same check again once.`\n )\n }\n return textResult(check.result)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,kCAAkC;AAC/C,MAAa,oCACX;AACF,MAAa,mCAAmC;;;;;;;AAOhD,MAAa,6BACX;AAWF,MAAa,yCACX,4zBAMG,GAfA,2BAA2B,kYAeF,iNAA6B;AAC3D,MAAa,yCAAyC;CACpD,cAAc;CACd,gBAAgB;CAChB,eAAe;AACjB;;AAIA,MAAa,cAAc;;AAK3B,MAAa,0BAA0B,CAAC,WAAW,YAAY;;;;;;AAQ/D,MAAa,iBAAiB;CAC5B,MAAM;CACN,UAAU;CACV,SAAS;AACX;;AAIA,MAAa,+BAA+B;;AAyB5C,MAAa,sBAAsB;AAuEnC,MAAM,gBAAgB;AACtB,MAAM,eAAe;AAErB,SAAS,kBAAkB,SAAuB;CAChD,IAAI,CAAC,aAAa,KAAK,OAAO,GAC5B,MAAM,IAAI,MACR,2BAA2B,KAAK,UAAU,OAAO,EAAE,+BACrD;AAEJ;;AAGA,SAAgB,iBAAiB,SAAyB;CACxD,kBAAkB,OAAO;CACzB,OACE,4CAA4C,QAAQ;AAKxD;;AAGA,SAAgB,kBAAkB,SAAyB;CACzD,kBAAkB,OAAO;CACzB,OACE,4CAA4C,QAAQ,kTAGkD;AAE1G;;AAGA,S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,SAAS,oBAAoB,OAAO;EAAE,CAAC;CACxF,SAAS,KAAK;EACZ,OAAO,YACL,qCAAqC,KAAK,gBAAgB,GAAG,EAAE,2DACjE;CACF;CACA,MAAM,UAAU,UAAU,MAAM;CAChC,IAAI,QAAQ,SAAS,GAEnB,OAAO,YAAY,qCADN,OAAO,YAAY,OAAO,UAAU,MAAM,CAAC,CAAC,OAAO,iCACH,2BAA2B;CAE1F,MAAM,QAAQ,wBAAwB,SAAS,SAAS,SAAS,IAAI;CACrE,IAAI,aAAa,OACf,OAAO,YACL,qCAAqC,MAAM,QAAQ,2DACrD;CAEF,OAAO,WAAW,MAAM,MAAM;AAChC"}
@@ -5,7 +5,7 @@ const require_exchange_registry = require("./exchange-registry-CT0rRW__.cjs");
5
5
  const require_exchange_tool = require("./exchange-tool-B2SMeC5f.cjs");
6
6
  const require_graph_schema = require("./graph-schema-CcrYPpSv.cjs");
7
7
  const require_print_result = require("./print-result-BYppJlUi.cjs");
8
- const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
8
+ const require_token_lookup = require("./token-lookup-Ckg-Rliv.cjs");
9
9
  // src/mcp/exchange-deposit-check.ts
10
10
  /**
11
11
  * aml_exchange_deposit_check: is this address an exchange deposit, of which
@@ -13,10 +13,10 @@ const require_action_log = require("./action-log-WMW6xFMx.cjs");
13
13
  const require_answer_hint = require("./answer-hint-BlYEBq_Y.cjs");
14
14
  const require_dex_tool = require("./dex-tool-Be9NAuD8.cjs");
15
15
  const require_dex_registry = require("./dex-registry-BhGJUG9_.cjs");
16
- const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
17
- const require_deployer_screen = require("./deployer-screen-DQw3pC0E.cjs");
16
+ const require_token_lookup = require("./token-lookup-Ckg-Rliv.cjs");
17
+ const require_deployer_screen = require("./deployer-screen-9VSQsq1A.cjs");
18
18
  const require_exchange_tool = require("./exchange-tool-B2SMeC5f.cjs");
19
- const require_exchange_deposit_check = require("./exchange-deposit-check-ClPd7HQl.cjs");
19
+ const require_exchange_deposit_check = require("./exchange-deposit-check-DfqrUzIm.cjs");
20
20
  const require_exchange_registry = require("./exchange-registry-CT0rRW__.cjs");
21
21
  let node_url = require("node:url");
22
22
  let node_path = require("node:path");
@@ -11,10 +11,10 @@ import { r as appendActionLog, t as actionLogSignalsFromResult } from "./action-
11
11
  import { n as withAnswerHintResult } from "./answer-hint-vOE1O6Lf.mjs";
12
12
  import { i as META_DEX_LOOKUP_TOOL, n as META_DEX_LOOKUP_DESCRIPTION, o as handleMetaDexLookup, r as META_DEX_LOOKUP_TITLE, t as META_DEX_LOOKUP_ANNOTATIONS } from "./dex-tool-7BK_gD6H.mjs";
13
13
  import { c as loadRegistry } from "./dex-registry-BY67f4Ul.mjs";
14
- import { a as SYMBOL_MAX, i as META_TOKEN_LOOKUP_TOOL, n as META_TOKEN_LOOKUP_DESCRIPTION, o as handleMetaTokenLookup, r as META_TOKEN_LOOKUP_TITLE, t as META_TOKEN_LOOKUP_ANNOTATIONS } from "./token-lookup-QpIv77P2.mjs";
15
- import { i as AML_DEPLOYER_SCREEN_TOOL, n as AML_DEPLOYER_SCREEN_DESCRIPTION, o as handleAmlDeployerScreen, r as AML_DEPLOYER_SCREEN_TITLE, t as AML_DEPLOYER_SCREEN_ANNOTATIONS } from "./deployer-screen-e3IbG1Y_.mjs";
14
+ import { a as SYMBOL_MAX, i as META_TOKEN_LOOKUP_TOOL, n as META_TOKEN_LOOKUP_DESCRIPTION, o as handleMetaTokenLookup, r as META_TOKEN_LOOKUP_TITLE, t as META_TOKEN_LOOKUP_ANNOTATIONS } from "./token-lookup-Dtid9MwW.mjs";
15
+ import { i as AML_DEPLOYER_SCREEN_TOOL, n as AML_DEPLOYER_SCREEN_DESCRIPTION, o as handleAmlDeployerScreen, r as AML_DEPLOYER_SCREEN_TITLE, t as AML_DEPLOYER_SCREEN_ANNOTATIONS } from "./deployer-screen-Bd1sBcnt.mjs";
16
16
  import { a as META_EXCHANGE_LOOKUP_TOOL, i as META_EXCHANGE_LOOKUP_TITLE, n as META_EXCHANGE_LOOKUP_ANNOTATIONS, r as META_EXCHANGE_LOOKUP_DESCRIPTION, s as handleMetaExchangeLookup } from "./exchange-tool-Dc46SJ49.mjs";
17
- import { i as AML_EXCHANGE_DEPOSIT_CHECK_TOOL, n as AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION, o as handleAmlExchangeDepositCheck, r as AML_EXCHANGE_DEPOSIT_CHECK_TITLE, t as AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS } from "./exchange-deposit-check-9bGrKwcX.mjs";
17
+ import { i as AML_EXCHANGE_DEPOSIT_CHECK_TOOL, n as AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION, o as handleAmlExchangeDepositCheck, r as AML_EXCHANGE_DEPOSIT_CHECK_TITLE, t as AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS } from "./exchange-deposit-check-BgmQnC7m.mjs";
18
18
  import { i as loadExchangeRegistry } from "./exchange-registry-CoLgHw6d.mjs";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import path from "node:path";