chain-insights 0.71.4 → 0.73.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 +38 -3
- package/dist/buy-97M6dtEu.cjs +195 -0
- package/dist/buy-_mpdRieG.mjs +195 -0
- package/dist/buy-_mpdRieG.mjs.map +1 -0
- package/dist/{capabilities-DGavTSoW.cjs → capabilities-Ds3320iS.cjs} +1 -1
- package/dist/{capabilities-BBVDIECk.mjs → capabilities-DxojbX4D.mjs} +2 -2
- package/dist/{capabilities-BBVDIECk.mjs.map → capabilities-DxojbX4D.mjs.map} +1 -1
- package/dist/{claude-desktop-CTaBCUIm.mjs → claude-desktop-6jwX0Lux.mjs} +18 -3
- package/dist/{claude-desktop-CTaBCUIm.mjs.map → claude-desktop-6jwX0Lux.mjs.map} +1 -1
- package/dist/{claude-desktop-BI_mGkZ6.cjs → claude-desktop-Jmm4PlBZ.cjs} +17 -2
- package/dist/cli.cjs +163 -31
- package/dist/cli.mjs +163 -31
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-gsLi528K.mjs → client-7qOfAdpH.mjs} +31 -12
- package/dist/client-7qOfAdpH.mjs.map +1 -0
- package/dist/{client-Ypw9BNbn.cjs → client-C9uwHnBS.cjs} +33 -14
- package/dist/{dex-registry-KOTJhAQf.cjs → dex-registry-Chs79Ukc.cjs} +11 -8
- package/dist/{dex-registry-05wAhSa0.mjs → dex-registry-rziydXYq.mjs} +12 -9
- package/dist/{dex-registry-05wAhSa0.mjs.map → dex-registry-rziydXYq.mjs.map} +1 -1
- package/dist/{dex-tool-B4T8Czhm.cjs → dex-tool-DLWnff1n.cjs} +6 -4
- package/dist/{dex-tool-B5Qwz1Zd.mjs → dex-tool-DsaAIa-a.mjs} +7 -5
- package/dist/{dex-tool-B5Qwz1Zd.mjs.map → dex-tool-DsaAIa-a.mjs.map} +1 -1
- package/dist/{graph-schema-BoUMa03H.cjs → graph-schema-BGbJumCY.cjs} +63 -25
- package/dist/{graph-schema-DqZUTnP0.mjs → graph-schema-ClqjzgrM.mjs} +59 -27
- package/dist/{graph-schema-DqZUTnP0.mjs.map → graph-schema-ClqjzgrM.mjs.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +7 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/known-keys-B87ZqOgE.mjs +78 -0
- package/dist/known-keys-B87ZqOgE.mjs.map +1 -0
- package/dist/known-keys-PKZF5GYd.cjs +99 -0
- package/dist/mcp-proxy.cjs +86 -39
- package/dist/mcp-proxy.d.cts.map +1 -1
- package/dist/mcp-proxy.d.mts.map +1 -1
- package/dist/mcp-proxy.mjs +86 -39
- package/dist/mcp-proxy.mjs.map +1 -1
- package/dist/{public-tools-Dj130EuJ.cjs → public-tools-Bl_l_rKK.cjs} +8 -5
- package/dist/{public-tools-B77ZT0jt.mjs → public-tools-CQjGt7_q.mjs} +9 -6
- package/dist/{public-tools-B77ZT0jt.mjs.map → public-tools-CQjGt7_q.mjs.map} +1 -1
- package/dist/quote-B9sYNOiv.cjs +70 -0
- package/dist/quote-DfTut0cx.mjs +68 -0
- package/dist/quote-DfTut0cx.mjs.map +1 -0
- package/dist/robinhood-CCTMagwM.mjs +226 -0
- package/dist/robinhood-CCTMagwM.mjs.map +1 -0
- package/dist/robinhood-ChiT69sc.cjs +313 -0
- package/dist/rules-BD-cNHMX.cjs +31 -0
- package/dist/rules-BWdbOtHi.mjs +10 -0
- package/dist/rules-BWdbOtHi.mjs.map +1 -0
- package/dist/{schema-cache-DwddPLcY.cjs → schema-cache-C7v9ml6S.cjs} +1 -1
- package/dist/{schema-cache-BT-kHy_r.mjs → schema-cache-DRObKUvS.mjs} +3 -3
- package/dist/{schema-cache-BT-kHy_r.mjs.map → schema-cache-DRObKUvS.mjs.map} +1 -1
- package/dist/{skill-refresh-FXhQpW94.cjs → skill-refresh-Be2D5FrX.cjs} +2 -2
- package/dist/{skill-refresh-I5MSULwP.mjs → skill-refresh-xYWZ_hua.mjs} +3 -3
- package/dist/{skill-refresh-I5MSULwP.mjs.map → skill-refresh-xYWZ_hua.mjs.map} +1 -1
- package/dist/subscription-status-9tMfD90J.cjs +168 -0
- package/dist/subscription-status-DIuH84fM.mjs +148 -0
- package/dist/subscription-status-DIuH84fM.mjs.map +1 -0
- package/dist/{tools-BHfphgy9.cjs → tools-Cmnq7yip.cjs} +21 -4
- package/dist/{tools-BnThuvE2.mjs → tools-D9ep9E7Q.mjs} +22 -5
- package/dist/tools-D9ep9E7Q.mjs.map +1 -0
- package/dist/topup--nWtDnWP.cjs +43 -0
- package/dist/topup-CfFe1bGS.mjs +45 -0
- package/dist/topup-CfFe1bGS.mjs.map +1 -0
- package/dist/{topup-server-DzeM_YAt.mjs → topup-server-B0VKHslr.mjs} +2 -2
- package/dist/{topup-server-DzeM_YAt.mjs.map → topup-server-B0VKHslr.mjs.map} +1 -1
- package/dist/{topup-server-BIbSfvX5.cjs → topup-server-BkGM8P99.cjs} +1 -1
- package/dist/{topup-server-Bh7MlzRt.cjs → topup-server-C58eWflv.cjs} +284 -69
- package/dist/{topup-server-BrkPhqJG.mjs → topup-server-RQ6-c92F.mjs} +274 -71
- package/dist/topup-server-RQ6-c92F.mjs.map +1 -0
- package/dist/{wallet-B3hAr70M.cjs → wallet-CgIAfdxL.cjs} +34 -0
- package/dist/{wallet-GNDl3FkR.mjs → wallet-QTo5YCFR.mjs} +35 -1
- package/dist/wallet-QTo5YCFR.mjs.map +1 -0
- package/docs/development.md +1 -1
- package/docs/graph-tools.md +2 -1
- package/docs/mcp-proxy.md +30 -4
- package/docs/stability.md +3 -2
- package/package.json +1 -1
- package/skills/chain-insights-cypher/SKILL.md +9 -0
- package/dist/client-gsLi528K.mjs.map +0 -1
- package/dist/subscription-status-DA9DCFrC.mjs +0 -32
- package/dist/subscription-status-DA9DCFrC.mjs.map +0 -1
- package/dist/subscription-status-ru99UCPZ.cjs +0 -40
- package/dist/tools-BnThuvE2.mjs.map +0 -1
- package/dist/topup-server-BrkPhqJG.mjs.map +0 -1
- package/dist/wallet-GNDl3FkR.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -45,6 +45,129 @@ function formatCiaWorkflows(workflows) {
|
|
|
45
45
|
].join("\n");
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
|
+
//#region src/subscription/cli.ts
|
|
49
|
+
/** One MCP session to the configured graph endpoint, for the status reads. */
|
|
50
|
+
async function withStatusReader(fn) {
|
|
51
|
+
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
52
|
+
const config = await loadConfig();
|
|
53
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
54
|
+
const { toGraphMcpEndpointError } = await import("./transport-error-BP6bZVDs.mjs");
|
|
55
|
+
const endpoint = resolveGraphMcpEndpoint(config);
|
|
56
|
+
const fetchImpl = await createConfiguredGraphMcpFetch(config);
|
|
57
|
+
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
58
|
+
const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
59
|
+
const client = new Client({
|
|
60
|
+
name: "chain-insights-cli-subscription",
|
|
61
|
+
version: PACKAGE_VERSION
|
|
62
|
+
});
|
|
63
|
+
try {
|
|
64
|
+
await client.connect(new StreamableHTTPClientTransport(new URL(endpoint), { fetch: fetchImpl }));
|
|
65
|
+
} catch (err) {
|
|
66
|
+
throw toGraphMcpEndpointError(err, endpoint);
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const { parseSubscriptionStatusToolResult, subscriptionStatusArguments, subscriptionStatusNeedsWallet } = await import("./subscription-status-DIuH84fM.mjs").then((n) => n.r);
|
|
70
|
+
const remote = (await client.listTools()).tools.find((tool) => tool.name === "subscription_status");
|
|
71
|
+
let wallet = null;
|
|
72
|
+
if (remote && subscriptionStatusNeedsWallet(remote)) {
|
|
73
|
+
const { getWalletAccount } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
74
|
+
wallet = (await getWalletAccount()).address;
|
|
75
|
+
}
|
|
76
|
+
let lastError = remote ? null : `${endpoint} serves no subscription_status tool.`;
|
|
77
|
+
return await fn({
|
|
78
|
+
async read() {
|
|
79
|
+
if (!remote) return null;
|
|
80
|
+
try {
|
|
81
|
+
const result = await client.callTool({
|
|
82
|
+
name: "subscription_status",
|
|
83
|
+
arguments: subscriptionStatusArguments(remote, wallet)
|
|
84
|
+
});
|
|
85
|
+
const facts = parseSubscriptionStatusToolResult(result);
|
|
86
|
+
if (facts) {
|
|
87
|
+
lastError = null;
|
|
88
|
+
return facts;
|
|
89
|
+
}
|
|
90
|
+
lastError = result.content?.find((block) => block.type === "text")?.text ?? "The server sent a subscription status this version cannot read.";
|
|
91
|
+
return null;
|
|
92
|
+
} catch (err) {
|
|
93
|
+
lastError = err.message;
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
lastError: () => lastError
|
|
98
|
+
});
|
|
99
|
+
} finally {
|
|
100
|
+
await client.close();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function askYes(text) {
|
|
104
|
+
const { createInterface } = await import("node:readline/promises");
|
|
105
|
+
process.stderr.write(`${text}\n`);
|
|
106
|
+
const prompt = createInterface({
|
|
107
|
+
input: process.stdin,
|
|
108
|
+
output: process.stderr
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
return (await prompt.question("Type yes to continue: ")).trim().toLowerCase() === "yes";
|
|
112
|
+
} finally {
|
|
113
|
+
prompt.close();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function fail(err) {
|
|
117
|
+
console.error(err.message);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
function registerSubscriptionCommands(program, command) {
|
|
121
|
+
program.command("subscription").description("Buy and check the Chain Insights subscription, paid in $CIA on Robinhood Chain").addCommand(command("topup").description("Show the wallet address and QR code to fund with $CIA and ETH on Robinhood Chain").option("--no-open", "Print the top-up page URL without opening a browser").option("--json", "Print machine-readable top-up facts").action(async (opts) => {
|
|
122
|
+
try {
|
|
123
|
+
const { runSubscriptionTopup } = await import("./topup-CfFe1bGS.mjs");
|
|
124
|
+
await runSubscriptionTopup(opts);
|
|
125
|
+
} catch (err) {
|
|
126
|
+
fail(err);
|
|
127
|
+
}
|
|
128
|
+
})).addCommand(command("buy").description("Buy subscription days: approve and pay $CIA on Robinhood Chain, after your yes").requiredOption("--days <n>", "Days to buy, a whole number; a wallet holds at most 90 days").option("--yes", "Skip the typed yes (for a run with no terminal)").option("--json", "Print the outcome as JSON").action(async (opts) => {
|
|
129
|
+
try {
|
|
130
|
+
const { assertDays, fetchCiaUsdPrice } = await import("./quote-DfTut0cx.mjs");
|
|
131
|
+
const { assertConfirmable, executeBuy, formatBuyResult } = await import("./buy-_mpdRieG.mjs");
|
|
132
|
+
const days = Number(opts.days);
|
|
133
|
+
assertDays(days);
|
|
134
|
+
assertConfirmable({
|
|
135
|
+
stdinIsTTY: process.stdin.isTTY === true,
|
|
136
|
+
yes: opts.yes === true
|
|
137
|
+
});
|
|
138
|
+
const { assertWalletKeyNotPublic, getWalletAccount } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
139
|
+
const account = await getWalletAccount();
|
|
140
|
+
assertWalletKeyNotPublic(account);
|
|
141
|
+
const result = await withStatusReader((reader) => executeBuy({
|
|
142
|
+
account,
|
|
143
|
+
days,
|
|
144
|
+
readStatus: () => reader.read(),
|
|
145
|
+
fetchPrice: () => fetchCiaUsdPrice(),
|
|
146
|
+
confirm: async (text) => {
|
|
147
|
+
if (opts.yes !== true) return askYes(text);
|
|
148
|
+
process.stderr.write(`${text}\nConfirmed by --yes.\n`);
|
|
149
|
+
return true;
|
|
150
|
+
},
|
|
151
|
+
log: (line) => process.stderr.write(`${line}\n`)
|
|
152
|
+
}));
|
|
153
|
+
console.log(opts.json ? JSON.stringify(result, null, 2) : formatBuyResult(result));
|
|
154
|
+
} catch (err) {
|
|
155
|
+
fail(err);
|
|
156
|
+
}
|
|
157
|
+
})).addCommand(command("status").description("Show the subscription of this wallet, read by the wallet's proof").option("--json", "Print the status facts as JSON").action(async (opts) => {
|
|
158
|
+
try {
|
|
159
|
+
const { formatSubscriptionStatus } = await import("./subscription-status-DIuH84fM.mjs").then((n) => n.r);
|
|
160
|
+
await withStatusReader(async (reader) => {
|
|
161
|
+
const facts = await reader.read();
|
|
162
|
+
if (!facts) throw new Error(`Subscription status unavailable: ${reader.lastError() ?? "no answer"}`);
|
|
163
|
+
console.log(opts.json ? JSON.stringify(facts, null, 2) : formatSubscriptionStatus(facts));
|
|
164
|
+
});
|
|
165
|
+
} catch (err) {
|
|
166
|
+
fail(err);
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
48
171
|
//#region src/cli.ts
|
|
49
172
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
50
173
|
const installerPath = path.resolve(__dirname, "..", "bin", "install.cjs");
|
|
@@ -91,7 +214,7 @@ function runInstaller(flag) {
|
|
|
91
214
|
async function withGraphMcpClient(name, fn) {
|
|
92
215
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
93
216
|
const config = await loadConfig();
|
|
94
|
-
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-
|
|
217
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
95
218
|
const { toGraphMcpEndpointError } = await import("./transport-error-BP6bZVDs.mjs");
|
|
96
219
|
const endpoint = resolveGraphMcpEndpoint(config);
|
|
97
220
|
const paymentFetch = await createConfiguredGraphMcpFetch(config);
|
|
@@ -118,21 +241,21 @@ async function withGraphMcpClient(name, fn) {
|
|
|
118
241
|
}
|
|
119
242
|
async function printNetworkCapabilities(opts) {
|
|
120
243
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
121
|
-
const { fetchNetworkCapabilities, formatNetworkCapabilities } = await import("./capabilities-
|
|
244
|
+
const { fetchNetworkCapabilities, formatNetworkCapabilities } = await import("./capabilities-DxojbX4D.mjs").then((n) => n.t);
|
|
122
245
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
123
246
|
if (opts.json) console.log(JSON.stringify(document, null, 2));
|
|
124
247
|
else console.log(formatNetworkCapabilities(document));
|
|
125
248
|
}
|
|
126
249
|
async function printNetworkOverview(opts) {
|
|
127
250
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
128
|
-
const { fetchNetworkCapabilities, formatNetworkOverview } = await import("./capabilities-
|
|
251
|
+
const { fetchNetworkCapabilities, formatNetworkOverview } = await import("./capabilities-DxojbX4D.mjs").then((n) => n.t);
|
|
129
252
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
130
253
|
if (opts.json) console.log(JSON.stringify(document, null, 2));
|
|
131
254
|
else console.log(formatNetworkOverview(document));
|
|
132
255
|
}
|
|
133
256
|
async function printNetworkCapability(name, opts) {
|
|
134
257
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
135
|
-
const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await import("./capabilities-
|
|
258
|
+
const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await import("./capabilities-DxojbX4D.mjs").then((n) => n.t);
|
|
136
259
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
137
260
|
const network = findNetworkCapability(document, name);
|
|
138
261
|
if (!network) {
|
|
@@ -149,8 +272,8 @@ async function printNetworkCapability(name, opts) {
|
|
|
149
272
|
*/
|
|
150
273
|
async function printNetworkSchema(name, opts) {
|
|
151
274
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
152
|
-
const { resolveGraphMcpEndpoint } = await import("./client-
|
|
153
|
-
const { formatGraphSchemaText, getGraphSchema } = await import("./graph-schema-
|
|
275
|
+
const { resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
276
|
+
const { formatGraphSchemaText, getGraphSchema } = await import("./graph-schema-ClqjzgrM.mjs").then((n) => n.i);
|
|
154
277
|
const config = await loadConfig();
|
|
155
278
|
const schema = await getGraphSchema({
|
|
156
279
|
network: name,
|
|
@@ -163,11 +286,11 @@ async function printNetworkSchema(name, opts) {
|
|
|
163
286
|
function addAmlAddressRiskCommand(parent, networksCommand) {
|
|
164
287
|
parent.addCommand(createCliCommand("aml-address-risk").description("CIA workflow: screen an address for AML risk, exchange behavior, and optional comparison with another address").requiredOption("--address <address>", "Full blockchain address to screen").requiredOption("--network <network>", `Network to query. Run \`${networksCommand}\` for supported networks.`).option("--compare-address <address>", "Optional second address to compare against the screened address").option("--json", "Print machine-readable JSON output").option("--version <version>", "AML tool contract version. Omit to use the latest version (currently v1)").addOption(new Option("--tool-version <version>", "Internal alias for the AML tool version").hideHelp()).action(async (opts) => {
|
|
165
288
|
try {
|
|
166
|
-
const { resolveAmlAddressRiskVersion } = await import("./public-tools-
|
|
289
|
+
const { resolveAmlAddressRiskVersion } = await import("./public-tools-CQjGt7_q.mjs");
|
|
167
290
|
const requestedVersion = opts.toolVersion ?? opts.version;
|
|
168
291
|
resolveAmlAddressRiskVersion(requestedVersion);
|
|
169
292
|
await withGraphMcpClient("chain-insights-cli-aml-address-risk", async (client) => {
|
|
170
|
-
const { runAmlAddressRisk } = await import("./public-tools-
|
|
293
|
+
const { runAmlAddressRisk } = await import("./public-tools-CQjGt7_q.mjs");
|
|
171
294
|
const result = await runAmlAddressRisk(client, {
|
|
172
295
|
address: opts.address,
|
|
173
296
|
network: opts.network,
|
|
@@ -362,7 +485,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
362
485
|
})).addCommand(createCliCommand("set").description("Write one Chain Insights configuration value").argument("<key>", "Config key to write").argument("<value>", "Value to set").action(async (key, value) => {
|
|
363
486
|
if (key === "walletPrivateKey") {
|
|
364
487
|
try {
|
|
365
|
-
const { setWalletPrivateKey } = await import("./wallet-
|
|
488
|
+
const { setWalletPrivateKey } = await import("./wallet-QTo5YCFR.mjs").then((n) => n.s);
|
|
366
489
|
const address = await setWalletPrivateKey(value);
|
|
367
490
|
console.log("Wallet private key encrypted and stored in ~/.chain-insights/wallet.json");
|
|
368
491
|
console.log(`Wallet address: ${address}`);
|
|
@@ -386,12 +509,13 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
386
509
|
const displayed = key.toLowerCase().includes("token") ? "[redacted]" : coerced;
|
|
387
510
|
console.log(`Set ${key} = ${displayed}`);
|
|
388
511
|
}));
|
|
389
|
-
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(createCliCommand("create").description("Generate a new local Base payment wallet").action(async () => {
|
|
512
|
+
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(createCliCommand("create").description("Generate a new local Base payment wallet").option("--replace", "Replace a wallet whose key is public (the old file is backed up next to wallet.json)").action(async (opts) => {
|
|
390
513
|
try {
|
|
391
|
-
const { isWalletConfigured, setWalletPrivateKey, walletPath } = await import("./wallet-
|
|
514
|
+
const { assertStoredWalletReplaceable, isWalletConfigured, replacePublicWallet, setWalletPrivateKey, storedWalletKeyIsPublic, walletPath } = await import("./wallet-QTo5YCFR.mjs").then((n) => n.s);
|
|
392
515
|
const { createInterface } = await import("node:readline/promises");
|
|
393
516
|
const { formatWalletBackupWarning, generateWalletPrivateKey, isWalletBackupConfirmed } = await import("./create-CpfZq2fx.mjs").then((n) => n.t);
|
|
394
|
-
if (
|
|
517
|
+
if (opts.replace === true) await assertStoredWalletReplaceable();
|
|
518
|
+
else if (await isWalletConfigured()) throw new Error(await storedWalletKeyIsPublic() === true ? "A payment wallet already exists, and its key is public: anything sent to it is taken within seconds. Run `cia wallet create --replace`." : "A payment wallet already exists. Run `cia wallet address` to view it or use `cia wallet import <private-key> --force` to replace it.");
|
|
395
519
|
const privateKey = generateWalletPrivateKey();
|
|
396
520
|
const color = process.stderr.isTTY === true && process.env["NO_COLOR"] === void 0;
|
|
397
521
|
process.stderr.write(`${formatWalletBackupWarning(privateKey, { color })}\n`);
|
|
@@ -407,7 +531,8 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
407
531
|
}
|
|
408
532
|
process.stderr.write("\n");
|
|
409
533
|
if (!isWalletBackupConfirmed(answer)) throw new Error("Wallet creation cancelled. The wallet was not saved.");
|
|
410
|
-
const address = await setWalletPrivateKey(privateKey);
|
|
534
|
+
const address = opts.replace === true ? await replacePublicWallet(privateKey) : await setWalletPrivateKey(privateKey);
|
|
535
|
+
if (opts.replace === true) console.log("The old wallet file is backed up next to ~/.chain-insights/wallet.json");
|
|
411
536
|
console.log(`Wallet created: ${address}`);
|
|
412
537
|
console.log(`Encrypted local copy: ${walletPath()}`);
|
|
413
538
|
console.log("Next: cia wallet ready");
|
|
@@ -417,7 +542,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
417
542
|
}
|
|
418
543
|
})).addCommand(createCliCommand("import").description("Import a Base payment wallet").argument("<private-key>", "0x-prefixed EVM private key").option("--force", "Replace an existing wallet (the previous key is backed up next to wallet.json)").action(async (privateKey, opts) => {
|
|
419
544
|
try {
|
|
420
|
-
const { setWalletPrivateKey, isWalletConfigured } = await import("./wallet-
|
|
545
|
+
const { setWalletPrivateKey, isWalletConfigured } = await import("./wallet-QTo5YCFR.mjs").then((n) => n.s);
|
|
421
546
|
const replacing = opts.force === true && await isWalletConfigured();
|
|
422
547
|
const address = await setWalletPrivateKey(privateKey, { force: opts.force });
|
|
423
548
|
if (replacing) console.log("Previous wallet key backed up next to ~/.chain-insights/wallet.json");
|
|
@@ -431,7 +556,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
431
556
|
}
|
|
432
557
|
})).addCommand(createCliCommand("address").description("Print the local payment wallet address").action(async () => {
|
|
433
558
|
try {
|
|
434
|
-
const { getWalletAccount } = await import("./tools-
|
|
559
|
+
const { getWalletAccount } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
435
560
|
const account = await getWalletAccount();
|
|
436
561
|
console.log(account.address);
|
|
437
562
|
} catch (err) {
|
|
@@ -440,7 +565,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
440
565
|
}
|
|
441
566
|
})).addCommand(createCliCommand("balance").description("Show the local payment wallet Base USDC balance").action(async () => {
|
|
442
567
|
try {
|
|
443
|
-
const { getWalletBalanceText } = await import("./tools-
|
|
568
|
+
const { getWalletBalanceText } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
444
569
|
console.log(await getWalletBalanceText());
|
|
445
570
|
} catch (err) {
|
|
446
571
|
console.error(err.message);
|
|
@@ -448,7 +573,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
448
573
|
}
|
|
449
574
|
})).addCommand(createCliCommand("ready").description("Check and prepare the wallet for paid Chain Insights Graph calls").option("--check-only", "Only check readiness; do not submit the one-time payment setup").addOption(new Option("--no-approve", "Deprecated alias for --check-only").hideHelp()).option("--payment-usdc <amount>", "USDC setup cap to prepare for paid calls", "1").addOption(new Option("--approval-usdc <amount>", "Deprecated alias for --payment-usdc").hideHelp()).option("--json", "Print machine-readable readiness metadata").action(async (opts) => {
|
|
450
575
|
try {
|
|
451
|
-
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await import("./tools-
|
|
576
|
+
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
452
577
|
const result = await prepareWalletForPaidCalls({
|
|
453
578
|
minimumApprovalUnits: parsePaymentApprovalUnits(opts.paymentUsdc ?? opts.approvalUsdc ?? "1"),
|
|
454
579
|
approve: opts.checkOnly ? false : opts.approve !== false
|
|
@@ -464,9 +589,10 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
464
589
|
}
|
|
465
590
|
})).addCommand(createCliCommand("topup").description("Open a local browser page to top up the payment wallet").option("--no-open", "Print the top-up URL without opening a browser").option("--json", "Print machine-readable top-up metadata").action(async (opts) => {
|
|
466
591
|
try {
|
|
467
|
-
const { buildTopupInfo, getWalletAccount } = await import("./tools-
|
|
468
|
-
const { startTopupServer } = await import("./topup-server-
|
|
592
|
+
const { assertWalletKeyNotPublic, buildTopupInfo, getWalletAccount } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
593
|
+
const { startTopupServer } = await import("./topup-server-B0VKHslr.mjs").then((n) => n.r);
|
|
469
594
|
const account = await getWalletAccount();
|
|
595
|
+
assertWalletKeyNotPublic(account);
|
|
470
596
|
const url = await startTopupServer(account);
|
|
471
597
|
const info = buildTopupInfo(account.address, url);
|
|
472
598
|
if (opts.json) console.log(JSON.stringify(info, null, 2));
|
|
@@ -486,6 +612,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
486
612
|
process.exit(1);
|
|
487
613
|
}
|
|
488
614
|
}));
|
|
615
|
+
registerSubscriptionCommands(program, createCliCommand);
|
|
489
616
|
program.command("mcp").description("Low-level access to the Chain Insights MCP endpoint").allowExcessArguments(false).addCommand(createCliCommand("networks").description("List the detailed Chain Insights capability matrix and tool support").option("--json", "Print raw capability JSON").action(async (opts) => {
|
|
490
617
|
try {
|
|
491
618
|
await printNetworkCapabilities(opts);
|
|
@@ -495,11 +622,11 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
495
622
|
}
|
|
496
623
|
})).addCommand(createCliCommand("tools").description("List the remote GraphRAG MCP tools (cached for 24 hours)").option("--refresh", "Force refresh schema cache").action(async (opts) => {
|
|
497
624
|
try {
|
|
498
|
-
const { loadSchema, saveSchema } = await import("./schema-cache-
|
|
625
|
+
const { loadSchema, saveSchema } = await import("./schema-cache-DRObKUvS.mjs");
|
|
499
626
|
const { formatToolsTable } = await import("./format-CSesEBvS.mjs");
|
|
500
627
|
const { visibleRemoteTools } = await import("./tool-visibility-D-pFpuoz.mjs").then((n) => n.a);
|
|
501
628
|
const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
|
|
502
|
-
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-
|
|
629
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
503
630
|
const config = await loadConfig();
|
|
504
631
|
const graphMcpEndpoint = resolveGraphMcpEndpoint(config);
|
|
505
632
|
let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint);
|
|
@@ -520,7 +647,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
520
647
|
}
|
|
521
648
|
}
|
|
522
649
|
console.log(formatToolsTable(visibleRemoteTools(tools)));
|
|
523
|
-
const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await import("./dex-tool-
|
|
650
|
+
const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await import("./dex-tool-DsaAIa-a.mjs").then((n) => n.a);
|
|
524
651
|
console.log("");
|
|
525
652
|
console.log(formatToolsTable([{
|
|
526
653
|
name: META_DEX_LOOKUP_TOOL,
|
|
@@ -538,7 +665,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
538
665
|
assertPublicMcpToolName(tool);
|
|
539
666
|
validatePublicMcpToolArguments(tool, args);
|
|
540
667
|
if (tool === "wallet_balance") {
|
|
541
|
-
const { getWalletBalanceText } = await import("./tools-
|
|
668
|
+
const { getWalletBalanceText } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
542
669
|
console.log(await getWalletBalanceText());
|
|
543
670
|
return;
|
|
544
671
|
}
|
|
@@ -554,8 +681,8 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
554
681
|
return;
|
|
555
682
|
}
|
|
556
683
|
if (tool === "meta_dex_lookup") {
|
|
557
|
-
const { handleMetaDexLookup } = await import("./dex-tool-
|
|
558
|
-
const { loadRegistry } = await import("./dex-registry-
|
|
684
|
+
const { handleMetaDexLookup } = await import("./dex-tool-DsaAIa-a.mjs").then((n) => n.a);
|
|
685
|
+
const { loadRegistry } = await import("./dex-registry-rziydXYq.mjs").then((n) => n.n);
|
|
559
686
|
const { metaDexLookupArgs } = await import("./call-args-B0oMK1-J.mjs");
|
|
560
687
|
const result = await withGraphMcpClient("chain-insights-cli-dex-lookup", (client) => handleMetaDexLookup(metaDexLookupArgs(args), {
|
|
561
688
|
loadRegistry: (network) => loadRegistry(network),
|
|
@@ -588,27 +715,32 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
588
715
|
} catch (err) {
|
|
589
716
|
const { isMissingUsageStatusToolError, primitiveBackendUsageStatus, usageStatusText } = await import("./usage-status-Frot6fPG.mjs").then((n) => n.r);
|
|
590
717
|
if (!isMissingUsageStatusToolError(err)) throw err;
|
|
591
|
-
const { resolveGraphMcpEndpoint } = await import("./client-
|
|
718
|
+
const { resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
592
719
|
console.log(usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config))));
|
|
593
720
|
}
|
|
594
721
|
return;
|
|
595
722
|
}
|
|
596
723
|
if (tool === "meta_subscription_status") {
|
|
597
724
|
try {
|
|
598
|
-
const {
|
|
599
|
-
const
|
|
725
|
+
const { subscriptionStatusArguments, subscriptionStatusNeedsWallet } = await import("./subscription-status-DIuH84fM.mjs").then((n) => n.r);
|
|
726
|
+
const remote = (await client.listTools()).tools.find((t) => t.name === "subscription_status");
|
|
727
|
+
let wallet = null;
|
|
728
|
+
if (subscriptionStatusNeedsWallet(remote)) {
|
|
729
|
+
const { getWalletAccount } = await import("./tools-D9ep9E7Q.mjs").then((n) => n.p);
|
|
730
|
+
wallet = (await getWalletAccount()).address;
|
|
731
|
+
}
|
|
600
732
|
const result = await client.callTool({
|
|
601
733
|
name: "subscription_status",
|
|
602
|
-
arguments:
|
|
734
|
+
arguments: subscriptionStatusArguments(remote, wallet)
|
|
603
735
|
});
|
|
604
736
|
printMcpTextContent(result, {
|
|
605
737
|
tool,
|
|
606
738
|
json: opts.json
|
|
607
739
|
});
|
|
608
740
|
} catch (err) {
|
|
609
|
-
const { isMissingSubscriptionStatusToolError, unavailableSubscriptionStatus, subscriptionStatusText } = await import("./subscription-status-
|
|
741
|
+
const { isMissingSubscriptionStatusToolError, unavailableSubscriptionStatus, subscriptionStatusText } = await import("./subscription-status-DIuH84fM.mjs").then((n) => n.r);
|
|
610
742
|
if (!isMissingSubscriptionStatusToolError(err)) throw err;
|
|
611
|
-
const { resolveGraphMcpEndpoint } = await import("./client-
|
|
743
|
+
const { resolveGraphMcpEndpoint } = await import("./client-7qOfAdpH.mjs").then((n) => n.r);
|
|
612
744
|
console.log(subscriptionStatusText(unavailableSubscriptionStatus(resolveGraphMcpEndpoint(config), `subscription_status failed: ${err.message}`)));
|
|
613
745
|
}
|
|
614
746
|
return;
|