@alchemy/cli 0.11.1 → 0.13.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 +2 -2
- package/dist/{auth-AU7LPEQL.js → auth-YB6AALZO.js} +2 -2
- package/dist/{chunk-ILPOKA4Y.js → chunk-5DR7BHUX.js} +1 -1
- package/dist/{chunk-QWLBZTG5.js → chunk-DWNXGFON.js} +2 -5
- package/dist/{chunk-SRGDGXY5.js → chunk-OE6B6S2H.js} +1 -1
- package/dist/{chunk-OL5MEN62.js → chunk-PRSZJXA6.js} +1 -1
- package/dist/{chunk-CJDHJYLM.js → chunk-PYIVNQEI.js} +1 -1
- package/dist/index.js +48 -42
- package/dist/{interactive-NPBITOGO.js → interactive-6SOB4IYV.js} +3 -3
- package/dist/{onboarding-QOZOX4CZ.js → onboarding-TYRUMFUL.js} +2 -2
- package/dist/{policy-prompt-YU6L2VJZ.js → policy-prompt-LY6DMMT4.js} +2 -2
- package/dist/{resolve-WXXPXPCU.js → resolve-GELBKDTP.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,8 +118,8 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
|
|
|
118
118
|
|
|
119
119
|
| Command | What it does | Example |
|
|
120
120
|
|---|---|---|
|
|
121
|
-
| `wallet connect` |
|
|
122
|
-
| `wallet connect --mode local
|
|
121
|
+
| `wallet connect` | Connects a session wallet by default. Pass `--mode local` only when you explicitly need local keys. | `alchemy wallet connect` |
|
|
122
|
+
| `wallet connect --mode local` | Create new local EVM and Solana keys. | `alchemy wallet connect --mode local` |
|
|
123
123
|
| `wallet connect --mode local --import <path>` | Import an existing EVM private key from a file. | `alchemy wallet connect --mode local --import ./key.txt` |
|
|
124
124
|
| `wallet connect --mode session --instance-name <name>` | Connect a named session wallet instance. | `alchemy wallet connect --mode session --instance-name laptop` |
|
|
125
125
|
| `wallet status [--verify]` | Reports session, local EVM, local Solana, and the active signer. `--verify` reconciles the session with the backend. | `alchemy wallet status --verify` |
|
|
@@ -3,10 +3,10 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
|
3
3
|
import {
|
|
4
4
|
registerAuth,
|
|
5
5
|
selectAppAfterAuth
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5DR7BHUX.js";
|
|
7
7
|
import "./chunk-I6YQX7PF.js";
|
|
8
8
|
import "./chunk-RPSHRYCZ.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-PRSZJXA6.js";
|
|
10
10
|
import "./chunk-DXQAGBW6.js";
|
|
11
11
|
import "./chunk-LANOFNO6.js";
|
|
12
12
|
import "./chunk-5BEJA752.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
resolveAuthToken,
|
|
8
8
|
resolveWalletSession
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PRSZJXA6.js";
|
|
10
10
|
|
|
11
11
|
// src/lib/onboarding.ts
|
|
12
12
|
var SETUP_CAPABILITY_ORDER = [
|
|
@@ -69,10 +69,7 @@ function getSetupCapabilities(cfg) {
|
|
|
69
69
|
complete: hasLocalWallet || hasSessionWallet,
|
|
70
70
|
satisfiedBy: hasSessionWallet ? "wallet_session" : hasLocalWallet ? "local_wallet" : null,
|
|
71
71
|
missing: hasLocalWallet || hasSessionWallet ? [] : ["wallet signer"],
|
|
72
|
-
nextCommands: hasLocalWallet || hasSessionWallet ? [] : [
|
|
73
|
-
"alchemy wallet connect",
|
|
74
|
-
"alchemy wallet connect --mode local"
|
|
75
|
-
]
|
|
72
|
+
nextCommands: hasLocalWallet || hasSessionWallet ? [] : ["alchemy wallet connect"]
|
|
76
73
|
}),
|
|
77
74
|
x402: capabilityStatus({
|
|
78
75
|
complete: x402Ready,
|
|
@@ -1092,7 +1092,7 @@ var AdminClient = class _AdminClient {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
async updateNetworkAllowlist(id, networks) {
|
|
1094
1094
|
const resp = await this.request("PUT", `/v1/apps/${id}/networks`, {
|
|
1095
|
-
|
|
1095
|
+
networkAllowlist: networks
|
|
1096
1096
|
});
|
|
1097
1097
|
return resp.data;
|
|
1098
1098
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PYIVNQEI.js";
|
|
9
9
|
import {
|
|
10
10
|
registerAuth
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5DR7BHUX.js";
|
|
12
12
|
import {
|
|
13
13
|
openBrowser
|
|
14
14
|
} from "./chunk-I6YQX7PF.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getSetupStatus,
|
|
19
19
|
isSetupComplete,
|
|
20
20
|
shouldRunOnboarding
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-DWNXGFON.js";
|
|
22
22
|
import {
|
|
23
23
|
isInteractiveAllowed
|
|
24
24
|
} from "./chunk-RPSHRYCZ.js";
|
|
@@ -63,12 +63,12 @@ import {
|
|
|
63
63
|
updateSession,
|
|
64
64
|
validateNetwork,
|
|
65
65
|
walletNetworkToChain
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-PRSZJXA6.js";
|
|
67
67
|
import {
|
|
68
68
|
getAvailableUpdate,
|
|
69
69
|
getUpdateStatus,
|
|
70
70
|
printUpdateNotice
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-OE6B6S2H.js";
|
|
72
72
|
import {
|
|
73
73
|
bold,
|
|
74
74
|
brand,
|
|
@@ -581,8 +581,8 @@ function registerConfig(program2) {
|
|
|
581
581
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set evm-gas-policy-id <id>`."
|
|
582
582
|
);
|
|
583
583
|
}
|
|
584
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
585
|
-
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-
|
|
584
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-LY6DMMT4.js");
|
|
585
|
+
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-GELBKDTP.js");
|
|
586
586
|
const network = resolveNetwork2(program2);
|
|
587
587
|
await selectOrCreatePolicy2({
|
|
588
588
|
flavor: "sponsorship",
|
|
@@ -636,8 +636,8 @@ function registerConfig(program2) {
|
|
|
636
636
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set solana-fee-policy-id <id>`."
|
|
637
637
|
);
|
|
638
638
|
}
|
|
639
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
640
|
-
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-
|
|
639
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-LY6DMMT4.js");
|
|
640
|
+
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-GELBKDTP.js");
|
|
641
641
|
const network = resolveSolanaNetwork2(program2);
|
|
642
642
|
await selectOrCreatePolicy2({
|
|
643
643
|
flavor: "solana",
|
|
@@ -694,7 +694,7 @@ function registerConfig(program2) {
|
|
|
694
694
|
printJSON(toMap(cfg));
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
697
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-GELBKDTP.js");
|
|
698
698
|
const validToken = resolveAuthToken2(cfg);
|
|
699
699
|
const authStatus = cfg.auth_token ? validToken ? `${green("\u2713")} authenticated${cfg.auth_token_expires_at ? ` ${dim(`(expires ${cfg.auth_token_expires_at})`)}` : ""}` : `${yellow("\u25C6")} expired${cfg.auth_token_expires_at ? ` ${dim(`(${cfg.auth_token_expires_at})`)}` : ""}` : dim("(not set) \u2014 run 'alchemy auth' to log in");
|
|
700
700
|
const pairs = [
|
|
@@ -874,6 +874,21 @@ function matchesSearch(app, query) {
|
|
|
874
874
|
function appToTableRow(app) {
|
|
875
875
|
return [app.id, app.name, String(app.chainNetworks.length), app.createdAt];
|
|
876
876
|
}
|
|
877
|
+
function appToListJSON(app) {
|
|
878
|
+
return {
|
|
879
|
+
id: app.id,
|
|
880
|
+
name: app.name,
|
|
881
|
+
createdAt: app.createdAt,
|
|
882
|
+
networkCount: app.chainNetworks.length,
|
|
883
|
+
networks: app.chainNetworks.map((network) => ({
|
|
884
|
+
id: network.id,
|
|
885
|
+
name: network.name
|
|
886
|
+
}))
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function appToJSON(app, opts) {
|
|
890
|
+
return opts.full ? maskAppSecrets(app) : appToListJSON(app);
|
|
891
|
+
}
|
|
877
892
|
function handleDryRun(opts, action, payload, humanMsg) {
|
|
878
893
|
if (!opts.dryRun) return false;
|
|
879
894
|
if (isJSONMode()) {
|
|
@@ -885,7 +900,7 @@ function handleDryRun(opts, action, payload, humanMsg) {
|
|
|
885
900
|
}
|
|
886
901
|
function registerApps(program2) {
|
|
887
902
|
const cmd = program2.command("app").description("Manage Alchemy apps");
|
|
888
|
-
cmd.command("list").description("List all apps").option("--cursor <cursor>", "Pagination cursor").option("--limit <n>", "Max results per page", parseInt).option("--all", "Fetch all pages").option("--search <query>", "Search apps by name or id (client-side)").option("--id <appId>", "Filter by exact app id (client-side)").action(async (opts) => {
|
|
903
|
+
cmd.command("list").description("List all apps").option("--cursor <cursor>", "Pagination cursor").option("--limit <n>", "Max results per page", parseInt).option("--all", "Fetch all pages").option("--search <query>", "Search apps by name or id (client-side)").option("--id <appId>", "Filter by exact app id (client-side)").option("--full", "Return full sanitized app payload in JSON mode").action(async (opts) => {
|
|
889
904
|
try {
|
|
890
905
|
const admin = adminClientFromFlags(program2);
|
|
891
906
|
const fetchAll = Boolean(opts.all);
|
|
@@ -918,7 +933,7 @@ function registerApps(program2) {
|
|
|
918
933
|
const filteredApps = hasId ? result2.apps.filter((a) => a.id === idQuery) : hasSearch ? result2.apps.filter((a) => matchesSearch(a, searchQuery)) : result2.apps;
|
|
919
934
|
if (isJSONMode()) {
|
|
920
935
|
printJSON({
|
|
921
|
-
apps: filteredApps.map(
|
|
936
|
+
apps: filteredApps.map((app) => appToJSON(app, { full: opts.full })),
|
|
922
937
|
pageInfo: {
|
|
923
938
|
mode: fetchAll ? "all" : "search",
|
|
924
939
|
pages: result2.pages,
|
|
@@ -952,7 +967,10 @@ function registerApps(program2) {
|
|
|
952
967
|
() => admin.listApps({ cursor: opts.cursor, limit: opts.limit })
|
|
953
968
|
);
|
|
954
969
|
if (isJSONMode()) {
|
|
955
|
-
printJSON({
|
|
970
|
+
printJSON({
|
|
971
|
+
...result,
|
|
972
|
+
apps: result.apps.map((app) => appToJSON(app, { full: opts.full }))
|
|
973
|
+
});
|
|
956
974
|
return;
|
|
957
975
|
}
|
|
958
976
|
const interactivePagination = isInteractiveAllowed(program2) && !opts.all;
|
|
@@ -1043,7 +1061,7 @@ function registerApps(program2) {
|
|
|
1043
1061
|
const products = opts.products ? splitCommaList(opts.products) : void 0;
|
|
1044
1062
|
const payload = {
|
|
1045
1063
|
name: opts.name,
|
|
1046
|
-
networks,
|
|
1064
|
+
networkAllowlist: networks,
|
|
1047
1065
|
...opts.description && { description: opts.description },
|
|
1048
1066
|
...products && { products }
|
|
1049
1067
|
};
|
|
@@ -1134,7 +1152,12 @@ function registerApps(program2) {
|
|
|
1134
1152
|
cmd.command("networks <id>").description("Update app network allowlist").requiredOption("--networks <networks>", "Comma-separated network IDs").option("--dry-run", "Preview without executing").action(async (id, opts) => {
|
|
1135
1153
|
try {
|
|
1136
1154
|
const networks = splitCommaList(opts.networks);
|
|
1137
|
-
if (handleDryRun(
|
|
1155
|
+
if (handleDryRun(
|
|
1156
|
+
opts,
|
|
1157
|
+
"networks",
|
|
1158
|
+
{ id, networkAllowlist: networks },
|
|
1159
|
+
`Would update networks for app ${id}: ${networks.join(", ")}`
|
|
1160
|
+
)) return;
|
|
1138
1161
|
const admin = adminClientFromFlags(program2);
|
|
1139
1162
|
const app = await withSpinner(
|
|
1140
1163
|
"Updating networks\u2026",
|
|
@@ -2594,28 +2617,11 @@ async function runConnectFlow(program2, opts) {
|
|
|
2594
2617
|
}
|
|
2595
2618
|
mode = "session";
|
|
2596
2619
|
}
|
|
2597
|
-
if (importPath) {
|
|
2598
|
-
|
|
2599
|
-
throw errInvalidArgs("`--import` is only valid with `--mode local`.");
|
|
2600
|
-
}
|
|
2601
|
-
mode = "local";
|
|
2620
|
+
if (importPath && mode !== "local") {
|
|
2621
|
+
throw errInvalidArgs("`--import` is only valid with `--mode local`.");
|
|
2602
2622
|
}
|
|
2603
2623
|
if (!mode) {
|
|
2604
|
-
|
|
2605
|
-
mode = "session";
|
|
2606
|
-
} else {
|
|
2607
|
-
const choice = await promptSelect({
|
|
2608
|
-
message: "Choose a wallet to connect",
|
|
2609
|
-
options: [
|
|
2610
|
-
{ value: "session", label: "Session wallet", hint: "Recommended \u2014 Alchemy-managed, more secure" },
|
|
2611
|
-
{ value: "local", label: "Local wallet", hint: "Private key stored on this machine" }
|
|
2612
|
-
],
|
|
2613
|
-
initialValue: "session",
|
|
2614
|
-
cancelMessage: "Wallet connect cancelled."
|
|
2615
|
-
});
|
|
2616
|
-
if (choice === null) throw new WalletConnectInterruptedError();
|
|
2617
|
-
mode = choice;
|
|
2618
|
-
}
|
|
2624
|
+
mode = "session";
|
|
2619
2625
|
}
|
|
2620
2626
|
if (mode === "session") {
|
|
2621
2627
|
await runSessionConnect({
|
|
@@ -2757,7 +2763,7 @@ async function buildSessionSnapshot(program2, verify) {
|
|
|
2757
2763
|
}
|
|
2758
2764
|
function registerWallets(program2) {
|
|
2759
2765
|
const cmd = program2.command("wallet").description("Manage wallets");
|
|
2760
|
-
cmd.command("connect").description("Connect a wallet for onchain actions
|
|
2766
|
+
cmd.command("connect").description("Connect a session wallet for onchain actions").option("--mode <mode>", "session | local (default: session; local must be explicit)").option("--import <path>", "For --mode local: import an EVM key from file instead of creating both wallets").option("--instance-name <name>", "For --mode session: name this CLI instance").option("--force", "Replace the existing signer").action(async (opts) => {
|
|
2761
2767
|
try {
|
|
2762
2768
|
await runConnectFlow(program2, opts);
|
|
2763
2769
|
} catch (err) {
|
|
@@ -6434,7 +6440,7 @@ function buildAgentPrompt(program2) {
|
|
|
6434
6440
|
"evm approve",
|
|
6435
6441
|
"xchain bridge"
|
|
6436
6442
|
],
|
|
6437
|
-
notes: "`--signer local`
|
|
6443
|
+
notes: "Use only when you explicitly need a local private key. `--signer local` selects the local signer but still requires a local EVM key via env, flag, or saved config."
|
|
6438
6444
|
}
|
|
6439
6445
|
],
|
|
6440
6446
|
commands,
|
|
@@ -10390,7 +10396,7 @@ async function flushProcessOutput() {
|
|
|
10390
10396
|
}
|
|
10391
10397
|
program.name("alchemy").description(
|
|
10392
10398
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
10393
|
-
).version("0.
|
|
10399
|
+
).version("0.13.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
|
|
10394
10400
|
"-n, --network <network>",
|
|
10395
10401
|
"Target network for networked commands"
|
|
10396
10402
|
).option("--x402", "Use x402 wallet-based gateway auth").option(
|
|
@@ -10577,11 +10583,11 @@ ${styledLine}`;
|
|
|
10577
10583
|
"wallet"
|
|
10578
10584
|
];
|
|
10579
10585
|
if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
|
|
10580
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
10586
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-GELBKDTP.js");
|
|
10581
10587
|
const authToken = resolveAuthToken2(cfg);
|
|
10582
10588
|
const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
|
|
10583
10589
|
if (authToken && !hasApiKey) {
|
|
10584
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
10590
|
+
const { selectAppAfterAuth } = await import("./auth-YB6AALZO.js");
|
|
10585
10591
|
console.log("");
|
|
10586
10592
|
console.log(` No app selected. Please select an app to continue.`);
|
|
10587
10593
|
await selectAppAfterAuth(authToken);
|
|
@@ -10616,7 +10622,7 @@ ${styledLine}`;
|
|
|
10616
10622
|
if (isInteractiveAllowed(program)) {
|
|
10617
10623
|
let latestForInteractiveStartup = null;
|
|
10618
10624
|
if (shouldRunOnboarding(program, cfg)) {
|
|
10619
|
-
const { runOnboarding } = await import("./onboarding-
|
|
10625
|
+
const { runOnboarding } = await import("./onboarding-TYRUMFUL.js");
|
|
10620
10626
|
const latest = getAvailableUpdateOnce();
|
|
10621
10627
|
const completed = await runOnboarding(program, latest);
|
|
10622
10628
|
updateShownDuringInteractiveStartup = Boolean(latest);
|
|
@@ -10630,7 +10636,7 @@ ${styledLine}`;
|
|
|
10630
10636
|
latestForInteractiveStartup
|
|
10631
10637
|
);
|
|
10632
10638
|
}
|
|
10633
|
-
const { startREPL } = await import("./interactive-
|
|
10639
|
+
const { startREPL } = await import("./interactive-6SOB4IYV.js");
|
|
10634
10640
|
program.exitOverride();
|
|
10635
10641
|
program.configureOutput({
|
|
10636
10642
|
writeErr: () => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getSetupMethod
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DWNXGFON.js";
|
|
6
6
|
import "./chunk-RPSHRYCZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getRPCNetworkIds
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PRSZJXA6.js";
|
|
10
10
|
import {
|
|
11
11
|
getUpdateNoticeLines
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OE6B6S2H.js";
|
|
13
13
|
import {
|
|
14
14
|
bold,
|
|
15
15
|
brand,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getUpdateNoticeLines
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OE6B6S2H.js";
|
|
6
6
|
import {
|
|
7
7
|
bold,
|
|
8
8
|
brand,
|
|
@@ -51,7 +51,7 @@ async function runOnboarding(_program, latestUpdate = null) {
|
|
|
51
51
|
auth_token_expires_at: result.expiresAt
|
|
52
52
|
});
|
|
53
53
|
console.log(` ${green("\u2713")} Logged in successfully`);
|
|
54
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
54
|
+
const { selectAppAfterAuth } = await import("./auth-YB6AALZO.js");
|
|
55
55
|
await selectAppAfterAuth(result.token);
|
|
56
56
|
return true;
|
|
57
57
|
} catch (err) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-PYIVNQEI.js";
|
|
9
|
+
import "./chunk-PRSZJXA6.js";
|
|
10
10
|
import "./chunk-DXQAGBW6.js";
|
|
11
11
|
import "./chunk-LANOFNO6.js";
|
|
12
12
|
import "./chunk-5BEJA752.js";
|