@alchemy/cli 0.2.1 → 0.3.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/README.md +29 -9
- package/dist/{chunk-SDUCDSCZ.js → chunk-MF6DXNO7.js} +24 -4
- package/dist/{chunk-XP5KF4W2.js → chunk-UPQTWEPP.js} +204 -16
- package/dist/{chunk-HBRTTBCY.js → chunk-VYQ5V2ZR.js} +38 -1
- package/dist/index.js +784 -177
- package/dist/{interactive-L7N4HI7K.js → interactive-BFAXB5SN.js} +44 -10
- package/dist/{onboarding-YA32OJOT.js → onboarding-MUJF5QIE.js} +2 -2
- package/package.json +2 -1
|
@@ -3,7 +3,7 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
|
3
3
|
import {
|
|
4
4
|
getRPCNetworkIds,
|
|
5
5
|
getSetupMethod
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VYQ5V2ZR.js";
|
|
7
7
|
import {
|
|
8
8
|
bgRgb,
|
|
9
9
|
bold,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
rgb,
|
|
20
20
|
setBrandedHelpSuppressed,
|
|
21
21
|
setReplMode
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MF6DXNO7.js";
|
|
23
23
|
|
|
24
24
|
// src/commands/interactive.ts
|
|
25
25
|
import * as readline from "readline";
|
|
@@ -40,8 +40,7 @@ var COMMAND_NAMES = [
|
|
|
40
40
|
"bal",
|
|
41
41
|
"balance",
|
|
42
42
|
"block",
|
|
43
|
-
"chains",
|
|
44
|
-
"chains list",
|
|
43
|
+
"apps chains",
|
|
45
44
|
"trace",
|
|
46
45
|
"debug",
|
|
47
46
|
"transfers",
|
|
@@ -102,7 +101,11 @@ var COMMAND_NAMES = [
|
|
|
102
101
|
"tokens metadata",
|
|
103
102
|
"tokens allowance",
|
|
104
103
|
"tx",
|
|
104
|
+
"receipt",
|
|
105
|
+
"gas",
|
|
106
|
+
"logs",
|
|
105
107
|
"agent-prompt",
|
|
108
|
+
"completions",
|
|
106
109
|
"version",
|
|
107
110
|
"wallet",
|
|
108
111
|
"wallet generate",
|
|
@@ -339,12 +342,18 @@ async function startREPL(program, latestUpdate = null) {
|
|
|
339
342
|
});
|
|
340
343
|
};
|
|
341
344
|
stdin.on("keypress", onKeypress);
|
|
342
|
-
const
|
|
345
|
+
const restoreStdinState = () => {
|
|
343
346
|
stdin.resume();
|
|
344
347
|
stdin.ref?.();
|
|
345
348
|
if (stdin.isTTY && typeof stdin.setRawMode === "function") {
|
|
346
|
-
|
|
349
|
+
try {
|
|
350
|
+
stdin.setRawMode(true);
|
|
351
|
+
} catch {
|
|
352
|
+
}
|
|
347
353
|
}
|
|
354
|
+
};
|
|
355
|
+
const prompt = () => {
|
|
356
|
+
restoreStdinState();
|
|
348
357
|
rl.prompt();
|
|
349
358
|
};
|
|
350
359
|
const printPostOutputSpacing = () => {
|
|
@@ -369,13 +378,36 @@ async function startREPL(program, latestUpdate = null) {
|
|
|
369
378
|
console.log("");
|
|
370
379
|
}
|
|
371
380
|
const words = trimmed.split(/\s+/);
|
|
372
|
-
|
|
373
|
-
|
|
381
|
+
const isHelpRequest = words[0] === "help" || words.includes("--help") || words.includes("-h");
|
|
382
|
+
if (isHelpRequest) {
|
|
383
|
+
const target = words[0] === "help" ? [...words.slice(1).filter((w) => w !== "--help" && w !== "-h"), "--help"] : [...words.filter((w) => w !== "--help" && w !== "-h"), "--help"];
|
|
374
384
|
try {
|
|
375
|
-
|
|
376
|
-
|
|
385
|
+
let helpText = "";
|
|
386
|
+
const origWrite = stdout.write.bind(stdout);
|
|
387
|
+
stdout.write = ((chunk) => {
|
|
388
|
+
helpText += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
389
|
+
return true;
|
|
377
390
|
});
|
|
391
|
+
try {
|
|
392
|
+
await program.parseAsync(["node", "alchemy", ...target]);
|
|
393
|
+
} catch {
|
|
394
|
+
} finally {
|
|
395
|
+
stdout.write = origWrite;
|
|
396
|
+
}
|
|
397
|
+
if (helpText) {
|
|
398
|
+
const ansiOpt = "(?:\\x1b\\[[0-9;]*m)*";
|
|
399
|
+
const alchemyPrefixRe = new RegExp(
|
|
400
|
+
`(^|Usage: | )${ansiOpt}alchemy${ansiOpt} `,
|
|
401
|
+
"gm"
|
|
402
|
+
);
|
|
403
|
+
const stripped = helpText.replace(alchemyPrefixRe, "$1").replace(/^.*Interactive mode with guided setup.*\n?/gm, "");
|
|
404
|
+
await runWithIndentedOutput(async () => {
|
|
405
|
+
process.stdout.write(stripped);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
378
408
|
} catch {
|
|
409
|
+
} finally {
|
|
410
|
+
restoreStdinState();
|
|
379
411
|
}
|
|
380
412
|
printPostOutputSpacing();
|
|
381
413
|
prompt();
|
|
@@ -391,6 +423,8 @@ async function startREPL(program, latestUpdate = null) {
|
|
|
391
423
|
await program.parseAsync(["node", "alchemy", ...words]);
|
|
392
424
|
});
|
|
393
425
|
} catch {
|
|
426
|
+
} finally {
|
|
427
|
+
restoreStdinState();
|
|
394
428
|
}
|
|
395
429
|
printPostOutputSpacing();
|
|
396
430
|
prompt();
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
generateAndPersistWallet,
|
|
6
6
|
importAndPersistWallet,
|
|
7
7
|
selectOrCreateApp
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UPQTWEPP.js";
|
|
9
9
|
import {
|
|
10
10
|
bold,
|
|
11
11
|
brand,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
promptSelect,
|
|
20
20
|
promptText,
|
|
21
21
|
save
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MF6DXNO7.js";
|
|
23
23
|
|
|
24
24
|
// src/commands/onboarding.ts
|
|
25
25
|
function printNextSteps(method) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Alchemy CLI — interact with blockchain data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@alchemy/x402": "^0.4.0",
|
|
33
|
+
"@noble/hashes": "^2.0.1",
|
|
33
34
|
"cli-table3": "^0.6.5",
|
|
34
35
|
"commander": "^14.0.3",
|
|
35
36
|
"zod": "^4.3.6"
|