@alchemy/cli 0.6.2 → 0.7.0-alpha.5

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.
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
- getRPCNetworkIds,
5
4
  getSetupMethod
6
- } from "./chunk-T5Z2GJUX.js";
7
- import "./chunk-KDMIWPZH.js";
8
- import "./chunk-ATX65U7J.js";
9
- import "./chunk-JQRGILIS.js";
5
+ } from "./chunk-MUT4TFQ5.js";
6
+ import "./chunk-HYCRHNPX.js";
7
+ import {
8
+ getRPCNetworkIds
9
+ } from "./chunk-PKAN5FKD.js";
10
10
  import {
11
11
  getUpdateNoticeLines
12
- } from "./chunk-TK3HZ5UT.js";
12
+ } from "./chunk-5MXODL63.js";
13
13
  import {
14
14
  bold,
15
15
  brand,
@@ -17,18 +17,18 @@ import {
17
17
  dim,
18
18
  green,
19
19
  setBrandedHelpSuppressed
20
- } from "./chunk-NBDWF4ZQ.js";
20
+ } from "./chunk-A6L3WCJN.js";
21
21
  import {
22
22
  configDir,
23
23
  load
24
- } from "./chunk-BAAQ7ELR.js";
24
+ } from "./chunk-B3R6PRAL.js";
25
25
  import {
26
26
  bgRgb,
27
27
  isJSONMode,
28
28
  noColor,
29
29
  rgb,
30
30
  setReplMode
31
- } from "./chunk-56ZVYB4G.js";
31
+ } from "./chunk-QEDAULQ2.js";
32
32
 
33
33
  // src/commands/interactive.ts
34
34
  import * as readline from "readline";
@@ -36,59 +36,57 @@ import { stdin, stdout, stderr } from "process";
36
36
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
37
37
  import { join, dirname } from "path";
