chain-insights 0.83.0 → 0.84.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/apps/claude-view.html +47 -47
- package/dist/{capabilities-DgNUpRa-.cjs → capabilities-Mxa4oQdd.cjs} +1 -1
- package/dist/{capabilities-BniH7lxt.mjs → capabilities-bZOr5Ads.mjs} +2 -2
- package/dist/{capabilities-BniH7lxt.mjs.map → capabilities-bZOr5Ads.mjs.map} +1 -1
- package/dist/cli.cjs +9 -9
- package/dist/cli.mjs +9 -9
- package/dist/{dex-tool-25510SNo.mjs → dex-tool-7BK_gD6H.mjs} +2 -2
- package/dist/{dex-tool-25510SNo.mjs.map → dex-tool-7BK_gD6H.mjs.map} +1 -1
- package/dist/{dex-tool-BDERiT5t.cjs → dex-tool-Be9NAuD8.cjs} +1 -1
- package/dist/{exchange-deposit-check-B1yebGBt.mjs → exchange-deposit-check-9bGrKwcX.mjs} +86 -7
- package/dist/exchange-deposit-check-9bGrKwcX.mjs.map +1 -0
- package/dist/{exchange-deposit-check-B9_fPt3E.cjs → exchange-deposit-check-ClPd7HQl.cjs} +85 -6
- package/dist/{graph-schema-BZTzy0XV.mjs → graph-schema-CRQuKya1.mjs} +4 -4
- package/dist/{graph-schema-BZTzy0XV.mjs.map → graph-schema-CRQuKya1.mjs.map} +1 -1
- package/dist/{graph-schema-u0TipQPl.cjs → graph-schema-CcrYPpSv.cjs} +3 -3
- package/dist/{layer-routing-CM99KYhc.mjs → layer-routing-DCJVNN6O.mjs} +2 -2
- package/dist/layer-routing-DCJVNN6O.mjs.map +1 -0
- package/dist/{layer-routing-D9KbTKUj.cjs → layer-routing-YDj-ynG9.cjs} +1 -1
- package/dist/mcp-proxy.cjs +5 -5
- package/dist/mcp-proxy.mjs +5 -5
- package/dist/{public-tools-DFvirePH.cjs → public-tools-CBszU2oX.cjs} +1 -1
- package/dist/{public-tools-COhurrDw.mjs → public-tools-DVhUjSDV.mjs} +2 -2
- package/dist/{public-tools-COhurrDw.mjs.map → public-tools-DVhUjSDV.mjs.map} +1 -1
- package/docs/evals.md +22 -6
- package/docs/graph-query-compatibility.md +8 -0
- package/docs/graph-tools.md +1 -1
- package/docs/mcp-proxy.md +13 -3
- package/package.json +1 -1
- package/skills/chain-insights-aml-exchange/SKILL.md +15 -1
- package/skills/chain-insights-cypher/SKILL.md +1 -1
- package/dist/exchange-deposit-check-B1yebGBt.mjs.map +0 -1
- package/dist/layer-routing-CM99KYhc.mjs.map +0 -1
|
@@ -3,7 +3,7 @@ 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_exchange_registry = require("./exchange-registry-CT0rRW__.cjs");
|
|
5
5
|
const require_exchange_tool = require("./exchange-tool-B2SMeC5f.cjs");
|
|
6
|
-
const require_graph_schema = require("./graph-schema-
|
|
6
|
+
const require_graph_schema = require("./graph-schema-CcrYPpSv.cjs");
|
|
7
7
|
const require_print_result = require("./print-result-BYppJlUi.cjs");
|
|
8
8
|
const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
|
|
9
9
|
// src/mcp/exchange-deposit-check.ts
|
|
@@ -30,7 +30,14 @@ const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
|
|
|
30
30
|
*
|
|
31
31
|
* `SWEPT` (layer `cex_sweeps`) is drawn only from an address the deposit rule
|
|
32
32
|
* judged a deposit, and `cex_role` comes from the exchange label's subtype. The
|
|
33
|
-
* graph judges, this tool only reads.
|
|
33
|
+
* graph judges, this tool only reads.
|
|
34
|
+
*
|
|
35
|
+
* The exchange model's own guess rides beside them on the node (graph sync
|
|
36
|
+
* layer `inferred`): `inferred_exchange_role`, an `ml:exchange-roles:<model>:
|
|
37
|
+
* <basis>` entry in `inferred_sources`, and the time it was written. It is
|
|
38
|
+
* never a label and never a SWEPT link. A sourced mark always wins; an
|
|
39
|
+
* address with only the guess is answered as inferred, with the model, and
|
|
40
|
+
* `is_deposit` stays false. The exchange is named from the lookup
|
|
34
41
|
* file (src/mcp/exchange-registry.ts): the hot wallet it swept into, else a
|
|
35
42
|
* label word.
|
|
36
43
|
*/
|
|
@@ -45,7 +52,7 @@ const AML_EXCHANGE_DEPOSIT_CHECK_TITLE = "Exchange deposit check";
|
|
|
45
52
|
*/
|
|
46
53
|
/** How a deposit address behaves: the answer to "what makes an address a deposit address". Every result carries it as deposit_profile. */
|
|
47
54
|
const EXCHANGE_DEPOSIT_BEHAVIOUR = "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.";
|
|
48
|
-
const AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION = `Checks one address: is it a deposit address of a centralized exchange (Binance, Bitget, Bybit, Coinbase, Gate, KuCoin, MEXC, OKX, ...), of which exchange, and into which hot wallet was it swept, how many times, by which path and when. 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 (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: 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, or when someone says an address is an exchange deposit: a claim is never proof, the answer of this tool is. ${`${EXCHANGE_DEPOSIT_BEHAVIOUR} 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. 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.`} ${require_exchange_tool.EXCHANGE_OPENING_RULE}`;
|
|
55
|
+
const AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION = `Checks one address: is it a deposit address of a centralized exchange (Binance, Bitget, Bybit, Coinbase, Gate, KuCoin, MEXC, OKX, ...), of which exchange, and into which hot wallet was it swept, how many times, by which path and when. 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 (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: 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, or when someone says an address is an exchange deposit: a claim is never proof, the answer of this tool is. ${`${EXCHANGE_DEPOSIT_BEHAVIOUR} 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. 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.`} 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. ${require_exchange_tool.EXCHANGE_OPENING_RULE}`;
|
|
49
56
|
const AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS = {
|
|
50
57
|
readOnlyHint: true,
|
|
51
58
|
idempotentHint: true,
|
|
@@ -53,6 +60,20 @@ const AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS = {
|
|
|
53
60
|
};
|
|
54
61
|
/** The most hot wallets one deposit's read returns. */
|
|
55
62
|
const SWEPT_LIMIT = 20;
|
|
63
|
+
/** The roles the exchange model infers. */
|
|
64
|
+
const INFERRED_EXCHANGE_ROLES = ["deposit", "hot_wallet"];
|
|
65
|
+
/**
|
|
66
|
+
* Why the model inferred the role, from the suffix of its source entry:
|
|
67
|
+
* `rule` a deposit behind a listed hot wallet, `rule-p` a deposit behind a hot
|
|
68
|
+
* wallet the model inferred, `p-hub` a hot wallet the model inferred.
|
|
69
|
+
*/
|
|
70
|
+
const INFERRED_BASIS = {
|
|
71
|
+
rule: "listed_hot_wallet",
|
|
72
|
+
"rule-p": "predicted_hot_wallet",
|
|
73
|
+
"p-hub": "predicted"
|
|
74
|
+
};
|
|
75
|
+
/** The prefix of the exchange model's entries in `inferred_sources`. */
|
|
76
|
+
const EXCHANGE_MODEL_SOURCE_PREFIX = "ml:exchange-roles:";
|
|
56
77
|
/** The most links one behaviour read counts: a count equal to it means "this many or more". */
|
|
57
78
|
const BEHAVIOUR_COUNT_CAP = 5e3;
|
|
58
79
|
const ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/;
|
|
@@ -60,10 +81,10 @@ const ADDRESS_READ = /^0x[0-9a-f]{40}$/;
|
|
|
60
81
|
function assertReadAddress(address) {
|
|
61
82
|
if (!ADDRESS_READ.test(address)) throw new Error(`exchange deposit check: ${JSON.stringify(address)} is not a lowercase 0x address`);
|
|
62
83
|
}
|
|
63
|
-
/** The node read: the address, its marks and
|
|
84
|
+
/** The node read: the address, its marks, its cex_role and the exchange model's inferred role. */
|
|
64
85
|
function depositNodeQuery(address) {
|
|
65
86
|
assertReadAddress(address);
|
|
66
|
-
return `USE topology MATCH (a:Address {address: "${address}"}) RETURN a.address AS address, labels(a) AS node_labels, a.labels AS labels, a.cex_role AS cex_role LIMIT 1`;
|
|
87
|
+
return `USE topology MATCH (a:Address {address: "${address}"}) RETURN a.address AS address, labels(a) AS node_labels, a.labels AS labels, a.cex_role AS cex_role, a.inferred_exchange_role AS inferred_exchange_role, a.inferred_sources AS inferred_sources, a.inferred_exchange_role_updated_timestamp AS inferred_exchange_role_updated_timestamp LIMIT 1`;
|
|
67
88
|
}
|
|
68
89
|
/** The swept read: each hot wallet the address swept into. */
|
|
69
90
|
function depositSweptQuery(address) {
|
|
@@ -124,6 +145,42 @@ function cexRoleOf(value) {
|
|
|
124
145
|
const role = textOrNull(value)?.toLowerCase();
|
|
125
146
|
return require_graph_schema.CEX_ROLES.includes(role ?? "") ? role : null;
|
|
126
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* The exchange model's mark of a node row, or null. It needs both the role and
|
|
150
|
+
* an `ml:exchange-roles:<model>:<basis>` source entry: a role with no entry of
|
|
151
|
+
* the exchange model is no inferred mark. The model version may hold hyphens,
|
|
152
|
+
* underscores and colons; the basis is the last part.
|
|
153
|
+
*/
|
|
154
|
+
function inferredExchangeOf(row) {
|
|
155
|
+
const role = textOrNull(row?.inferred_exchange_role)?.toLowerCase();
|
|
156
|
+
if (!INFERRED_EXCHANGE_ROLES.includes(role ?? "")) return null;
|
|
157
|
+
const marks = [];
|
|
158
|
+
for (const source of strings(row?.inferred_sources)) {
|
|
159
|
+
const entry = source.trim();
|
|
160
|
+
if (!entry.startsWith(EXCHANGE_MODEL_SOURCE_PREFIX)) continue;
|
|
161
|
+
const rest = entry.slice(18);
|
|
162
|
+
const cut = rest.lastIndexOf(":");
|
|
163
|
+
if (cut <= 0) continue;
|
|
164
|
+
const model = rest.slice(0, cut);
|
|
165
|
+
const suffix = rest.slice(cut + 1);
|
|
166
|
+
if (!Object.prototype.hasOwnProperty.call(INFERRED_BASIS, suffix)) continue;
|
|
167
|
+
marks.push({
|
|
168
|
+
model,
|
|
169
|
+
basis: INFERRED_BASIS[suffix],
|
|
170
|
+
suffix
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const fits = (suffix) => role === "hot_wallet" === (suffix === "p-hub");
|
|
174
|
+
const mark = marks.find((m) => fits(m.suffix)) ?? marks[0];
|
|
175
|
+
if (!mark) return null;
|
|
176
|
+
const ms = numberOrNull(row?.inferred_exchange_role_updated_timestamp);
|
|
177
|
+
return {
|
|
178
|
+
role,
|
|
179
|
+
model: mark.model,
|
|
180
|
+
basis: mark.basis,
|
|
181
|
+
at: require_print_result.isEpochMs(ms) ? new Date(ms).toISOString() : null
|
|
182
|
+
};
|
|
183
|
+
}
|
|
127
184
|
const answered = (member) => member?.ok === true && Array.isArray(member.results);
|
|
128
185
|
const rowsOf = (member) => answered(member) ? member.results.filter(isRecord) : [];
|
|
129
186
|
function memberFailure(id, member) {
|
|
@@ -210,6 +267,7 @@ function depositCheckFromMembers(network, address, members, rows) {
|
|
|
210
267
|
const found = nodeRow !== void 0 || sweeps.length > 0;
|
|
211
268
|
const isDeposit = role === "deposit" || sweeps.length > 0;
|
|
212
269
|
const behaviour = behaviourFromMembers(members);
|
|
270
|
+
const guess = role === null && sweeps.length === 0 ? inferredExchangeOf(nodeRow) : null;
|
|
213
271
|
const result = {
|
|
214
272
|
schema: AML_EXCHANGE_DEPOSIT_CHECK_SCHEMA,
|
|
215
273
|
tool: AML_EXCHANGE_DEPOSIT_CHECK_TOOL,
|
|
@@ -224,7 +282,14 @@ function depositCheckFromMembers(network, address, members, rows) {
|
|
|
224
282
|
swept: sweeps,
|
|
225
283
|
behaviour: found ? behaviour : null,
|
|
226
284
|
does_not_fit_deposit: found && !isDeposit && !role ? doesNotFitDeposit(behaviour) : [],
|
|
227
|
-
deposit_profile: EXCHANGE_DEPOSIT_BEHAVIOUR
|
|
285
|
+
deposit_profile: EXCHANGE_DEPOSIT_BEHAVIOUR,
|
|
286
|
+
...guess ? {
|
|
287
|
+
inferred: true,
|
|
288
|
+
inferred_role: guess.role,
|
|
289
|
+
inferred_model: guess.model,
|
|
290
|
+
inferred_basis: guess.basis,
|
|
291
|
+
inferred_at: guess.at
|
|
292
|
+
} : {}
|
|
228
293
|
};
|
|
229
294
|
return { result: {
|
|
230
295
|
...result,
|
|
@@ -247,10 +312,24 @@ function hintFor(result) {
|
|
|
247
312
|
const into = top ? ` It swept${timesText(top.sweep_count)} into the hot wallet ${top.hot_wallet}` + (result.swept.length > 1 ? `, and into ${result.swept.length - 1} more hot wallets (swept lists them)` : "") + "." : " The graph holds no SWEPT link of it yet: its sweeps are not drawn.";
|
|
248
313
|
return `${require_answer_hint.ANSWER_HINT} Say: "${address} is a deposit address of ${name} on ${network}."${into} This is where the money entered the exchange: the exchange can name the customer behind the deposit. ${behaviourHint(result)}${require_exchange_tool.EXCHANGE_OPENING_RULE}`;
|
|
249
314
|
}
|
|
315
|
+
if (result.inferred && result.inferred_role && result.inferred_model) return inferredHint(result, result.inferred_role, result.inferred_model);
|
|
250
316
|
if (result.cex_role) return `${require_answer_hint.ANSWER_HINT} Say: "${address} is a ${result.cex_role.replace("_", " ")} of ${name} on ${network}, not a deposit address." A trail that reaches it has entered the exchange: end the trail there.`;
|
|
251
317
|
const misfit = result.does_not_fit_deposit.length > 0 ? `What a deposit address does not do, and this one did: ${result.does_not_fit_deposit.join("; ")}. ` : "Its counts alone rule nothing out; the missing mark does: the rule of the graph did not judge it a deposit. ";
|
|
252
318
|
return `${require_answer_hint.ANSWER_HINT} ${address} carries no deposit mark: no SWEPT link and no cex_role. 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; its labels and its links say what else it is. ${behaviourHint(result)}${misfit}Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.`;
|
|
253
319
|
}
|
|
320
|
+
/** Why the model holds its guess, in reader words. */
|
|
321
|
+
const INFERRED_BASIS_TEXT = {
|
|
322
|
+
listed_hot_wallet: "The model placed it behind a listed exchange hot wallet.",
|
|
323
|
+
predicted_hot_wallet: "The model placed it behind a hot wallet the model itself inferred, which no listed source names either.",
|
|
324
|
+
predicted: "The model inferred it from how the address moves money."
|
|
325
|
+
};
|
|
326
|
+
/** The hint of an address with no sourced mark and the exchange model's guess. */
|
|
327
|
+
function inferredHint(result, role, model) {
|
|
328
|
+
const { address, network } = result;
|
|
329
|
+
const what = role === "deposit" ? "an exchange deposit" : "an exchange hot wallet";
|
|
330
|
+
const basis = result.inferred_basis ? `${INFERRED_BASIS_TEXT[result.inferred_basis]} ` : "";
|
|
331
|
+
return `${require_answer_hint.ANSWER_HINT} Say: "${address} is ${what}, inferred by model ${model}, on ${network}. No listed source names it as an exchange address." ${basis}${role === "deposit" ? "The graph draws no SWEPT link for it, so no hot wallet is named: name none yourself. " : "A trail that reaches it may have entered an exchange there: say so as inferred, and name no exchange the answer does not name. "}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. ${behaviourHint(result)}Give these facts as the reason and no other: set no threshold of your own for payers, volume or sweeps.`;
|
|
332
|
+
}
|
|
254
333
|
/** "Its behaviour: ... . " for a hint, or "" when no count was read. */
|
|
255
334
|
function behaviourHint(result) {
|
|
256
335
|
const text = result.behaviour ? behaviourText(result.behaviour) : "";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.mjs";
|
|
2
|
-
import { i as mirrorGraphNetworkCapabilities, n as findNetworkCapability } from "./capabilities-
|
|
2
|
+
import { i as mirrorGraphNetworkCapabilities, n as findNetworkCapability } from "./capabilities-bZOr5Ads.mjs";
|
|
3
3
|
import { t as PaymentRequiredError } from "./client-BaHAIidE.mjs";
|
|
4
4
|
import { n as chainInsightsHome, t as CACHE_TTL_MS } from "./cache-location-DxTTqBwk.mjs";
|
|
5
|
-
import { o as swapLinkShape, r as levelLines } from "./layer-routing-
|
|
5
|
+
import { o as swapLinkShape, r as levelLines } from "./layer-routing-DCJVNN6O.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
@@ -976,7 +976,7 @@ const CEX_ROLES = [
|
|
|
976
976
|
"withdrawal"
|
|
977
977
|
];
|
|
978
978
|
/** The note a schema carries when the graph serves `SWEPT` or `cex_role`. */
|
|
979
|
-
const EXCHANGE_SCHEMA_NOTE = `cex_role on an :Exchange address says which wallet of its exchange it is: ${CEX_ROLES.join(", ")}. SWEPT runs from an exchange deposit to the hot wallet it swept into; a trail that reaches it ends there.`;
|
|
979
|
+
const EXCHANGE_SCHEMA_NOTE = `cex_role on an :Exchange address says which wallet of its exchange it is: ${CEX_ROLES.join(", ")}. SWEPT runs from an exchange deposit to the hot wallet it swept into; a trail that reaches it ends there. inferred_exchange_role (deposit or hot_wallet) is the exchange model's guess, with its ml:exchange-roles:<model>:<basis> entry in inferred_sources: never a label, never a SWEPT link, and always said as inferred by that model.`;
|
|
980
980
|
const FACTS_TRANSFER_COLUMNS = [
|
|
981
981
|
"tx_id",
|
|
982
982
|
"block_date",
|
|
@@ -1335,4 +1335,4 @@ async function handleMetaSchema(args, deps) {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
export { graph_schema_exports as a, GRAPH_EXPAND_DESCRIPTION as c, TRANSFERS_MAX as d, handleGraphExpand as f, META_SCHEMA_TITLE as i, GRAPH_EXPAND_TITLE as l, GRAPH_QUERY_CONTRACT_READ_SENTENCE as m, GraphSchemaError as n, handleMetaSchema as o, CONTRACT_READ_HINT as p, META_SCHEMA_DESCRIPTION as r, FLOWS_MAX_OFFSET as s, CEX_ROLES as t, GRAPH_EXPAND_TOOL as u };
|
|
1337
1337
|
|
|
1338
|
-
//# sourceMappingURL=graph-schema-
|
|
1338
|
+
//# sourceMappingURL=graph-schema-CRQuKya1.mjs.map
|