@alchemy/cli 0.5.1 → 0.6.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 CHANGED
@@ -39,26 +39,20 @@ alchemy completions fish > ~/.config/fish/completions/alchemy.fish
39
39
 
40
40
  ### Authentication Quick Start
41
41
 
42
- Authentication is required before making requests. Configure auth first, then run commands.
43
-
44
- If you are using the CLI as a human in an interactive terminal, the easiest path is:
42
+ Authentication is required before making requests. The recommended path is browser login:
45
43
 
46
44
  ```bash
47
- alchemy
45
+ alchemy auth
48
46
  ```
49
47
 
50
- Then follow the setup flow in the terminal UI to configure auth.
48
+ This opens a browser to link your Alchemy account, then prompts you to select an app. The selected app's API key is saved to your config automatically. Pass `-y` to skip the confirmation prompt.
51
49
 
52
- Know which auth method does what:
50
+ If you run `alchemy` with no command and no auth configured, the CLI will guide you through browser login automatically.
53
51
 
54
- - **API key** - direct auth for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
55
- - **Access key** - Admin/API app management; app setup/selection can also provide API key auth for blockchain queries
56
- - **x402 wallet auth** - wallet-authenticated, pay-per-request model for supported blockchain queries
52
+ If you have an auth token but haven't selected an app yet, the CLI will prompt you to pick one before running any command that requires an API key. Teams with many apps can type to search by name.
57
53
 
58
54
  If you use Notify webhooks, add webhook auth on top via `alchemy config set webhook-api-key <key>`, `--webhook-api-key`, or `ALCHEMY_WEBHOOK_API_KEY`.
59
55
 
