chain-insights 0.78.0 → 0.79.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.cjs +36 -12
- package/dist/cli.mjs +36 -12
- package/dist/cli.mjs.map +1 -1
- package/dist/deployer-screen-4AxZhsrO.cjs +446 -0
- package/dist/deployer-screen-eix6pvW7.mjs +413 -0
- package/dist/deployer-screen-eix6pvW7.mjs.map +1 -0
- package/dist/mcp-proxy.cjs +16 -2
- package/dist/mcp-proxy.d.cts.map +1 -1
- package/dist/mcp-proxy.d.mts.map +1 -1
- package/dist/mcp-proxy.mjs +16 -2
- package/dist/mcp-proxy.mjs.map +1 -1
- package/dist/{token-lookup-sH2DesLS.mjs → token-lookup-Bv_Fviis.mjs} +4 -3
- package/dist/token-lookup-Bv_Fviis.mjs.map +1 -0
- package/dist/{token-lookup-DvgEyqcC.cjs → token-lookup-DBN3Lxl7.cjs} +14 -1
- package/dist/{tool-visibility-Dy3psowS.mjs → tool-visibility-DlxA8R00.mjs} +3 -2
- package/dist/tool-visibility-DlxA8R00.mjs.map +1 -0
- package/dist/{tool-visibility-DIpgPULN.cjs → tool-visibility-DwNr6Rp9.cjs} +2 -1
- package/docs/contributing.md +4 -2
- package/docs/development.md +3 -2
- package/docs/graph-tools.md +7 -2
- package/docs/mcp-proxy.md +49 -3
- package/docs/stability.md +3 -2
- package/package.json +2 -2
- package/registry/README.md +5 -5
- package/registry/robinhood.json +7 -4
- package/registry/robinhood.md +9 -5
- package/skills/chain-insights-dex/SKILL.md +2 -2
- package/skills/chain-insights-dex-launchpad/SKILL.md +7 -10
- package/skills/chain-insights-virtuals/SKILL.md +1 -1
- package/dist/token-lookup-sH2DesLS.mjs.map +0 -1
- package/dist/tool-visibility-Dy3psowS.mjs.map +0 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-BW-eSwOZ.cjs");
|
|
2
|
+
const require_answer_hint = require("./answer-hint-BlYEBq_Y.cjs");
|
|
3
|
+
const require_dex_registry = require("./dex-registry-DdXOg5On.cjs");
|
|
4
|
+
const require_print_result = require("./print-result-BYppJlUi.cjs");
|
|
5
|
+
const require_token_lookup = require("./token-lookup-DBN3Lxl7.cjs");
|
|
6
|
+
// src/mcp/deployer-screen.ts
|
|
7
|
+
/**
|
|
8
|
+
* aml_deployer_screen: who is behind a token or a wallet, as facts.
|
|
9
|
+
*
|
|
10
|
+
* A local tool of the proxy. It sends one graph_query_batch with two reads on
|
|
11
|
+
* USE topology, both anchored on the address:
|
|
12
|
+
*
|
|
13
|
+
* token the address as a contract: its first creation (DEPLOYED_CONTRACT),
|
|
14
|
+
* the launcher (the transaction's sender), the launcher's first funder
|
|
15
|
+
* of all time and its first inbound bridge deposit;
|
|
16
|
+
* wallet the address as the launcher itself: the same funder and bridge reads.
|
|
17
|
+
*
|
|
18
|
+
* The token read answers first when it holds a row; the wallet read answers
|
|
19
|
+
* otherwise. The tool returns facts and never a score, a level or a verdict:
|
|
20
|
+
* the description below is the contract with every host, Claude Desktop chat
|
|
21
|
+
* included, which reads no skill.
|
|
22
|
+
*/
|
|
23
|
+
var deployer_screen_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
24
|
+
AML_DEPLOYER_SCREEN_DESCRIPTION: () => AML_DEPLOYER_SCREEN_DESCRIPTION,
|
|
25
|
+
AML_DEPLOYER_SCREEN_TITLE: () => AML_DEPLOYER_SCREEN_TITLE,
|
|
26
|
+
AML_DEPLOYER_SCREEN_TOOL: () => AML_DEPLOYER_SCREEN_TOOL,
|
|
27
|
+
handleAmlDeployerScreen: () => handleAmlDeployerScreen
|
|
28
|
+
});
|
|
29
|
+
const AML_DEPLOYER_SCREEN_TOOL = "aml_deployer_screen";
|
|
30
|
+
const AML_DEPLOYER_SCREEN_SCHEMA = "chain-insights.aml-deployer-screen.v1";
|
|
31
|
+
const AML_DEPLOYER_SCREEN_TITLE = "Deployer screen";
|
|
32
|
+
const AML_DEPLOYER_SCREEN_DESCRIPTION = "Facts only, no score and no verdict: screens who is behind a token or a wallet. For a token contract it returns the creation transaction and the launcher (the wallet that sent it); for a wallet, that wallet as the launcher. Then the launcher's first funder of all time and what kind of wallet that funder is (wallet, contract, bridge, bundler, launchpad, exchange, mixer, scam), how many addresses the funder ever paid, the sanctions, scam, victim and risk labels on each, and the first inbound bridge deposit. The caller decides. A fresh launcher funded by a wallet that paid few addresses is the pattern to look at; a funder that paid thousands is shared infrastructure. A launcher that is a bundler hides the real sender: launcher_resolved is then false. not_covered lists what the graph cannot see yet.";
|
|
33
|
+
const AML_DEPLOYER_SCREEN_ANNOTATIONS = {
|
|
34
|
+
readOnlyHint: true,
|
|
35
|
+
idempotentHint: true,
|
|
36
|
+
openWorldHint: false
|
|
37
|
+
};
|
|
38
|
+
/** What the two reads cannot see yet, named in every answer. */
|
|
39
|
+
const NOT_COVERED = [
|
|
40
|
+
"exploit_labels",
|
|
41
|
+
"ml_labels",
|
|
42
|
+
"bridge_sender",
|
|
43
|
+
"ethereum_history"
|
|
44
|
+
];
|
|
45
|
+
const ADDRESS_INPUT = /^0x[0-9a-fA-F]{40}$/;
|
|
46
|
+
const ADDRESS_READ = /^0x[0-9a-f]{40}$/;
|
|
47
|
+
const FUNDER_READ = "OPTIONAL MATCH (f:Address)-[e:FLOWED_TO]->(l)";
|
|
48
|
+
const BRIDGE_READ = "OPTIONAL MATCH (ch:Chain)-[b:BRIDGED]->(l) WHERE b.kind IN ['TOKEN_DEPOSIT','NATIVE_DEPOSIT']";
|
|
49
|
+
const PARTY_COLUMNS = [
|
|
50
|
+
"labels(l) AS launcher_roles",
|
|
51
|
+
"l.first_activity_timestamp AS launcher_first_activity",
|
|
52
|
+
"l.degree_in AS launcher_degree_in",
|
|
53
|
+
"l.degree_out AS launcher_degree_out",
|
|
54
|
+
"l.is_sanctioned AS launcher_is_sanctioned",
|
|
55
|
+
"l.is_scam AS launcher_is_scam",
|
|
56
|
+
"l.is_victim AS launcher_is_victim",
|
|
57
|
+
"l.is_issuer_frozen AS launcher_is_issuer_frozen",
|
|
58
|
+
"l.label_risk_labels AS launcher_risk_labels",
|
|
59
|
+
"l.label_risk_levels AS launcher_risk_levels",
|
|
60
|
+
"f.address AS funder",
|
|
61
|
+
"labels(f) AS funder_roles",
|
|
62
|
+
"f.degree_out AS funder_degree_out",
|
|
63
|
+
"f.first_activity_timestamp AS funder_first_activity",
|
|
64
|
+
"f.is_sanctioned AS funder_is_sanctioned",
|
|
65
|
+
"f.is_scam AS funder_is_scam",
|
|
66
|
+
"f.is_victim AS funder_is_victim",
|
|
67
|
+
"f.is_issuer_frozen AS funder_is_issuer_frozen",
|
|
68
|
+
"f.label_risk_labels AS funder_risk_labels",
|
|
69
|
+
"f.label_risk_levels AS funder_risk_levels",
|
|
70
|
+
"e.first_seen_timestamp AS funded_at",
|
|
71
|
+
"e.tx_count AS funding_tx_count",
|
|
72
|
+
"e.amount_usd_sum AS funding_usd",
|
|
73
|
+
"ch.network AS bridged_chain",
|
|
74
|
+
"ch.address AS bridged_bridge",
|
|
75
|
+
"b.kind AS bridged_kind",
|
|
76
|
+
"b.asset AS bridged_asset",
|
|
77
|
+
"b.first_height AS bridged_first_block"
|
|
78
|
+
].join(", ");
|
|
79
|
+
const TOKEN_COLUMNS = [
|
|
80
|
+
"t.address AS token",
|
|
81
|
+
"labels(t) AS token_roles",
|
|
82
|
+
"c.tx_origin AS launcher",
|
|
83
|
+
"c.deployer_address AS deployer",
|
|
84
|
+
"c.factory_address AS factory",
|
|
85
|
+
"c.kind AS creation_kind",
|
|
86
|
+
"c.tx_id AS creation_tx",
|
|
87
|
+
"c.block_height AS creation_block",
|
|
88
|
+
"c.block_timestamp AS creation_time"
|
|
89
|
+
].join(", ");
|
|
90
|
+
function assertReadAddress(address) {
|
|
91
|
+
if (!ADDRESS_READ.test(address)) throw new Error(`deployer screen: ${JSON.stringify(address)} is not a lowercase 0x address`);
|
|
92
|
+
}
|
|
93
|
+
/** The token read: the address as a contract, its first creation and who sent it. */
|
|
94
|
+
function tokenScreenQuery(address) {
|
|
95
|
+
assertReadAddress(address);
|
|
96
|
+
return [
|
|
97
|
+
`USE topology MATCH (t:Address {address:'${address}'})<-[c:DEPLOYED_CONTRACT]-(:Address)`,
|
|
98
|
+
"WITH t, c ORDER BY c.block_height LIMIT 1",
|
|
99
|
+
"MATCH (l:Address {address: c.tx_origin})",
|
|
100
|
+
FUNDER_READ,
|
|
101
|
+
"WITH t, c, l, f, e ORDER BY e.first_seen_timestamp LIMIT 1",
|
|
102
|
+
BRIDGE_READ,
|
|
103
|
+
"WITH t, c, l, f, e, ch, b ORDER BY b.first_height LIMIT 1",
|
|
104
|
+
`RETURN ${TOKEN_COLUMNS}, ${PARTY_COLUMNS} LIMIT 1`
|
|
105
|
+
].join(" ");
|
|
106
|
+
}
|
|
107
|
+
/** The wallet read: the address as the launcher itself. */
|
|
108
|
+
function walletScreenQuery(address) {
|
|
109
|
+
assertReadAddress(address);
|
|
110
|
+
return [
|
|
111
|
+
`USE topology MATCH (l:Address {address:'${address}'})`,
|
|
112
|
+
FUNDER_READ,
|
|
113
|
+
"WITH l, f, e ORDER BY e.first_seen_timestamp LIMIT 1",
|
|
114
|
+
BRIDGE_READ,
|
|
115
|
+
"WITH l, f, e, ch, b ORDER BY b.first_height LIMIT 1",
|
|
116
|
+
`RETURN l.address AS launcher, ${PARTY_COLUMNS} LIMIT 1`
|
|
117
|
+
].join(" ");
|
|
118
|
+
}
|
|
119
|
+
/** The one batch the tool sends: members `token` and `wallet`. */
|
|
120
|
+
function deployerScreenQueries(address) {
|
|
121
|
+
return [{
|
|
122
|
+
id: "token",
|
|
123
|
+
query: tokenScreenQuery(address)
|
|
124
|
+
}, {
|
|
125
|
+
id: "wallet",
|
|
126
|
+
query: walletScreenQuery(address)
|
|
127
|
+
}];
|
|
128
|
+
}
|
|
129
|
+
function isRecord(value) {
|
|
130
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
131
|
+
}
|
|
132
|
+
const textOrNull = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : null;
|
|
133
|
+
const numberOrNull = (value) => {
|
|
134
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
135
|
+
if (typeof value === "string" && value.trim() !== "" && Number.isFinite(Number(value))) return Number(value);
|
|
136
|
+
return null;
|
|
137
|
+
};
|
|
138
|
+
const addressOrNull = (value) => typeof value === "string" && ADDRESS_INPUT.test(value.trim()) ? value.trim().toLowerCase() : null;
|
|
139
|
+
const utcOrNull = (ms) => require_print_result.isEpochMs(ms) ? require_print_result.utcText(ms) : null;
|
|
140
|
+
/**
|
|
141
|
+
* A label from a third-party explorer tag source is training data, never served.
|
|
142
|
+
* The graph is not meant to carry one; this drops it if it ever does.
|
|
143
|
+
*/
|
|
144
|
+
function isServedLabel(value) {
|
|
145
|
+
const lower = value.trim().toLowerCase();
|
|
146
|
+
return !(lower.startsWith("etherscan") || lower.startsWith("data:etherscan"));
|
|
147
|
+
}
|
|
148
|
+
const strings = (value) => Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
149
|
+
/** labels(n) minus Address, with an unserved label dropped. */
|
|
150
|
+
function rolesOf(value) {
|
|
151
|
+
return strings(value).filter((role) => role !== "Address" && isServedLabel(role));
|
|
152
|
+
}
|
|
153
|
+
const FLAG_CRIMES = [
|
|
154
|
+
[
|
|
155
|
+
"sanctioned",
|
|
156
|
+
"is_sanctioned",
|
|
157
|
+
"Sanctioned"
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"scam",
|
|
161
|
+
"is_scam",
|
|
162
|
+
"Scam"
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
"victim",
|
|
166
|
+
"is_victim",
|
|
167
|
+
"Victim"
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
"issuer_frozen",
|
|
171
|
+
"is_issuer_frozen",
|
|
172
|
+
"IssuerFrozen"
|
|
173
|
+
]
|
|
174
|
+
];
|
|
175
|
+
/** The flags that are true, then one risk entry per served risk label with its level. */
|
|
176
|
+
function crimeOf(row, prefix) {
|
|
177
|
+
const crime = [];
|
|
178
|
+
for (const [kind, flag, value] of FLAG_CRIMES) if (row[`${prefix}_${flag}`] === true) crime.push({
|
|
179
|
+
kind,
|
|
180
|
+
value,
|
|
181
|
+
level: null
|
|
182
|
+
});
|
|
183
|
+
const labels = Array.isArray(row[`${prefix}_risk_labels`]) ? row[`${prefix}_risk_labels`] : [];
|
|
184
|
+
const levels = Array.isArray(row[`${prefix}_risk_levels`]) ? row[`${prefix}_risk_levels`] : [];
|
|
185
|
+
labels.forEach((label, at) => {
|
|
186
|
+
if (typeof label !== "string" || label.trim() === "" || !isServedLabel(label)) return;
|
|
187
|
+
crime.push({
|
|
188
|
+
kind: "risk",
|
|
189
|
+
value: label,
|
|
190
|
+
level: textOrNull(levels[at])
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
return crime;
|
|
194
|
+
}
|
|
195
|
+
/** The funder kinds, first match wins; a contract with no role is 'contract', no match is a plain wallet. */
|
|
196
|
+
const FUNDER_KIND_RULES = [
|
|
197
|
+
["scam", (roles, isScam) => isScam || roles.includes("Scam")],
|
|
198
|
+
["mixer", (roles) => roles.includes("Mixer")],
|
|
199
|
+
["exchange", (roles) => roles.includes("Exchange")],
|
|
200
|
+
["bridge", (roles) => roles.includes("Bridge")],
|
|
201
|
+
["bundler", (roles) => roles.includes("Bundler")],
|
|
202
|
+
["launchpad", (roles) => roles.includes("Pool") || roles.includes("Protocol")],
|
|
203
|
+
["contract", (roles) => roles.includes("Contract")]
|
|
204
|
+
];
|
|
205
|
+
function funderKind(roles, isScam = false) {
|
|
206
|
+
return FUNDER_KIND_RULES.find(([, rule]) => rule(roles, isScam))?.[0] ?? "wallet";
|
|
207
|
+
}
|
|
208
|
+
function partyOf(row) {
|
|
209
|
+
const address = addressOrNull(row.launcher);
|
|
210
|
+
if (!address) return null;
|
|
211
|
+
const firstActivity = numberOrNull(row.launcher_first_activity);
|
|
212
|
+
return {
|
|
213
|
+
address,
|
|
214
|
+
roles: rolesOf(row.launcher_roles),
|
|
215
|
+
crime: crimeOf(row, "launcher"),
|
|
216
|
+
first_activity: firstActivity,
|
|
217
|
+
first_activity_utc: utcOrNull(firstActivity),
|
|
218
|
+
degree_in: numberOrNull(row.launcher_degree_in),
|
|
219
|
+
degree_out: numberOrNull(row.launcher_degree_out)
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function funderOf(row) {
|
|
223
|
+
const address = addressOrNull(row.funder);
|
|
224
|
+
if (!address) return null;
|
|
225
|
+
const roles = rolesOf(row.funder_roles);
|
|
226
|
+
const firstActivity = numberOrNull(row.funder_first_activity);
|
|
227
|
+
const fundedAt = numberOrNull(row.funded_at);
|
|
228
|
+
return {
|
|
229
|
+
address,
|
|
230
|
+
kind: funderKind(roles, row.funder_is_scam === true),
|
|
231
|
+
roles,
|
|
232
|
+
crime: crimeOf(row, "funder"),
|
|
233
|
+
degree_out: numberOrNull(row.funder_degree_out),
|
|
234
|
+
first_activity: firstActivity,
|
|
235
|
+
first_activity_utc: utcOrNull(firstActivity),
|
|
236
|
+
funded_at: fundedAt,
|
|
237
|
+
funded_at_utc: utcOrNull(fundedAt),
|
|
238
|
+
funding_tx_count: numberOrNull(row.funding_tx_count),
|
|
239
|
+
funding_usd: numberOrNull(row.funding_usd)
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function bridgedInOf(row) {
|
|
243
|
+
const chain = textOrNull(row.bridged_chain);
|
|
244
|
+
const kind = textOrNull(row.bridged_kind);
|
|
245
|
+
if (!chain && !kind) return null;
|
|
246
|
+
const asset = textOrNull(row.bridged_asset);
|
|
247
|
+
return {
|
|
248
|
+
chain,
|
|
249
|
+
bridge: addressOrNull(row.bridged_bridge) ?? textOrNull(row.bridged_bridge),
|
|
250
|
+
kind,
|
|
251
|
+
asset: addressOrNull(asset) ?? asset,
|
|
252
|
+
first_block: numberOrNull(row.bridged_first_block)
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function creationOf(row) {
|
|
256
|
+
const factory = addressOrNull(row.factory);
|
|
257
|
+
const kind = textOrNull(row.creation_kind);
|
|
258
|
+
const time = numberOrNull(row.creation_time);
|
|
259
|
+
return {
|
|
260
|
+
tx: textOrNull(row.creation_tx)?.toLowerCase() ?? null,
|
|
261
|
+
block: numberOrNull(row.creation_block),
|
|
262
|
+
time,
|
|
263
|
+
time_utc: utcOrNull(time),
|
|
264
|
+
deployer: addressOrNull(row.deployer),
|
|
265
|
+
factory,
|
|
266
|
+
mode: kind === "factory" || kind !== "direct" && factory !== null ? "factory" : "direct"
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/** The first row of a member that names a launcher, or null when it has none. */
|
|
270
|
+
function launcherRow(member) {
|
|
271
|
+
if (!member || !Array.isArray(member.results)) return null;
|
|
272
|
+
return member.results.find((row) => isRecord(row) && addressOrNull(row.launcher) !== null) ?? null;
|
|
273
|
+
}
|
|
274
|
+
const answered = (member) => member?.ok === true && Array.isArray(member.results);
|
|
275
|
+
function memberFailure(id, member) {
|
|
276
|
+
if (!member) return `the ${id} read is missing from the batch answer`;
|
|
277
|
+
return typeof member.error === "string" && member.error.trim() !== "" ? member.error : `the ${id} read did not answer`;
|
|
278
|
+
}
|
|
279
|
+
/** The screen built from the two batch members, or why it cannot be. */
|
|
280
|
+
function screenFromMembers(network, input, members) {
|
|
281
|
+
const token = members.get("token");
|
|
282
|
+
const wallet = members.get("wallet");
|
|
283
|
+
const base = {
|
|
284
|
+
schema: AML_DEPLOYER_SCREEN_SCHEMA,
|
|
285
|
+
tool: AML_DEPLOYER_SCREEN_TOOL,
|
|
286
|
+
network,
|
|
287
|
+
input,
|
|
288
|
+
not_covered: [...NOT_COVERED]
|
|
289
|
+
};
|
|
290
|
+
if (!answered(token)) return { failure: memberFailure("token", token) };
|
|
291
|
+
const tokenRow = launcherRow(token);
|
|
292
|
+
if (tokenRow) {
|
|
293
|
+
const launcher = partyOf(tokenRow);
|
|
294
|
+
const result = {
|
|
295
|
+
...base,
|
|
296
|
+
found: true,
|
|
297
|
+
input_kind: "token",
|
|
298
|
+
token: {
|
|
299
|
+
address: addressOrNull(tokenRow.token) ?? input,
|
|
300
|
+
roles: rolesOf(tokenRow.token_roles)
|
|
301
|
+
},
|
|
302
|
+
creation: creationOf(tokenRow),
|
|
303
|
+
launcher,
|
|
304
|
+
launcher_resolved: !launcher.roles.includes("Bundler"),
|
|
305
|
+
first_funder: funderOf(tokenRow),
|
|
306
|
+
bridged_in: bridgedInOf(tokenRow)
|
|
307
|
+
};
|
|
308
|
+
return { result: {
|
|
309
|
+
...result,
|
|
310
|
+
hint: hintFor(result)
|
|
311
|
+
} };
|
|
312
|
+
}
|
|
313
|
+
if (!answered(wallet)) return { failure: memberFailure("wallet", wallet) };
|
|
314
|
+
const walletRow = launcherRow(wallet);
|
|
315
|
+
if (walletRow) {
|
|
316
|
+
const launcher = partyOf(walletRow);
|
|
317
|
+
const result = {
|
|
318
|
+
...base,
|
|
319
|
+
found: true,
|
|
320
|
+
input_kind: "wallet",
|
|
321
|
+
token: null,
|
|
322
|
+
creation: null,
|
|
323
|
+
launcher,
|
|
324
|
+
launcher_resolved: !launcher.roles.includes("Bundler"),
|
|
325
|
+
first_funder: funderOf(walletRow),
|
|
326
|
+
bridged_in: bridgedInOf(walletRow)
|
|
327
|
+
};
|
|
328
|
+
return { result: {
|
|
329
|
+
...result,
|
|
330
|
+
hint: hintFor(result)
|
|
331
|
+
} };
|
|
332
|
+
}
|
|
333
|
+
const result = {
|
|
334
|
+
...base,
|
|
335
|
+
found: false,
|
|
336
|
+
input_kind: null,
|
|
337
|
+
token: null,
|
|
338
|
+
creation: null,
|
|
339
|
+
launcher: null,
|
|
340
|
+
launcher_resolved: null,
|
|
341
|
+
first_funder: null,
|
|
342
|
+
bridged_in: null
|
|
343
|
+
};
|
|
344
|
+
return { result: {
|
|
345
|
+
...result,
|
|
346
|
+
hint: hintFor(result)
|
|
347
|
+
} };
|
|
348
|
+
}
|
|
349
|
+
const FACTS_ONLY = "Report these as facts. Give no score, no risk level and no verdict of your own: the user decides.";
|
|
350
|
+
function hintFor(result) {
|
|
351
|
+
const parts = [require_answer_hint.ANSWER_HINT];
|
|
352
|
+
if (!result.found) {
|
|
353
|
+
parts.push(`${result.input} is not in the Chain Insights Graph of ${result.network}: no flow, creation or bridge touches it. Say so in one line. That is not proof the address is clean, and it is not proof it is a token. Check the network and the address with the user.`);
|
|
354
|
+
return parts.join(" ");
|
|
355
|
+
}
|
|
356
|
+
parts.push(FACTS_ONLY);
|
|
357
|
+
if (result.input_kind === "wallet" && result.launcher?.roles.some((r) => r === "Contract" || r === "Token")) parts.push("The address is a contract, but the graph holds no creation record for it, so it was screened as a wallet.");
|
|
358
|
+
if (result.launcher_resolved === false) parts.push("The launcher is a bundler: it sends transactions for others, so the person behind the launch is not known from this read.");
|
|
359
|
+
if (!result.first_funder) parts.push("The launcher has no inbound flow in the graph: no first funder.");
|
|
360
|
+
parts.push(`not_covered names what the graph cannot see yet (${NOT_COVERED.join(", ")}); say so when it matters.`);
|
|
361
|
+
return parts.join(" ");
|
|
362
|
+
}
|
|
363
|
+
function errorResult(text) {
|
|
364
|
+
return {
|
|
365
|
+
content: [{
|
|
366
|
+
type: "text",
|
|
367
|
+
text
|
|
368
|
+
}],
|
|
369
|
+
isError: true
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function textResult(structured) {
|
|
373
|
+
return {
|
|
374
|
+
content: [{
|
|
375
|
+
type: "text",
|
|
376
|
+
text: JSON.stringify(structured, null, 2)
|
|
377
|
+
}],
|
|
378
|
+
structuredContent: structured,
|
|
379
|
+
isError: false
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/** aml_deployer_screen, {network, address}. Every argument is checked before a read is sent. */
|
|
383
|
+
async function handleAmlDeployerScreen(args, deps) {
|
|
384
|
+
const record = isRecord(args) ? args : {};
|
|
385
|
+
let network;
|
|
386
|
+
try {
|
|
387
|
+
network = require_dex_registry.normalizeDexNetwork(record.network);
|
|
388
|
+
} catch (err) {
|
|
389
|
+
return errorResult(err instanceof require_dex_registry.DexRegistryError ? err.message : `invalid_network: ${err.message}`);
|
|
390
|
+
}
|
|
391
|
+
const raw = typeof record.address === "string" ? record.address.trim() : "";
|
|
392
|
+
if (!ADDRESS_INPUT.test(raw)) return errorResult("invalid_address: address is required: a token contract or a wallet, 0x plus 40 hex characters. A ticker or a name is not an address: call meta_token_lookup first.");
|
|
393
|
+
const address = raw.toLowerCase();
|
|
394
|
+
const unavailable = await deps.unavailable?.();
|
|
395
|
+
if (unavailable) return errorResult(`No deployer screen read was sent: ${unavailable} There is no answer yet, which is not "not found": try again later.`);
|
|
396
|
+
let answer;
|
|
397
|
+
try {
|
|
398
|
+
answer = await deps.graphQueryBatch({
|
|
399
|
+
network,
|
|
400
|
+
queries: deployerScreenQueries(address)
|
|
401
|
+
});
|
|
402
|
+
} catch (err) {
|
|
403
|
+
return errorResult(`The deployer screen read failed: ${deps.describeFailure(err)} This is not "not found": send the same screen again once.`);
|
|
404
|
+
}
|
|
405
|
+
const members = require_token_lookup.membersOf(answer);
|
|
406
|
+
if (members.size === 0) return errorResult(`The deployer screen read failed: ${answer.isError === true ? require_token_lookup.refusalOf(answer).text : "the batch answer held no reads"} This is not "not found".`);
|
|
407
|
+
const screen = screenFromMembers(network, address, members);
|
|
408
|
+
if ("failure" in screen) return errorResult(`The deployer screen read failed: ${screen.failure} This is not "not found": send the same screen again once.`);
|
|
409
|
+
return textResult(screen.result);
|
|
410
|
+
}
|
|
411
|
+
Object.defineProperty(exports, "AML_DEPLOYER_SCREEN_ANNOTATIONS", {
|
|
412
|
+
enumerable: true,
|
|
413
|
+
get: function() {
|
|
414
|
+
return AML_DEPLOYER_SCREEN_ANNOTATIONS;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
Object.defineProperty(exports, "AML_DEPLOYER_SCREEN_DESCRIPTION", {
|
|
418
|
+
enumerable: true,
|
|
419
|
+
get: function() {
|
|
420
|
+
return AML_DEPLOYER_SCREEN_DESCRIPTION;
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
Object.defineProperty(exports, "AML_DEPLOYER_SCREEN_TITLE", {
|
|
424
|
+
enumerable: true,
|
|
425
|
+
get: function() {
|
|
426
|
+
return AML_DEPLOYER_SCREEN_TITLE;
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
Object.defineProperty(exports, "AML_DEPLOYER_SCREEN_TOOL", {
|
|
430
|
+
enumerable: true,
|
|
431
|
+
get: function() {
|
|
432
|
+
return AML_DEPLOYER_SCREEN_TOOL;
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
Object.defineProperty(exports, "deployer_screen_exports", {
|
|
436
|
+
enumerable: true,
|
|
437
|
+
get: function() {
|
|
438
|
+
return deployer_screen_exports;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
Object.defineProperty(exports, "handleAmlDeployerScreen", {
|
|
442
|
+
enumerable: true,
|
|
443
|
+
get: function() {
|
|
444
|
+
return handleAmlDeployerScreen;
|
|
445
|
+
}
|
|
446
|
+
});
|