@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 +25 -74
- package/dist/{auth-7E33EMAI.js → auth-QB3BA7AN.js} +7 -3
- package/dist/{auth-E26YCAJV.js → auth-S4DTOWW3.js} +7 -5
- package/dist/{chunk-Z7J64GJJ.js → chunk-3W4ICF67.js} +2 -2
- package/dist/chunk-ATX65U7J.js +737 -0
- package/dist/chunk-BAAQ7ELR.js +143 -0
- package/dist/{chunk-IGD4NIK7.js → chunk-FFMNT74F.js} +54 -36
- package/dist/chunk-JQRGILIS.js +53 -0
- package/dist/chunk-KDMIWPZH.js +27 -0
- package/dist/chunk-NBDWF4ZQ.js +554 -0
- package/dist/{chunk-5X6YRTPU.js → chunk-T5Z2GJUX.js} +7 -5
- package/dist/{chunk-LYUW7O6X.js → chunk-UMKDYHMO.js} +113 -37
- package/dist/credential-storage-T6FFW7DG.js +14 -0
- package/dist/index.js +726 -44
- package/dist/{interactive-G4ON47AR.js → interactive-OM476LBG.js} +11 -6
- package/dist/onboarding-S3GAP4OV.js +61 -0
- package/dist/resolve-HXKHDOJZ.js +31 -0
- package/package.json +2 -1
- package/dist/chunk-44OGGLN4.js +0 -681
- package/dist/chunk-T2XSNZE3.js +0 -1398
- package/dist/onboarding-CWCVWSUG.js +0 -227
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.
|
|
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
|
-
|
|
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
|
-
|
|
50
|
+
If you run `alchemy` with no command and no auth configured, the CLI will guide you through browser login automatically.
|
|
53
51
|
|
|
54
|
-
|
|
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 --
|
|
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` | `--
|
|
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
|
-
#
|
|
276
|
-
alchemy
|
|
260
|
+
# Interactive login — opens browser to link your Alchemy account
|
|
261
|
+
alchemy auth
|
|
277
262
|
|
|
278
|
-
#
|
|
279
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
294
|
-
|
|
269
|
+
# Check auth status
|
|
270
|
+
alchemy auth status
|
|
295
271
|
|
|
296
|
-
#
|
|
297
|
-
alchemy
|
|
272
|
+
# Log out
|
|
273
|
+
alchemy auth logout
|
|
298
274
|
```
|
|
299
275
|
|
|
300
|
-
|
|
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
|
-
|
|
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-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
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
|
-
|
|
5
|
+
OAUTH_CLIENT_ID,
|
|
6
6
|
exchangeCodeForToken,
|
|
7
|
-
|
|
7
|
+
getAuthorizeUrl,
|
|
8
8
|
openBrowser,
|
|
9
9
|
performBrowserLogin,
|
|
10
|
+
prepareBrowserLogin,
|
|
10
11
|
revokeToken,
|
|
11
12
|
waitForCallback
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FFMNT74F.js";
|
|
13
14
|
import "./chunk-56ZVYB4G.js";
|
|
14
15
|
export {
|
|
15
16
|
AUTH_PORT,
|
|
16
|
-
|
|
17
|
+
OAUTH_CLIENT_ID,
|
|
17
18
|
exchangeCodeForToken,
|
|
18
|
-
|
|
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-
|
|
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.
|
|
56
|
+
return true ? "0.6.0" : "0.0.0";
|
|
57
57
|
}
|
|
58
58
|
function toUpdateStatus(latestVersion, checkedAt) {
|
|
59
59
|
const current = currentVersion();
|