60
- For setup commands, env vars, and resolution order, see [Authentication Reference](#authentication-reference).
61
-
62
56
  ### Usage By Workflow
63
57
 
64
58
  After auth is configured, use the CLI differently depending on who is driving it:
@@ -115,7 +109,7 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
115
109
 
116
110
  | Command | What it does | Example |
117
111
  |---|---|---|
118
- | `tokens [address]` | Lists ERC-20 balances for an address | `alchemy tokens 0x...` |
112
+ | `tokens balances [address]` | Lists ERC-20 balances for an address | `alchemy tokens balances 0x...` |
119
113
  | `tokens metadata <contract>` | Gets ERC-20 metadata | `alchemy tokens metadata 0x...` |
120
114
  | `tokens allowance --owner --spender --contract` | Gets ERC-20 allowance | `alchemy tokens allowance --owner 0x... --spender 0x... --contract 0x...` |
121
115
  | `nfts [address]` | Lists NFTs owned by an address | `alchemy nfts 0x...` |
@@ -156,7 +150,7 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
156
150
 
157
151
  | Command | What it does | Example |
158
152
  |---|---|---|
159
- | `network list` | Lists RPC network IDs for use with `--network` (e.g. `eth-mainnet`) | `alchemy network list --configured` |
153
+ | `network list` | Lists RPC network IDs for use with `--network` (e.g. `eth-mainnet`) | `alchemy network list --search ethereum` |
160
154
  | `solana rpc <method> [params...]` | Calls Solana JSON-RPC methods | `alchemy solana rpc getBalance '"<pubkey>"'` |
161
155
  | `solana das <method> [params...]` | Calls Solana DAS methods | `alchemy solana das getAssetsByOwner '{"ownerAddress":"<pubkey>"}'` |
162
156
 
@@ -165,6 +159,9 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
165
159
  | Command | What it does | Example |
166
160
  |---|---|---|
167
161
  | `(no command)` | Starts interactive REPL mode (TTY only) | `alchemy` |
162
+ | `auth` (`auth login`) | Log in via browser (PKCE) | `alchemy auth` |
163
+ | `auth status` | Show current authentication status | `alchemy auth status` |
164
+ | `auth logout` | Clear saved authentication token | `alchemy auth logout` |
168
165
  | `apps list` | Lists apps (supports pagination/filtering) | `alchemy apps list --all` |
169
166
  | `apps chains` | Lists Admin API chain identifiers (e.g. `ETH_MAINNET`) | `alchemy apps chains` |
170
167
  | `apps get <id>` | Gets app details | `alchemy apps get <app-id>` |
@@ -231,6 +228,7 @@ Additional env vars:
231
228
 
232
229
  | Command | Flags |
233
230
  |---|---|
231
+ | `auth login` | `--force`, `-y, --yes` |
234
232
  | `nfts` | `--limit <n>`, `--page-key <key>` |
235
233
  | `nfts metadata` | `--contract <address>` (required), `--token-id <id>` (required) |
236
234
  | `tokens` | `--page-key <key>` |
@@ -253,79 +251,32 @@ Additional env vars:
253
251
  | `apps address-allowlist` | `--addresses <addrs>` (required), `--dry-run` |
254
252
  | `apps origin-allowlist` | `--origins <origins>` (required), `--dry-run` |
255
253
  | `apps ip-allowlist` | `--ips <ips>` (required), `--dry-run` |
256
- | `network list` | `--configured`, `--app-id <id>` |
254
+ | `network list` | `--mainnet-only`, `--testnet-only`, `--search <term>` |
257
255
  | `config reset` | `-y, --yes` |
258
256
 
259
257
  ## Authentication Reference
260
258
 
261
- The CLI supports three auth inputs:
262
-
263
- - API key for blockchain queries (`balance`, `tx`, `block`, `nfts`, `tokens`, `rpc`)
264
- - Access key for Admin API operations (`apps`, `chains`, configured network lookups`) and app setup/selection, which can also supply the API key used by blockchain query commands
265
- - x402 wallet key for wallet-authenticated blockchain queries in a pay-per-request model
266
-
267
- Notify/webhook commands use a webhook API key with resolution order:
268
- `--webhook-api-key` -> `ALCHEMY_WEBHOOK_API_KEY` -> `ALCHEMY_NOTIFY_AUTH_TOKEN` -> config `webhook-api-key` -> configured app webhook key.
269
-
270
- Get API/access keys at [alchemy.com](https://dashboard.alchemy.com/).
271
-
272
- #### API key
273
-
274
259
  ```bash
275
- # Config
276
- alchemy config set api-key <your-key>
260
+ # Interactive login — opens browser to link your Alchemy account
261
+ alchemy auth
277
262
 
278
- # Environment variable
279
- export ALCHEMY_API_KEY=<your-key>
280
-
281
- # Per-command override
282
- alchemy balance 0x... --api-key <your-key>
283
- ```
263
+ # Skip the confirmation prompt
264
+ alchemy auth -y
284
265
 
285
- Resolution order: `--api-key` -> `ALCHEMY_API_KEY` -> config file -> configured app API key.
286
-
287
- #### Access key
288
-
289
- ```bash
290
- # Config (in TTY, this may trigger app setup flow)
291
- alchemy config set access-key <your-key>
266
+ # Force re-authentication
267
+ alchemy auth login --force
292
268
 
293
- # Environment variable
294
- export ALCHEMY_ACCESS_KEY=<your-key>
269
+ # Check auth status
270
+ alchemy auth status
295
271
 
296
- # Per-command override
297
- alchemy apps list --access-key <your-key>
272
+ # Log out
273
+ alchemy auth logout
298
274
  ```
299
275
 
300
- Resolution order: `--access-key` -> `ALCHEMY_ACCESS_KEY` -> config file.
276
+ After login, the CLI prompts you to select an app. The app's API key is saved to config and used for all subsequent commands. If you skip app selection during login, the CLI will prompt you to pick one before running any command that needs an API key.
301
277
 
302
- #### x402 wallet auth
303
-
304
- x402 is a wallet-authenticated, pay-per-request usage model for supported blockchain queries.
305
- The CLI can generate or import the wallet key used for these requests.
306
-
307
- ```bash
308
- # Generate/import a wallet managed by CLI
309
- alchemy wallet generate
310
- # or
311
- alchemy wallet import ./private-key.txt
312
-
313
- # Use x402 per command
314
- alchemy balance 0x... --x402
315
-
316
- # Or enable by default
317
- alchemy config set x402 true
318
- ```
319
-
320
- Generated/imported wallets are stored as unique key files under `~/.config/alchemy/wallet-keys/` so creating another wallet does not overwrite prior private keys.
321
-
322
- You can also provide wallet key directly:
323
-
324
- ```bash
325
- export ALCHEMY_WALLET_KEY=0x...
326
- ```
327
-
328
- Wallet key resolution order: `--wallet-key-file` -> `ALCHEMY_WALLET_KEY` -> `wallet-key-file` in config.
278
+ Notify/webhook commands use a webhook API key with resolution order:
279
+ `--webhook-api-key` -> `ALCHEMY_WEBHOOK_API_KEY` -> `ALCHEMY_NOTIFY_AUTH_TOKEN` -> config `webhook-api-key` -> configured app webhook key.
329
280
 
330
281
  ## REPL Mode
331
282
 
@@ -3,9 +3,13 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  registerAuth,
5
5
  selectAppAfterAuth
6
- } from "./chunk-LYUW7O6X.js";
7
- import "./chunk-IGD4NIK7.js";
8
- import "./chunk-T2XSNZE3.js";
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";
9
13
  import "./chunk-56ZVYB4G.js";
10
14
  export {
11
15
  registerAuth,
@@ -2,22 +2,24 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  AUTH_PORT,
5
- DEFAULT_EXPIRES_IN_SECONDS,
5
+ OAUTH_CLIENT_ID,
6
6
  exchangeCodeForToken,
7
- getLoginUrl,
7
+ getAuthorizeUrl,
8
8
  openBrowser,
9
9
  performBrowserLogin,
10
+ prepareBrowserLogin,
10
11
  revokeToken,
11
12
  waitForCallback
12
- } from "./chunk-IGD4NIK7.js";
13
+ } from "./chunk-FFMNT74F.js";
13
14
  import "./chunk-56ZVYB4G.js";
14
15
  export {
15
16
  AUTH_PORT,
16
- DEFAULT_EXPIRES_IN_SECONDS,
17
+ OAUTH_CLIENT_ID,
17
18
  exchangeCodeForToken,
18
- getLoginUrl,
19
+ getAuthorizeUrl,
19
20
  openBrowser,
20
21
  performBrowserLogin,
22
+ prepareBrowserLogin,
21
23
  revokeToken,
22
24
  waitForCallback
23
25
  };
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  configPath
5
- } from "./chunk-T2XSNZE3.js";
5
+ } from "./chunk-BAAQ7ELR.js";
6
6
  import {
7
7
  esc
8
8
  } from "./chunk-56ZVYB4G.js";
@@ -53,7 +53,7 @@ function semverLT(a, b) {
53
53
  return false;
54
54
  }
55
55
  function currentVersion() {
56
- return true ? "0.5.1" : "0.0.0";
56
+ return true ? "0.6.0" : "0.0.0";
57
57
  }
58
58
  function toUpdateStatus(latestVersion, checkedAt) {
59
59
  const current = currentVersion();