38
38
  var COMMAND_NAMES = [
39
- "apps",
40
- "apps list",
41
- "apps get",
42
- "apps create",
43
- "apps delete",
44
- "apps update",
45
- "apps networks",
46
- "apps address-allowlist",
47
- "apps origin-allowlist",
48
- "apps ip-allowlist",
49
- "bal",
50
- "balance",
39
+ "app",
40
+ "app list",
41
+ "app get",
42
+ "app create",
43
+ "app delete",
44
+ "app update",
45
+ "app networks",
46
+ "app address-allowlist",
47
+ "app origin-allowlist",
48
+ "app ip-allowlist",
51
49
  "block",
52
- "apps chains",
50
+ "app chains",
53
51
  "trace",
54
52
  "debug",
55
- "transfers",
56
- "prices",
57
- "prices symbol",
58
- "prices address",
59
- "prices historical",
60
- "portfolio",
61
- "portfolio tokens",
62
- "portfolio token-balances",
63
- "portfolio nfts",
64
- "portfolio nft-contracts",
65
- "portfolio transactions",
53
+ "data",
54
+ "data balance",
55
+ "data tokens",
56
+ "data tokens balances",
57
+ "data tokens metadata",
58
+ "data tokens allowance",
59
+ "data nfts",
60
+ "data nfts metadata",
61
+ "data nfts contract",
62
+ "data history",
63
+ "data price",
64
+ "data price symbol",
65
+ "data price address",
66
+ "data price historical",
67
+ "data portfolio",
68
+ "data portfolio tokens",
69
+ "data portfolio token-balances",
70
+ "data portfolio nfts",
71
+ "data portfolio nft-contracts",
72
+ "data portfolio transactions",
66
73
  "simulate",
67
74
  "simulate asset-changes",
68
75
  "simulate execution",
69
76
  "simulate asset-changes-bundle",
70
77
  "simulate execution-bundle",
71
- "webhooks",
72
- "webhooks list",
73
- "webhooks create",
74
- "webhooks update",
75
- "webhooks delete",
76
- "webhooks addresses",
77
- "webhooks nft-filters",
78
- "bundler",
79
- "bundler send-user-operation",
80
- "bundler estimate-user-operation-gas",
81
- "bundler get-user-operation-receipt",
82
- "gas-manager",
83
- "gas-manager request-gas-and-paymaster",
84
- "gas-manager request-paymaster-token-quote",
78
+ "webhook",
79
+ "webhook list",
80
+ "webhook create",
81
+ "webhook update",
82
+ "webhook delete",
83
+ "webhook addresses",
84
+ "webhook nft-filters",
85
85
  "solana",
86
86
  "solana rpc",
87
87
  "solana das",
88
88
  "config",
89
89
  "config set",
90
- "config set api-key",
91
- "config set access-key",
92
90
  "config set app",
93
91
  "config set network",
94
92
  "config set verbose",
@@ -96,19 +94,13 @@ var COMMAND_NAMES = [
96
94
  "config set x402",
97
95
  "config get",
98
96
  "config list",
97
+ "config status",
98
+ "config reset",
99
99
  "help",
100
100
  "update-check",
101
101
  "network",
102
102
  "network list",
103
- "nfts",
104
- "nfts metadata",
105
- "nfts contract",
106
103
  "rpc",
107
- "setup",
108
- "setup status",
109
- "tokens",
110
- "tokens metadata",
111
- "tokens allowance",
112
104
  "tx",
113
105
  "receipt",
114
106
  "gas",
@@ -117,9 +109,12 @@ var COMMAND_NAMES = [
117
109
  "completions",
118
110
  "version",
119
111
  "wallet",
120
- "wallet generate",
121
- "wallet import",
122
- "wallet address"
112
+ "wallet connect",
113
+ "wallet status",
114
+ "wallet address",
115
+ "wallet qr",
116
+ "wallet use",
117
+ "wallet disconnect"
123
118
  ];
124
119
  var NETWORK_NAMES = getRPCNetworkIds();
125
120
  var REPL_HISTORY_MAX = 100;
@@ -128,7 +123,7 @@ function formatSetupMethodLabel() {
128
123
  if (method === "api_key") return "API key";
129
124
  if (method === "access_key_app") return "Access key + app";
130
125
  if (method === "x402_wallet") return "SIWx wallet";
131
- if (method === "auth_token") return "Browser login + app";
126
+ if (method === "auth_token") return "Auth token";
132
127
  return "Not configured";
133
128
  }
134
129
  function replHistoryPath() {
@@ -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-TK3HZ5UT.js";
5
+ } from "./chunk-5MXODL63.js";
6
6
  import {
7
7
  bold,
8
8
  brand,
@@ -10,9 +10,12 @@ import {
10
10
  dim,
11
11
  green,
12
12
  promptText
13
- } from "./chunk-NBDWF4ZQ.js";
14
- import "./chunk-BAAQ7ELR.js";
15
- import "./chunk-56ZVYB4G.js";
13
+ } from "./chunk-A6L3WCJN.js";
14
+ import {
15
+ load,
16
+ save
17
+ } from "./chunk-B3R6PRAL.js";
18
+ import "./chunk-QEDAULQ2.js";
16
19
 
17
20
  // src/commands/onboarding.ts
18
21
  async function runOnboarding(_program, latestUpdate = null) {
@@ -35,20 +38,20 @@ async function runOnboarding(_program, latestUpdate = null) {
35
38
  if (answer === null) {
36
39
  return false;
37
40
  }
38
- const { performBrowserLogin, prepareBrowserLogin } = await import("./auth-S4DTOWW3.js");
39
- const prepared = prepareBrowserLogin();
41
+ const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-JGON2JU6.js");
40
42
  console.log(` Opening browser to log in...`);
41
- console.log(` ${dim(prepared.authorizeUrl)}`);
43
+ console.log(` ${dim(getLoginUrl(AUTH_PORT))}`);
42
44
  console.log(` ${dim("Waiting for authentication...")}`);
43
45
  try {
44
- const result = await performBrowserLogin(prepared);
45
- const { saveCredentials } = await import("./credential-storage-T6FFW7DG.js");
46
- await saveCredentials({
46
+ const result = await performBrowserLogin();
47
+ const cfg = load();
48
+ save({
49
+ ...cfg,
47
50
  auth_token: result.token,
48
51
  auth_token_expires_at: result.expiresAt
49
52
  });
50
53
  console.log(` ${green("\u2713")} Logged in successfully`);
51
- const { selectAppAfterAuth } = await import("./auth-QB3BA7AN.js");
54
+ const { selectAppAfterAuth } = await import("./auth-I5WFLU46.js");
52
55
  await selectAppAfterAuth(result.token);
53
56
  return true;
54
57
  } catch (err) {
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
+ import {
4
+ adminClientFromFlags,
5
+ clientFromFlags,
6
+ resolveAPIKey,
7
+ resolveAccessKey,
8
+ resolveActiveSigner,
9
+ resolveAppId,
10
+ resolveAuthToken,
11
+ resolveConfiguredNetworkSlugs,
12
+ resolveDelegatedMode,
13
+ resolveDelegatedSession,
14
+ resolveGasPolicyId,
15
+ resolveGasSponsored,
16
+ resolveNetwork,
17
+ resolveSolanaFeePolicyId,
18
+ resolveSolanaFeeSponsored,
19
+ resolveSolanaNetwork,
20
+ resolveSolanaWalletKey,
21
+ resolveWalletKey,
22
+ resolveWalletSession,
23
+ resolveX402,
24
+ resolveX402Client
25
+ } from "./chunk-PKAN5FKD.js";
26
+ import "./chunk-B3R6PRAL.js";
27
+ import "./chunk-QEDAULQ2.js";
28
+ export {
29
+ adminClientFromFlags,
30
+ clientFromFlags,
31
+ resolveAPIKey,
32
+ resolveAccessKey,
33
+ resolveActiveSigner,
34
+ resolveAppId,
35
+ resolveAuthToken,
36
+ resolveConfiguredNetworkSlugs,
37
+ resolveDelegatedMode,
38
+ resolveDelegatedSession,
39
+ resolveGasPolicyId,
40
+ resolveGasSponsored,
41
+ resolveNetwork,
42
+ resolveSolanaFeePolicyId,
43
+ resolveSolanaFeeSponsored,
44
+ resolveSolanaNetwork,
45
+ resolveSolanaWalletKey,
46
+ resolveWalletKey,
47
+ resolveWalletSession,
48
+ resolveX402,
49
+ resolveX402Client
50
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/cli",
3
- "version": "0.6.2",
3
+ "version": "0.7.0-alpha.5",
4
4
  "description": "Alchemy CLI — interact with blockchain data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/alchemyplatform/alchemy-cli.git"
22
+ "url": "https://github.com/OMGWINNING/alchemy-cli.git"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"
@@ -29,17 +29,22 @@
29
29
  "node": ">=22"
30
30
  },
31
31
  "dependencies": {
32
+ "@alchemy/wallet-apis": "5.0.0-beta.22",
32
33
  "@alchemy/x402": "^0.4.0",
33
34
  "@noble/hashes": "^2.0.1",
35
+ "@solana-program/system": "^0.12.0",
36
+ "@solana/kit": "^6.7.0",
34
37
  "cli-table3": "^0.6.5",
35
38
  "commander": "^14.0.3",
36
- "cross-keychain": "^1.1.0",
39
+ "qrcode": "^1.5.4",
40
+ "viem": "^2.47.10",
37
41
  "zod": "^4.3.6"
38
42
  },
39
43
  "devDependencies": {
40
44
  "@changesets/changelog-github": "^0.6.0",
41
45
  "@changesets/cli": "^2.30.0",
42
46
  "@types/node": "^25.3.0",
47
+ "@types/qrcode": "^1.5.6",
43
48
  "@vitest/coverage-v8": "^4.0.18",
44
49
  "tsup": "^8.5.1",
45
50
  "tsx": "^4.21.0",
@@ -49,10 +54,14 @@
49
54
  "scripts": {
50
55
  "build": "tsup",
51
56
  "dev": "tsup --watch",
57
+ "live:check": "node --env-file-if-exists=.env.local --import=tsx scripts/live-check.ts",
52
58
  "postinstall": "node ./scripts/postinstall.cjs",
59
+ "sync:skills": "node scripts/sync-skills.mjs",
60
+ "update:skills": "npx skills update && pnpm sync:skills",
53
61
  "test": "vitest run",
54
62
  "test:coverage": "vitest run --coverage",
55
63
  "test:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts",
64
+ "test:live": "pnpm build && node --env-file-if-exists=.env.local ./node_modules/vitest/vitest.mjs run --config vitest.live.config.ts",
56
65
  "test:watch": "vitest",
57
66
  "lint": "tsc --noEmit",
58
67
  "changeset": "changeset",
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { unlinkSync } = require("node:fs");
3
+ const { existsSync, unlinkSync } = require("node:fs");
4
4
  const { join } = require("node:path");
5
+ const { spawnSync } = require("node:child_process");
6
+
7
+ const root = process.cwd();
5
8
 
6
9
  function isGlobalInstall() {
7
10
  return process.env.npm_config_global === "true";
@@ -24,6 +27,71 @@ function clearUpdateCache() {
24
27
  }
25
28
  }
26
29
 
30
+ function run(command, args, options = {}) {
31
+ const result = spawnSync(command, args, {
32
+ cwd: root,
33
+ stdio: "inherit",
34
+ ...options,
35
+ });
36
+
37
+ if (result.error) {
38
+ throw result.error;
39
+ }
40
+
41
+ return result.status ?? 1;
42
+ }
43
+
44
+ function canAccessSharedSkills() {
45
+ const result = spawnSync(
46
+ "git",
47
+ ["ls-remote", "https://github.com/OMGWINNING/internal-skills.git", "HEAD"],
48
+ {
49
+ cwd: root,
50
+ stdio: "ignore",
51
+ env: {
52
+ ...process.env,
53
+ GIT_TERMINAL_PROMPT: "0",
54
+ GCM_INTERACTIVE: "never",
55
+ },
56
+ },
57
+ );
58
+
59
+ return result.status === 0;
60
+ }
61
+
62
+ function syncSkills() {
63
+ const shouldSkipSkillSync = process.env.SKIP_SKILL_SYNC === "1";
64
+ const skillsLockPath = join(root, "skills-lock.json");
65
+
66
+ if (shouldSkipSkillSync || !existsSync(skillsLockPath)) {
67
+ return;
68
+ }
69
+
70
+ if (!canAccessSharedSkills()) {
71
+ const message =
72
+ "[postinstall] skipping shared skill sync because git cannot access OMGWINNING/internal-skills.";
73
+
74
+ if (isCI()) {
75
+ console.error(`${message} CI should configure git auth before install.`);
76
+ process.exit(1);
77
+ }
78
+
79
+ console.warn(
80
+ `${message} Run \`pnpm sync:skills\` after GitHub auth is configured.`,
81
+ );
82
+ return;
83
+ }
84
+
85
+ console.log("[postinstall] syncing shared skills from skills-lock.json");
86
+ const syncStatus = run("node", ["scripts/sync-skills.mjs"]);
87
+
88
+ if (syncStatus !== 0) {
89
+ process.exit(syncStatus);
90
+ }
91
+ }
92
+
93
+ syncSkills();
94
+
27
95
  if (isGlobalInstall() && !isCI()) {
28
96
  clearUpdateCache();
29
97
  console.log("");
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
- import {
4
- registerAuth,
5
- selectAppAfterAuth
6
- } from "./chunk-UMKDYHMO.js";
7
- import "./chunk-FFMNT74F.js";
8
- import "./chunk-KDMIWPZH.js";
9
- import "./chunk-ATX65U7J.js";
10
- import "./chunk-JQRGILIS.js";
11
- import "./chunk-NBDWF4ZQ.js";
12
- import "./chunk-BAAQ7ELR.js";
13
- import "./chunk-56ZVYB4G.js";
14
- export {
15
- registerAuth,
16
- selectAppAfterAuth
17
- };
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
-
4
- // src/lib/credential-storage.ts
5
- import {
6
- getPassword,
7
- setPassword,
8
- deletePassword,
9
- getKeyring,
10
- PasswordDeleteError
11
- } from "cross-keychain";
12
- var SERVICE = "alchemy-cli";
13
- var ACCOUNT = "oauth-credentials";
14
- async function getCredentials() {
15
- try {
16
- const raw = await getPassword(SERVICE, ACCOUNT);
17
- if (!raw) return null;
18
- const parsed = JSON.parse(raw);
19
- if (parsed && typeof parsed.auth_token === "string" && typeof parsed.auth_token_expires_at === "string") {
20
- return parsed;
21
- }
22
- return null;
23
- } catch {
24
- return null;
25
- }
26
- }
27
- async function saveCredentials(creds) {
28
- await setPassword(SERVICE, ACCOUNT, JSON.stringify(creds));
29
- }
30
- async function deleteCredentials() {
31
- try {
32
- await deletePassword(SERVICE, ACCOUNT);
33
- } catch (err) {
34
- if (!(err instanceof PasswordDeleteError)) {
35
- throw err;
36
- }
37
- }
38
- }
39
- async function getStorageBackend() {
40
- try {
41
- const keyring = await getKeyring();
42
- return keyring.name;
43
- } catch {
44
- return "unknown";
45
- }
46
- }
47
-
48
- export {
49
- getCredentials,
50
- saveCredentials,
51
- deleteCredentials,
52
- getStorageBackend
53
- };