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.cjs
CHANGED
|
@@ -47,6 +47,129 @@ function formatCiaWorkflows(workflows) {
|
|
|
47
47
|
].join("\n");
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/subscription/cli.ts
|
|
51
|
+
/** One MCP session to the configured graph endpoint, for the status reads. */
|
|
52
|
+
async function withStatusReader(fn) {
|
|
53
|
+
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
54
|
+
const config = await loadConfig();
|
|
55
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
56
|
+
const { toGraphMcpEndpointError } = await Promise.resolve().then(() => require("./transport-error-nSrFW47U.cjs"));
|
|
57
|
+
const endpoint = resolveGraphMcpEndpoint(config);
|
|
58
|
+
const fetchImpl = await createConfiguredGraphMcpFetch(config);
|
|
59
|
+
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
60
|
+
const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
61
|
+
const client = new Client({
|
|
62
|
+
name: "chain-insights-cli-subscription",
|
|
63
|
+
version: require_print_result.PACKAGE_VERSION
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
await client.connect(new StreamableHTTPClientTransport(new URL(endpoint), { fetch: fetchImpl }));
|
|
67
|
+
} catch (err) {
|
|
68
|
+
throw toGraphMcpEndpointError(err, endpoint);
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const { parseSubscriptionStatusToolResult, subscriptionStatusArguments, subscriptionStatusNeedsWallet } = await Promise.resolve().then(() => require("./subscription-status-9tMfD90J.cjs")).then((n) => n.subscription_status_exports);
|
|
72
|
+
const remote = (await client.listTools()).tools.find((tool) => tool.name === "subscription_status");
|
|
73
|
+
let wallet = null;
|
|
74
|
+
if (remote && subscriptionStatusNeedsWallet(remote)) {
|
|
75
|
+
const { getWalletAccount } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
76
|
+
wallet = (await getWalletAccount()).address;
|
|
77
|
+
}
|
|
78
|
+
let lastError = remote ? null : `${endpoint} serves no subscription_status tool.`;
|
|
79
|
+
return await fn({
|
|
80
|
+
async read() {
|
|
81
|
+
if (!remote) return null;
|
|
82
|
+
try {
|
|
83
|
+
const result = await client.callTool({
|
|
84
|
+
name: "subscription_status",
|
|
85
|
+
arguments: subscriptionStatusArguments(remote, wallet)
|
|
86
|
+
});
|
|
87
|
+
const facts = parseSubscriptionStatusToolResult(result);
|
|
88
|
+
if (facts) {
|
|
89
|
+
lastError = null;
|
|
90
|
+
return facts;
|
|
91
|
+
}
|
|
92
|
+
lastError = result.content?.find((block) => block.type === "text")?.text ?? "The server sent a subscription status this version cannot read.";
|
|
93
|
+
return null;
|
|
94
|
+
} catch (err) {
|
|
95
|
+
lastError = err.message;
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
lastError: () => lastError
|
|
100
|
+
});
|
|
101
|
+
} finally {
|
|
102
|
+
await client.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function askYes(text) {
|
|
106
|
+
const { createInterface } = await import("node:readline/promises");
|
|
107
|
+
process.stderr.write(`${text}\n`);
|
|
108
|
+
const prompt = createInterface({
|
|
109
|
+
input: process.stdin,
|
|
110
|
+
output: process.stderr
|
|
111
|
+
});
|
|
112
|
+
try {
|
|
113
|
+
return (await prompt.question("Type yes to continue: ")).trim().toLowerCase() === "yes";
|
|
114
|
+
} finally {
|
|
115
|
+
prompt.close();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function fail(err) {
|
|
119
|
+
console.error(err.message);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
function registerSubscriptionCommands(program, command) {
|
|
123
|
+
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) => {
|
|
124
|
+
try {
|
|
125
|
+
const { runSubscriptionTopup } = await Promise.resolve().then(() => require("./topup--nWtDnWP.cjs"));
|
|
126
|
+
await runSubscriptionTopup(opts);
|
|
127
|
+
} catch (err) {
|
|
128
|
+
fail(err);
|
|
129
|
+
}
|
|
130
|
+
})).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) => {
|
|
131
|
+
try {
|
|
132
|
+
const { assertDays, fetchCiaUsdPrice } = await Promise.resolve().then(() => require("./quote-B9sYNOiv.cjs"));
|
|
133
|
+
const { assertConfirmable, executeBuy, formatBuyResult } = await Promise.resolve().then(() => require("./buy-97M6dtEu.cjs"));
|
|
134
|
+
const days = Number(opts.days);
|
|
135
|
+
assertDays(days);
|
|
136
|
+
assertConfirmable({
|
|
137
|
+
stdinIsTTY: process.stdin.isTTY === true,
|
|
138
|
+
yes: opts.yes === true
|
|
139
|
+
});
|
|
140
|
+
const { assertWalletKeyNotPublic, getWalletAccount } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
141
|
+
const account = await getWalletAccount();
|
|
142
|
+
assertWalletKeyNotPublic(account);
|
|
143
|
+
const result = await withStatusReader((reader) => executeBuy({
|
|
144
|
+
account,
|
|
145
|
+
days,
|
|
146
|
+
readStatus: () => reader.read(),
|
|
147
|
+
fetchPrice: () => fetchCiaUsdPrice(),
|
|
148
|
+
confirm: async (text) => {
|
|
149
|
+
if (opts.yes !== true) return askYes(text);
|
|
150
|
+
process.stderr.write(`${text}\nConfirmed by --yes.\n`);
|
|
151
|
+
return true;
|
|
152
|
+
},
|
|
153
|
+
log: (line) => process.stderr.write(`${line}\n`)
|
|
154
|
+
}));
|
|
155
|
+
console.log(opts.json ? JSON.stringify(result, null, 2) : formatBuyResult(result));
|
|
156
|
+
} catch (err) {
|
|
157
|
+
fail(err);
|
|
158
|
+
}
|
|
159
|
+
})).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) => {
|
|
160
|
+
try {
|
|
161
|
+
const { formatSubscriptionStatus } = await Promise.resolve().then(() => require("./subscription-status-9tMfD90J.cjs")).then((n) => n.subscription_status_exports);
|
|
162
|
+
await withStatusReader(async (reader) => {
|
|
163
|
+
const facts = await reader.read();
|
|
164
|
+
if (!facts) throw new Error(`Subscription status unavailable: ${reader.lastError() ?? "no answer"}`);
|
|
165
|
+
console.log(opts.json ? JSON.stringify(facts, null, 2) : formatSubscriptionStatus(facts));
|
|
166
|
+
});
|
|
167
|
+
} catch (err) {
|
|
168
|
+
fail(err);
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
50
173
|
//#region src/cli.ts
|
|
51
174
|
const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
52
175
|
const installerPath = node_path.default.resolve(__dirname$1, "..", "bin", "install.cjs");
|
|
@@ -93,7 +216,7 @@ function runInstaller(flag) {
|
|
|
93
216
|
async function withGraphMcpClient(name, fn) {
|
|
94
217
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
95
218
|
const config = await loadConfig();
|
|
96
|
-
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-
|
|
219
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
97
220
|
const { toGraphMcpEndpointError } = await Promise.resolve().then(() => require("./transport-error-nSrFW47U.cjs"));
|
|
98
221
|
const endpoint = resolveGraphMcpEndpoint(config);
|
|
99
222
|
const paymentFetch = await createConfiguredGraphMcpFetch(config);
|
|
@@ -120,21 +243,21 @@ async function withGraphMcpClient(name, fn) {
|
|
|
120
243
|
}
|
|
121
244
|
async function printNetworkCapabilities(opts) {
|
|
122
245
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
123
|
-
const { fetchNetworkCapabilities, formatNetworkCapabilities } = await Promise.resolve().then(() => require("./capabilities-
|
|
246
|
+
const { fetchNetworkCapabilities, formatNetworkCapabilities } = await Promise.resolve().then(() => require("./capabilities-Ds3320iS.cjs")).then((n) => n.capabilities_exports);
|
|
124
247
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
125
248
|
if (opts.json) console.log(JSON.stringify(document, null, 2));
|
|
126
249
|
else console.log(formatNetworkCapabilities(document));
|
|
127
250
|
}
|
|
128
251
|
async function printNetworkOverview(opts) {
|
|
129
252
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
130
|
-
const { fetchNetworkCapabilities, formatNetworkOverview } = await Promise.resolve().then(() => require("./capabilities-
|
|
253
|
+
const { fetchNetworkCapabilities, formatNetworkOverview } = await Promise.resolve().then(() => require("./capabilities-Ds3320iS.cjs")).then((n) => n.capabilities_exports);
|
|
131
254
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
132
255
|
if (opts.json) console.log(JSON.stringify(document, null, 2));
|
|
133
256
|
else console.log(formatNetworkOverview(document));
|
|
134
257
|
}
|
|
135
258
|
async function printNetworkCapability(name, opts) {
|
|
136
259
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
137
|
-
const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await Promise.resolve().then(() => require("./capabilities-
|
|
260
|
+
const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await Promise.resolve().then(() => require("./capabilities-Ds3320iS.cjs")).then((n) => n.capabilities_exports);
|
|
138
261
|
const document = await fetchNetworkCapabilities(await loadConfig());
|
|
139
262
|
const network = findNetworkCapability(document, name);
|
|
140
263
|
if (!network) {
|
|
@@ -151,8 +274,8 @@ async function printNetworkCapability(name, opts) {
|
|
|
151
274
|
*/
|
|
152
275
|
async function printNetworkSchema(name, opts) {
|
|
153
276
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
154
|
-
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-
|
|
155
|
-
const { formatGraphSchemaText, getGraphSchema } = await Promise.resolve().then(() => require("./graph-schema-
|
|
277
|
+
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
278
|
+
const { formatGraphSchemaText, getGraphSchema } = await Promise.resolve().then(() => require("./graph-schema-BGbJumCY.cjs")).then((n) => n.graph_schema_exports);
|
|
156
279
|
const config = await loadConfig();
|
|
157
280
|
const schema = await getGraphSchema({
|
|
158
281
|
network: name,
|
|
@@ -165,11 +288,11 @@ async function printNetworkSchema(name, opts) {
|
|
|
165
288
|
function addAmlAddressRiskCommand(parent, networksCommand) {
|
|
166
289
|
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 commander.Option("--tool-version <version>", "Internal alias for the AML tool version").hideHelp()).action(async (opts) => {
|
|
167
290
|
try {
|
|
168
|
-
const { resolveAmlAddressRiskVersion } = await Promise.resolve().then(() => require("./public-tools-
|
|
291
|
+
const { resolveAmlAddressRiskVersion } = await Promise.resolve().then(() => require("./public-tools-Bl_l_rKK.cjs"));
|
|
169
292
|
const requestedVersion = opts.toolVersion ?? opts.version;
|
|
170
293
|
resolveAmlAddressRiskVersion(requestedVersion);
|
|
171
294
|
await withGraphMcpClient("chain-insights-cli-aml-address-risk", async (client) => {
|
|
172
|
-
const { runAmlAddressRisk } = await Promise.resolve().then(() => require("./public-tools-
|
|
295
|
+
const { runAmlAddressRisk } = await Promise.resolve().then(() => require("./public-tools-Bl_l_rKK.cjs"));
|
|
173
296
|
const result = await runAmlAddressRisk(client, {
|
|
174
297
|
address: opts.address,
|
|
175
298
|
network: opts.network,
|
|
@@ -364,7 +487,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
364
487
|
})).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) => {
|
|
365
488
|
if (key === "walletPrivateKey") {
|
|
366
489
|
try {
|
|
367
|
-
const { setWalletPrivateKey } = await Promise.resolve().then(() => require("./wallet-
|
|
490
|
+
const { setWalletPrivateKey } = await Promise.resolve().then(() => require("./wallet-CgIAfdxL.cjs")).then((n) => n.wallet_exports);
|
|
368
491
|
const address = await setWalletPrivateKey(value);
|
|
369
492
|
console.log("Wallet private key encrypted and stored in ~/.chain-insights/wallet.json");
|
|
370
493
|
console.log(`Wallet address: ${address}`);
|
|
@@ -388,12 +511,13 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
388
511
|
const displayed = key.toLowerCase().includes("token") ? "[redacted]" : coerced;
|
|
389
512
|
console.log(`Set ${key} = ${displayed}`);
|
|
390
513
|
}));
|
|
391
|
-
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(createCliCommand("create").description("Generate a new local Base payment wallet").action(async () => {
|
|
514
|
+
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) => {
|
|
392
515
|
try {
|
|
393
|
-
const { isWalletConfigured, setWalletPrivateKey, walletPath } = await Promise.resolve().then(() => require("./wallet-
|
|
516
|
+
const { assertStoredWalletReplaceable, isWalletConfigured, replacePublicWallet, setWalletPrivateKey, storedWalletKeyIsPublic, walletPath } = await Promise.resolve().then(() => require("./wallet-CgIAfdxL.cjs")).then((n) => n.wallet_exports);
|
|
394
517
|
const { createInterface } = await import("node:readline/promises");
|
|
395
518
|
const { formatWalletBackupWarning, generateWalletPrivateKey, isWalletBackupConfirmed } = await Promise.resolve().then(() => require("./create-DdggkF04.cjs")).then((n) => n.create_exports);
|
|
396
|
-
if (
|
|
519
|
+
if (opts.replace === true) await assertStoredWalletReplaceable();
|
|
520
|
+
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.");
|
|
397
521
|
const privateKey = generateWalletPrivateKey();
|
|
398
522
|
const color = process.stderr.isTTY === true && process.env["NO_COLOR"] === void 0;
|
|
399
523
|
process.stderr.write(`${formatWalletBackupWarning(privateKey, { color })}\n`);
|
|
@@ -409,7 +533,8 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
409
533
|
}
|
|
410
534
|
process.stderr.write("\n");
|
|
411
535
|
if (!isWalletBackupConfirmed(answer)) throw new Error("Wallet creation cancelled. The wallet was not saved.");
|
|
412
|
-
const address = await setWalletPrivateKey(privateKey);
|
|
536
|
+
const address = opts.replace === true ? await replacePublicWallet(privateKey) : await setWalletPrivateKey(privateKey);
|
|
537
|
+
if (opts.replace === true) console.log("The old wallet file is backed up next to ~/.chain-insights/wallet.json");
|
|
413
538
|
console.log(`Wallet created: ${address}`);
|
|
414
539
|
console.log(`Encrypted local copy: ${walletPath()}`);
|
|
415
540
|
console.log("Next: cia wallet ready");
|
|
@@ -419,7 +544,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
419
544
|
}
|
|
420
545
|
})).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) => {
|
|
421
546
|
try {
|
|
422
|
-
const { setWalletPrivateKey, isWalletConfigured } = await Promise.resolve().then(() => require("./wallet-
|
|
547
|
+
const { setWalletPrivateKey, isWalletConfigured } = await Promise.resolve().then(() => require("./wallet-CgIAfdxL.cjs")).then((n) => n.wallet_exports);
|
|
423
548
|
const replacing = opts.force === true && await isWalletConfigured();
|
|
424
549
|
const address = await setWalletPrivateKey(privateKey, { force: opts.force });
|
|
425
550
|
if (replacing) console.log("Previous wallet key backed up next to ~/.chain-insights/wallet.json");
|
|
@@ -433,7 +558,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
433
558
|
}
|
|
434
559
|
})).addCommand(createCliCommand("address").description("Print the local payment wallet address").action(async () => {
|
|
435
560
|
try {
|
|
436
|
-
const { getWalletAccount } = await Promise.resolve().then(() => require("./tools-
|
|
561
|
+
const { getWalletAccount } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
437
562
|
const account = await getWalletAccount();
|
|
438
563
|
console.log(account.address);
|
|
439
564
|
} catch (err) {
|
|
@@ -442,7 +567,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
442
567
|
}
|
|
443
568
|
})).addCommand(createCliCommand("balance").description("Show the local payment wallet Base USDC balance").action(async () => {
|
|
444
569
|
try {
|
|
445
|
-
const { getWalletBalanceText } = await Promise.resolve().then(() => require("./tools-
|
|
570
|
+
const { getWalletBalanceText } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
446
571
|
console.log(await getWalletBalanceText());
|
|
447
572
|
} catch (err) {
|
|
448
573
|
console.error(err.message);
|
|
@@ -450,7 +575,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
450
575
|
}
|
|
451
576
|
})).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 commander.Option("--no-approve", "Deprecated alias for --check-only").hideHelp()).option("--payment-usdc <amount>", "USDC setup cap to prepare for paid calls", "1").addOption(new commander.Option("--approval-usdc <amount>", "Deprecated alias for --payment-usdc").hideHelp()).option("--json", "Print machine-readable readiness metadata").action(async (opts) => {
|
|
452
577
|
try {
|
|
453
|
-
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await Promise.resolve().then(() => require("./tools-
|
|
578
|
+
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
454
579
|
const result = await prepareWalletForPaidCalls({
|
|
455
580
|
minimumApprovalUnits: parsePaymentApprovalUnits(opts.paymentUsdc ?? opts.approvalUsdc ?? "1"),
|
|
456
581
|
approve: opts.checkOnly ? false : opts.approve !== false
|
|
@@ -466,9 +591,10 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
466
591
|
}
|
|
467
592
|
})).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) => {
|
|
468
593
|
try {
|
|
469
|
-
const { buildTopupInfo, getWalletAccount } = await Promise.resolve().then(() => require("./tools-
|
|
470
|
-
const { startTopupServer } = await Promise.resolve().then(() => require("./topup-server-
|
|
594
|
+
const { assertWalletKeyNotPublic, buildTopupInfo, getWalletAccount } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
595
|
+
const { startTopupServer } = await Promise.resolve().then(() => require("./topup-server-BkGM8P99.cjs")).then((n) => n.topup_server_exports);
|
|
471
596
|
const account = await getWalletAccount();
|
|
597
|
+
assertWalletKeyNotPublic(account);
|
|
472
598
|
const url = await startTopupServer(account);
|
|
473
599
|
const info = buildTopupInfo(account.address, url);
|
|
474
600
|
if (opts.json) console.log(JSON.stringify(info, null, 2));
|
|
@@ -488,6 +614,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
488
614
|
process.exit(1);
|
|
489
615
|
}
|
|
490
616
|
}));
|
|
617
|
+
registerSubscriptionCommands(program, createCliCommand);
|
|
491
618
|
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) => {
|
|
492
619
|
try {
|
|
493
620
|
await printNetworkCapabilities(opts);
|
|
@@ -497,11 +624,11 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
497
624
|
}
|
|
498
625
|
})).addCommand(createCliCommand("tools").description("List the remote GraphRAG MCP tools (cached for 24 hours)").option("--refresh", "Force refresh schema cache").action(async (opts) => {
|
|
499
626
|
try {
|
|
500
|
-
const { loadSchema, saveSchema } = await Promise.resolve().then(() => require("./schema-cache-
|
|
627
|
+
const { loadSchema, saveSchema } = await Promise.resolve().then(() => require("./schema-cache-C7v9ml6S.cjs"));
|
|
501
628
|
const { formatToolsTable } = await Promise.resolve().then(() => require("./format-DfhRQq4L.cjs"));
|
|
502
629
|
const { visibleRemoteTools } = await Promise.resolve().then(() => require("./tool-visibility-DvKqmHo3.cjs")).then((n) => n.tool_visibility_exports);
|
|
503
630
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-BxtMoo9c.cjs")).then((n) => n.config_exports);
|
|
504
|
-
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-
|
|
631
|
+
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
505
632
|
const config = await loadConfig();
|
|
506
633
|
const graphMcpEndpoint = resolveGraphMcpEndpoint(config);
|
|
507
634
|
let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint);
|
|
@@ -522,7 +649,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
522
649
|
}
|
|
523
650
|
}
|
|
524
651
|
console.log(formatToolsTable(visibleRemoteTools(tools)));
|
|
525
|
-
const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await Promise.resolve().then(() => require("./dex-tool-
|
|
652
|
+
const { META_DEX_LOOKUP_DESCRIPTION, META_DEX_LOOKUP_TITLE, META_DEX_LOOKUP_TOOL } = await Promise.resolve().then(() => require("./dex-tool-DLWnff1n.cjs")).then((n) => n.dex_tool_exports);
|
|
526
653
|
console.log("");
|
|
527
654
|
console.log(formatToolsTable([{
|
|
528
655
|
name: META_DEX_LOOKUP_TOOL,
|
|
@@ -540,7 +667,7 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
540
667
|
assertPublicMcpToolName(tool);
|
|
541
668
|
validatePublicMcpToolArguments(tool, args);
|
|
542
669
|
if (tool === "wallet_balance") {
|
|
543
|
-
const { getWalletBalanceText } = await Promise.resolve().then(() => require("./tools-
|
|
670
|
+
const { getWalletBalanceText } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
544
671
|
console.log(await getWalletBalanceText());
|
|
545
672
|
return;
|
|
546
673
|
}
|
|
@@ -556,8 +683,8 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
556
683
|
return;
|
|
557
684
|
}
|
|
558
685
|
if (tool === "meta_dex_lookup") {
|
|
559
|
-
const { handleMetaDexLookup } = await Promise.resolve().then(() => require("./dex-tool-
|
|
560
|
-
const { loadRegistry } = await Promise.resolve().then(() => require("./dex-registry-
|
|
686
|
+
const { handleMetaDexLookup } = await Promise.resolve().then(() => require("./dex-tool-DLWnff1n.cjs")).then((n) => n.dex_tool_exports);
|
|
687
|
+
const { loadRegistry } = await Promise.resolve().then(() => require("./dex-registry-Chs79Ukc.cjs")).then((n) => n.dex_registry_exports);
|
|
561
688
|
const { metaDexLookupArgs } = await Promise.resolve().then(() => require("./call-args-C8Gp5gco.cjs"));
|
|
562
689
|
const result = await withGraphMcpClient("chain-insights-cli-dex-lookup", (client) => handleMetaDexLookup(metaDexLookupArgs(args), {
|
|
563
690
|
loadRegistry: (network) => loadRegistry(network),
|
|
@@ -590,27 +717,32 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
|
|
|
590
717
|
} catch (err) {
|
|
591
718
|
const { isMissingUsageStatusToolError, primitiveBackendUsageStatus, usageStatusText } = await Promise.resolve().then(() => require("./usage-status-DonwoLR3.cjs")).then((n) => n.usage_status_exports);
|
|
592
719
|
if (!isMissingUsageStatusToolError(err)) throw err;
|
|
593
|
-
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-
|
|
720
|
+
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
594
721
|
console.log(usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config))));
|
|
595
722
|
}
|
|
596
723
|
return;
|
|
597
724
|
}
|
|
598
725
|
if (tool === "meta_subscription_status") {
|
|
599
726
|
try {
|
|
600
|
-
const {
|
|
601
|
-
const
|
|
727
|
+
const { subscriptionStatusArguments, subscriptionStatusNeedsWallet } = await Promise.resolve().then(() => require("./subscription-status-9tMfD90J.cjs")).then((n) => n.subscription_status_exports);
|
|
728
|
+
const remote = (await client.listTools()).tools.find((t) => t.name === "subscription_status");
|
|
729
|
+
let wallet = null;
|
|
730
|
+
if (subscriptionStatusNeedsWallet(remote)) {
|
|
731
|
+
const { getWalletAccount } = await Promise.resolve().then(() => require("./tools-Cmnq7yip.cjs")).then((n) => n.tools_exports);
|
|
732
|
+
wallet = (await getWalletAccount()).address;
|
|
733
|
+
}
|
|
602
734
|
const result = await client.callTool({
|
|
603
735
|
name: "subscription_status",
|
|
604
|
-
arguments:
|
|
736
|
+
arguments: subscriptionStatusArguments(remote, wallet)
|
|
605
737
|
});
|
|
606
738
|
require_print_result.printMcpTextContent(result, {
|
|
607
739
|
tool,
|
|
608
740
|
json: opts.json
|
|
609
741
|
});
|
|
610
742
|
} catch (err) {
|
|
611
|
-
const { isMissingSubscriptionStatusToolError, unavailableSubscriptionStatus, subscriptionStatusText } = await Promise.resolve().then(() => require("./subscription-status-
|
|
743
|
+
const { isMissingSubscriptionStatusToolError, unavailableSubscriptionStatus, subscriptionStatusText } = await Promise.resolve().then(() => require("./subscription-status-9tMfD90J.cjs")).then((n) => n.subscription_status_exports);
|
|
612
744
|
if (!isMissingSubscriptionStatusToolError(err)) throw err;
|
|
613
|
-
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-
|
|
745
|
+
const { resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-C9uwHnBS.cjs")).then((n) => n.client_exports);
|
|
614
746
|
console.log(subscriptionStatusText(unavailableSubscriptionStatus(resolveGraphMcpEndpoint(config), `subscription_status failed: ${err.message}`)));
|
|
615
747
|
}
|
|
616
748
|
return;
|