@alchemy/cli 0.10.0 → 0.11.1
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 -26
- package/dist/{auth-KS6VPHHU.js → auth-5XFZB2BU.js} +2 -2
- package/dist/auth-AU7LPEQL.js +16 -0
- package/dist/{chunk-CTTW4PA4.js → chunk-5BEJA752.js} +21 -27
- package/dist/{chunk-D2RUM2DD.js → chunk-CJDHJYLM.js} +4 -4
- package/dist/{chunk-PMNRIXJI.js → chunk-DXQAGBW6.js} +1 -1
- package/dist/{chunk-AMGGO36F.js → chunk-I6YQX7PF.js} +1 -1
- package/dist/{chunk-L5E7GEUU.js → chunk-ILPOKA4Y.js} +6 -6
- package/dist/{chunk-GLKB4JM7.js → chunk-LANOFNO6.js} +1 -11
- package/dist/{chunk-ANONMDDZ.js → chunk-OL5MEN62.js} +66 -87
- package/dist/{chunk-VN5JUWHO.js → chunk-QWLBZTG5.js} +7 -12
- package/dist/{chunk-3GBDYROJ.js → chunk-RPSHRYCZ.js} +1 -1
- package/dist/{chunk-HRWD4V2P.js → chunk-SRGDGXY5.js} +3 -3
- package/dist/{errors-YPNK3AVF.js → errors-6BEPCY5N.js} +5 -5
- package/dist/index.js +196 -157
- package/dist/{interactive-D34T7RI6.js → interactive-NPBITOGO.js} +7 -9
- package/dist/{onboarding-A7IOH2MX.js → onboarding-QOZOX4CZ.js} +6 -6
- package/dist/{policy-prompt-V6W7CPAO.js → policy-prompt-YU6L2VJZ.js} +5 -5
- package/dist/{resolve-REZCFZZ7.js → resolve-WXXPXPCU.js} +9 -5
- package/package.json +1 -1
- package/dist/auth-23OYLRWN.js +0 -16
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Alchemy CLI is a command-line tool for querying blockchain data and managing Alchemy apps/configuration.
|
|
4
4
|
It supports both human-friendly terminal output and JSON output for automation.
|
|
5
|
-
You can use browser login, API keys,
|
|
5
|
+
You can use browser login, API keys, or x402 wallet auth depending on the command.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -67,7 +67,7 @@ Quick usage examples:
|
|
|
67
67
|
alchemy
|
|
68
68
|
|
|
69
69
|
# Agent/script-friendly command
|
|
70
|
-
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --json --no-interactive
|
|
70
|
+
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet --json --no-interactive
|
|
71
71
|
|
|
72
72
|
# Agent checks whether a newer CLI version is available
|
|
73
73
|
alchemy update-check --json --no-interactive
|
|
@@ -95,22 +95,22 @@ Use `alchemy help` or `alchemy help <command>` for generated command help.
|
|
|
95
95
|
|
|
96
96
|
| Command | What it does | Example |
|
|
97
97
|
|---|---|---|
|
|
98
|
-
| `evm rpc <method> [params...]` | Makes raw Ethereum JSON-RPC calls | `alchemy evm rpc eth_blockNumber` |
|
|
99
|
-
| `evm data balance [address]` | Gets native token balance for an address | `alchemy evm data balance 0x
|
|
100
|
-
| `evm data tokens balances [address]` | Lists ERC-20 balances for an address | `alchemy evm data tokens balances 0x
|
|
101
|
-
| `evm data nfts [address]` | Lists NFTs owned by an address | `alchemy evm data nfts 0x
|
|
102
|
-
| `evm data history [address]` | Gets transfer history (`alchemy_getAssetTransfers`) | `alchemy evm data history 0x... --category erc20,erc721` |
|
|
98
|
+
| `evm rpc <method> [params...]` | Makes raw Ethereum JSON-RPC calls | `alchemy evm rpc eth_blockNumber -n eth-mainnet` |
|
|
99
|
+
| `evm data balance [address]` | Gets native token balance for an address | `alchemy evm data balance 0x... -n eth-mainnet` |
|
|
100
|
+
| `evm data tokens balances [address]` | Lists ERC-20 balances for an address | `alchemy evm data tokens balances 0x... -n eth-mainnet` |
|
|
101
|
+
| `evm data nfts [address]` | Lists NFTs owned by an address | `alchemy evm data nfts 0x... -n eth-mainnet` |
|
|
102
|
+
| `evm data history [address]` | Gets transfer history (`alchemy_getAssetTransfers`) | `alchemy evm data history 0x... --category erc20,erc721 -n eth-mainnet` |
|
|
103
103
|
| `evm data price symbol <symbols>` | Gets current token prices by symbol | `alchemy evm data price symbol ETH,USDC` |
|
|
104
104
|
| `evm data portfolio tokens --body <json>` | Gets token portfolio data | `alchemy evm data portfolio tokens --body '{...}'` |
|
|
105
|
-
| `evm send <to> <amount>` | Sends native tokens or ERC-20 tokens | `alchemy evm send vitalik.eth 0.1 -n base-mainnet` |
|
|
106
|
-
| `evm contract read/call` | Reads or writes smart contracts | `alchemy evm contract read 0x... "balanceOf(address)(uint256)" --args '["0x..."]'` |
|
|
107
|
-
| `evm swap quote/execute` | Swaps tokens on the same chain | `alchemy evm swap quote --from 0xEeee... --to 0xA0b8... --amount 1` |
|
|
108
|
-
| `evm approve <spender_address>` | Approves an ERC-20 token allowance | `alchemy evm approve 0x... --token-address 0x... --amount 10` |
|
|
109
|
-
| `evm status [id]` | Checks transaction or operation status | `alchemy evm status 0x
|
|
105
|
+
| `evm send <to> <amount>` | Sends native tokens for `--network`, or ERC-20 tokens with `--token` | `alchemy evm send vitalik.eth 0.1 -n base-mainnet` |
|
|
106
|
+
| `evm contract read/call` | Reads or writes smart contracts | `alchemy evm contract read 0x... "balanceOf(address)(uint256)" --args '["0x..."]' -n eth-mainnet` |
|
|
107
|
+
| `evm swap quote/execute` | Swaps tokens on the same chain | `alchemy evm swap quote --from 0xEeee... --to 0xA0b8... --amount 1 -n eth-mainnet` |
|
|
108
|
+
| `evm approve <spender_address>` | Approves an ERC-20 token allowance | `alchemy evm approve 0x... --token-address 0x... --amount 10 -n eth-mainnet` |
|
|
109
|
+
| `evm status [id]` | Checks transaction or operation status | `alchemy evm status 0x... -n eth-mainnet` |
|
|
110
110
|
| `evm network list` | Lists RPC network IDs for use with `--network` | `alchemy evm network list --search base` |
|
|
111
|
-
| `evm tx/receipt/block/gas/logs` | Fetches common node resources | `alchemy evm block latest` |
|
|
112
|
-
| `evm trace/debug` | Calls Trace and Debug API methods | `alchemy evm trace call '{"to":"0x..."}' '["trace"]' latest` |
|
|
113
|
-
| `evm simulate *` | Calls simulation APIs | `alchemy evm simulate execution --tx '{"to":"0x..."}'` |
|
|
111
|
+
| `evm tx/receipt/block/gas/logs` | Fetches common node resources | `alchemy evm block latest -n eth-mainnet` |
|
|
112
|
+
| `evm trace/debug` | Calls Trace and Debug API methods | `alchemy evm trace call '{"to":"0x..."}' '["trace"]' latest -n eth-mainnet` |
|
|
113
|
+
| `evm simulate *` | Calls simulation APIs | `alchemy evm simulate execution --tx '{"to":"0x..."}' -n eth-mainnet` |
|
|
114
114
|
|
|
115
115
|
### Wallets
|
|
116
116
|
|
|
@@ -134,14 +134,14 @@ Per-command override: pass `--signer <session\|local>` to `evm send`, `evm appro
|
|
|
134
134
|
|
|
135
135
|
| Command | What it does | Example |
|
|
136
136
|
|---|---|---|
|
|
137
|
-
| `solana rpc <method> [params...]` | Calls Solana JSON-RPC methods | `alchemy solana rpc getBalance '"<pubkey>"'` |
|
|
138
|
-
| `solana das <method> [params...]` | Calls Solana DAS methods | `alchemy solana das getAssetsByOwner '{"ownerAddress":"<pubkey>"}'` |
|
|
137
|
+
| `solana rpc <method> [params...]` | Calls Solana JSON-RPC methods | `alchemy solana rpc getBalance '"<pubkey>"' -n solana-mainnet` |
|
|
138
|
+
| `solana das <method> [params...]` | Calls Solana DAS methods | `alchemy solana das getAssetsByOwner '{"ownerAddress":"<pubkey>"}' -n solana-mainnet` |
|
|
139
139
|
| `solana network list` | Lists networks from the Solana namespace | `alchemy solana network list --search solana` |
|
|
140
|
-
| `solana send <to> <amount>` | Sends SOL or SPL tokens to an address | `alchemy solana send <pubkey> 0.1` |
|
|
141
|
-
| `solana send <to> <amount> --token <mint>` | Sends an SPL token and creates the recipient ATA if needed | `alchemy solana send <pubkey> 10 --token <mint
|
|
142
|
-
| `solana program accounts/account/show` | Inspects Solana program accounts and account metadata | `alchemy solana program accounts <program-id
|
|
143
|
-
| `solana delegate approve/revoke` | Approves or revokes SPL token delegates | `alchemy solana delegate approve --token-account <addr> --mint <mint> --delegate <addr> --amount 1 --decimals 6` |
|
|
144
|
-
| `solana status [id]` | Checks Solana transaction or operation status | `alchemy solana status <signature
|
|
140
|
+
| `solana send <to> <amount>` | Sends SOL or SPL tokens to an address | `alchemy solana send <pubkey> 0.1 -n solana-mainnet` |
|
|
141
|
+
| `solana send <to> <amount> --token <mint>` | Sends an SPL token and creates the recipient ATA if needed | `alchemy solana send <pubkey> 10 --token <mint> -n solana-mainnet` |
|
|
142
|
+
| `solana program accounts/account/show` | Inspects Solana program accounts and account metadata | `alchemy solana program accounts <program-id> -n solana-mainnet` |
|
|
143
|
+
| `solana delegate approve/revoke` | Approves or revokes SPL token delegates | `alchemy solana delegate approve --token-account <addr> --mint <mint> --delegate <addr> --amount 1 --decimals 6 -n solana-mainnet` |
|
|
144
|
+
| `solana status [id]` | Checks Solana transaction or operation status | `alchemy solana status <signature> -n solana-mainnet` |
|
|
145
145
|
| `xchain bridge quote/execute` | Bridges tokens across chains | `alchemy xchain bridge quote --from 0xEeee... --to 0xEeee... --amount 0.1 --to-network base-mainnet -n eth-mainnet` |
|
|
146
146
|
|
|
147
147
|
### CLI Admin
|
|
@@ -175,7 +175,7 @@ Per-command override: pass `--signer <session\|local>` to `evm send`, `evm appro
|
|
|
175
175
|
| `install skills` | Installs bundled Alchemy skills | `alchemy install skills --client cursor --dry-run` |
|
|
176
176
|
| `update-check` | Checks whether a newer CLI version is available | `alchemy update-check --json --no-interactive` |
|
|
177
177
|
| `config set ...` | Sets config values | `alchemy config set app <app-id>` |
|
|
178
|
-
| `config get <key>` | Gets one config value | `alchemy config get
|
|
178
|
+
| `config get <key>` | Gets one config value | `alchemy config get verbose` |
|
|
179
179
|
| `config list` | Lists all config values | `alchemy config list` |
|
|
180
180
|
| `config reset [key]` | Resets one or all config values | `alchemy config reset --yes` |
|
|
181
181
|
| `completions <shell>` | Generates shell completion scripts (bash/zsh/fish) | `eval "$(alchemy completions zsh)"` |
|
|
@@ -193,7 +193,7 @@ These apply to all commands.
|
|
|
193
193
|
| Flag | Env var | Description |
|
|
194
194
|
|---|---|---|
|
|
195
195
|
| `--api-key <key>` | `ALCHEMY_API_KEY` | API key for blockchain query commands |
|
|
196
|
-
| `-n, --network <network>` |
|
|
196
|
+
| `-n, --network <network>` | — | Target network for networked commands |
|
|
197
197
|
| `--x402` | — | Enable x402 wallet-based gateway auth |
|
|
198
198
|
| `--wallet-key-file <path>` | — | EVM wallet private key file for x402 auth and local signing |
|
|
199
199
|
| `--solana-wallet-key-file <path>` | — | Solana wallet private key file for local signing |
|
|
@@ -221,7 +221,6 @@ Additional env vars:
|
|
|
221
221
|
| Env var | Description |
|
|
222
222
|
|---|---|
|
|
223
223
|
| `ALCHEMY_CONFIG` | Custom path to config file |
|
|
224
|
-
| `ALCHEMY_ACCESS_KEY` | Access key for Admin API operations |
|
|
225
224
|
| `ALCHEMY_WALLET_KEY` | EVM wallet private key for x402 auth and local signing |
|
|
226
225
|
| `ALCHEMY_SOLANA_WALLET_KEY` | Solana wallet private key |
|
|
227
226
|
| `ALCHEMY_ACTIVE_SIGNER` | Active EVM signer override (`session` or `local`) |
|
|
@@ -245,7 +244,7 @@ Additional env vars:
|
|
|
245
244
|
| `evm data price historical` | `--body <json>` (required) |
|
|
246
245
|
| `evm data portfolio *` | `--body <json>` (required per subcommand) |
|
|
247
246
|
| `evm simulate *` | `--tx <json>` or `--txs <json>` (required) |
|
|
248
|
-
| `evm send` | `--token <address>`, `--gas-sponsored`, `--gas-policy-id <id>`, `--signer <session\|local>` |
|
|
247
|
+
| `evm send` | `-n, --network <network>` (required), `--token <address>`, `--gas-sponsored`, `--gas-policy-id <id>`, `--signer <session\|local>` |
|
|
249
248
|
| `evm contract call` | `--args <json>`, `--abi-file <path>`, `--abi <json>`, `--value <ether>`, `--gas-sponsored`, `--gas-policy-id <id>`, `--signer <session\|local>` |
|
|
250
249
|
| `evm swap quote` | `--from <token_address>`, `--to <token_address>`, `--amount <number>`, `--slippage <percent>`, `--signer <session\|local>` |
|
|
251
250
|
| `evm swap execute` | `--from <token_address>`, `--to <token_address>`, `--amount <number>`, `--slippage <percent>`, `--gas-sponsored`, `--gas-policy-id <id>`, `--signer <session\|local>` |
|
|
@@ -0,0 +1,16 @@
|
|
|
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-ILPOKA4Y.js";
|
|
7
|
+
import "./chunk-I6YQX7PF.js";
|
|
8
|
+
import "./chunk-RPSHRYCZ.js";
|
|
9
|
+
import "./chunk-OL5MEN62.js";
|
|
10
|
+
import "./chunk-DXQAGBW6.js";
|
|
11
|
+
import "./chunk-LANOFNO6.js";
|
|
12
|
+
import "./chunk-5BEJA752.js";
|
|
13
|
+
export {
|
|
14
|
+
registerAuth,
|
|
15
|
+
selectAppAfterAuth
|
|
16
|
+
};
|
|
@@ -113,9 +113,7 @@ async function fetchWithTimeout(url, init) {
|
|
|
113
113
|
// src/lib/redact.ts
|
|
114
114
|
var SENSITIVE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
115
115
|
"AUTH_REQUIRED",
|
|
116
|
-
"INVALID_API_KEY"
|
|
117
|
-
"INVALID_ACCESS_KEY",
|
|
118
|
-
"ACCESS_KEY_REQUIRED"
|
|
116
|
+
"INVALID_API_KEY"
|
|
119
117
|
]);
|
|
120
118
|
function getAlchemyKeyPathMarkers() {
|
|
121
119
|
const domain = getBaseDomain();
|
|
@@ -293,8 +291,6 @@ var ErrorCode = {
|
|
|
293
291
|
AUTH_REQUIRED: "AUTH_REQUIRED",
|
|
294
292
|
INVALID_API_KEY: "INVALID_API_KEY",
|
|
295
293
|
NETWORK_NOT_ENABLED: "NETWORK_NOT_ENABLED",
|
|
296
|
-
INVALID_ACCESS_KEY: "INVALID_ACCESS_KEY",
|
|
297
|
-
ACCESS_KEY_REQUIRED: "ACCESS_KEY_REQUIRED",
|
|
298
294
|
APP_REQUIRED: "APP_REQUIRED",
|
|
299
295
|
ADMIN_API_ERROR: "ADMIN_API_ERROR",
|
|
300
296
|
NETWORK_ERROR: "NETWORK_ERROR",
|
|
@@ -315,8 +311,6 @@ var EXIT_CODES = {
|
|
|
315
311
|
AUTH_REQUIRED: 3,
|
|
316
312
|
INVALID_API_KEY: 3,
|
|
317
313
|
NETWORK_NOT_ENABLED: 3,
|
|
318
|
-
INVALID_ACCESS_KEY: 3,
|
|
319
|
-
ACCESS_KEY_REQUIRED: 3,
|
|
320
314
|
APP_REQUIRED: 3,
|
|
321
315
|
INVALID_ARGS: 2,
|
|
322
316
|
NOT_FOUND: 4,
|
|
@@ -368,13 +362,6 @@ function errAuthRequired() {
|
|
|
368
362
|
"alchemy auth"
|
|
369
363
|
);
|
|
370
364
|
}
|
|
371
|
-
function errAccessKeyRequired() {
|
|
372
|
-
return new CLIError(
|
|
373
|
-
ErrorCode.ACCESS_KEY_REQUIRED,
|
|
374
|
-
"Access key required. Set ALCHEMY_ACCESS_KEY or run 'alchemy config set access-key <key>'.",
|
|
375
|
-
"Get an access key: https://www.alchemy.com/docs/reference/admin-api/overview"
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
365
|
function errLoginRequired() {
|
|
379
366
|
return new CLIError(
|
|
380
367
|
ErrorCode.AUTH_REQUIRED,
|
|
@@ -406,6 +393,13 @@ function errNetwork(detail) {
|
|
|
406
393
|
"Check your internet connection and try again."
|
|
407
394
|
);
|
|
408
395
|
}
|
|
396
|
+
function errNetworkRequired(networkListCommand = "alchemy evm network list") {
|
|
397
|
+
return new CLIError(
|
|
398
|
+
ErrorCode.INVALID_ARGS,
|
|
399
|
+
"Network required. Pass -n/--network <network>.",
|
|
400
|
+
networkListCommand
|
|
401
|
+
);
|
|
402
|
+
}
|
|
409
403
|
var RPC_ERROR_HINTS = {
|
|
410
404
|
[-32700]: "Parse error. The request JSON is malformed.",
|
|
411
405
|
[-32600]: "Invalid request. Check the JSON-RPC request format.",
|
|
@@ -430,19 +424,12 @@ function errRateLimited() {
|
|
|
430
424
|
"Consider upgrading your Alchemy plan for higher rate limits."
|
|
431
425
|
);
|
|
432
426
|
}
|
|
433
|
-
function errInvalidAccessKey() {
|
|
434
|
-
return new CLIError(
|
|
435
|
-
ErrorCode.INVALID_ACCESS_KEY,
|
|
436
|
-
"Invalid access key. Check your key and try again.",
|
|
437
|
-
"Get an access key: https://www.alchemy.com/docs/reference/admin-api/overview"
|
|
438
|
-
);
|
|
439
|
-
}
|
|
440
427
|
function errAccessDenied(detail) {
|
|
441
|
-
const message = detail ? `Access denied: ${detail}` : "Access denied.
|
|
428
|
+
const message = detail ? `Access denied: ${detail}` : "Access denied. Check that your Alchemy account has permission for this operation.";
|
|
442
429
|
return new CLIError(
|
|
443
|
-
ErrorCode.
|
|
430
|
+
ErrorCode.AUTH_REQUIRED,
|
|
444
431
|
message,
|
|
445
|
-
"
|
|
432
|
+
"Run 'alchemy auth login' or check your account access at https://dashboard.alchemy.com/"
|
|
446
433
|
);
|
|
447
434
|
}
|
|
448
435
|
function errAppRequired() {
|
|
@@ -455,10 +442,17 @@ function errAppRequired() {
|
|
|
455
442
|
function errWalletKeyRequired() {
|
|
456
443
|
return new CLIError(
|
|
457
444
|
ErrorCode.AUTH_REQUIRED,
|
|
458
|
-
"
|
|
445
|
+
"No local wallet configured. Run 'alchemy wallet connect --mode local', set ALCHEMY_WALLET_KEY, or use --wallet-key-file.",
|
|
459
446
|
"alchemy wallet connect --mode local"
|
|
460
447
|
);
|
|
461
448
|
}
|
|
449
|
+
function errWalletRequired() {
|
|
450
|
+
return new CLIError(
|
|
451
|
+
ErrorCode.AUTH_REQUIRED,
|
|
452
|
+
"No wallet connected. Run 'alchemy wallet connect' to connect a session wallet, or run 'alchemy wallet connect --mode local' to use a local wallet.",
|
|
453
|
+
"alchemy wallet connect"
|
|
454
|
+
);
|
|
455
|
+
}
|
|
462
456
|
function errSessionExpired() {
|
|
463
457
|
return new CLIError(
|
|
464
458
|
ErrorCode.AUTH_REQUIRED,
|
|
@@ -548,19 +542,19 @@ export {
|
|
|
548
542
|
EXIT_CODES,
|
|
549
543
|
CLIError,
|
|
550
544
|
errAuthRequired,
|
|
551
|
-
errAccessKeyRequired,
|
|
552
545
|
errLoginRequired,
|
|
553
546
|
errInvalidAPIKey,
|
|
554
547
|
errNetworkNotEnabled,
|
|
555
548
|
errNetwork,
|
|
549
|
+
errNetworkRequired,
|
|
556
550
|
errRPC,
|
|
557
551
|
errInvalidArgs,
|
|
558
552
|
errNotFound,
|
|
559
553
|
errRateLimited,
|
|
560
|
-
errInvalidAccessKey,
|
|
561
554
|
errAccessDenied,
|
|
562
555
|
errAppRequired,
|
|
563
556
|
errWalletKeyRequired,
|
|
557
|
+
errWalletRequired,
|
|
564
558
|
errSessionExpired,
|
|
565
559
|
errNoActiveSession,
|
|
566
560
|
errSolanaWalletKeyRequired,
|
|
@@ -3,7 +3,7 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
|
3
3
|
import {
|
|
4
4
|
gasManagerClientFromFlags,
|
|
5
5
|
toAdminNetworkId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OL5MEN62.js";
|
|
7
7
|
import {
|
|
8
8
|
dim,
|
|
9
9
|
green,
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
promptConfirm,
|
|
12
12
|
promptText,
|
|
13
13
|
withSpinner
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DXQAGBW6.js";
|
|
15
15
|
import {
|
|
16
16
|
load,
|
|
17
17
|
save
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LANOFNO6.js";
|
|
19
19
|
import {
|
|
20
20
|
errAppRequired,
|
|
21
21
|
errInvalidArgs,
|
|
22
22
|
errLoginRequired
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5BEJA752.js";
|
|
24
24
|
|
|
25
25
|
// src/lib/policy-prompt.ts
|
|
26
26
|
var CREATE_NEW_SENTINEL = "__create_new__";
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
completeLogin,
|
|
5
5
|
prepareLogin,
|
|
6
6
|
revokeToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-I6YQX7PF.js";
|
|
8
8
|
import {
|
|
9
9
|
isInteractiveAllowed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RPSHRYCZ.js";
|
|
11
11
|
import {
|
|
12
12
|
AdminClient,
|
|
13
13
|
resolveAuthToken
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OL5MEN62.js";
|
|
15
15
|
import {
|
|
16
16
|
bold,
|
|
17
17
|
brand,
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
promptAutocomplete,
|
|
21
21
|
promptText,
|
|
22
22
|
withSpinner
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-DXQAGBW6.js";
|
|
24
24
|
import {
|
|
25
25
|
configPath,
|
|
26
26
|
load,
|
|
27
27
|
maskIf,
|
|
28
28
|
save
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LANOFNO6.js";
|
|
30
30
|
import {
|
|
31
31
|
CLIError,
|
|
32
32
|
ErrorCode,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
exitWithError,
|
|
35
35
|
isJSONMode,
|
|
36
36
|
printHuman
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5BEJA752.js";
|
|
38
38
|
|
|
39
39
|
// src/commands/auth.ts
|
|
40
40
|
function registerAuth(program) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
isRevealMode
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5BEJA752.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/secrets.ts
|
|
8
8
|
function maskSecret(value) {
|
|
@@ -22,11 +22,8 @@ import { z } from "zod";
|
|
|
22
22
|
var KEY_MAP = {
|
|
23
23
|
"api-key": "api_key",
|
|
24
24
|
api_key: "api_key",
|
|
25
|
-
"access-key": "access_key",
|
|
26
|
-
access_key: "access_key",
|
|
27
25
|
"webhook-api-key": "webhook_api_key",
|
|
28
26
|
webhook_api_key: "webhook_api_key",
|
|
29
|
-
network: "network",
|
|
30
27
|
verbose: "verbose",
|
|
31
28
|
"wallet-key-file": "wallet_key_file",
|
|
32
29
|
wallet_key_file: "wallet_key_file",
|
|
@@ -57,7 +54,6 @@ var KEY_MAP = {
|
|
|
57
54
|
wallet_client_instance_name: "wallet_client_instance_name"
|
|
58
55
|
};
|
|
59
56
|
var SAFE_ID_RE = /^[A-Za-z0-9:_-]{1,128}$/;
|
|
60
|
-
var SAFE_NETWORK_RE = /^[A-Za-z0-9:_-]{1,128}$/;
|
|
61
57
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
62
58
|
var MAX_SECRET_LEN = 512;
|
|
63
59
|
var MAX_APP_NAME_LEN = 128;
|
|
@@ -74,10 +70,8 @@ var appConfigSchema = z.object({
|
|
|
74
70
|
var MAX_PATH_LEN = 4096;
|
|
75
71
|
var configSchema = z.object({
|
|
76
72
|
api_key: safeTextSchema(MAX_SECRET_LEN).optional().catch(void 0),
|
|
77
|
-
access_key: safeTextSchema(MAX_SECRET_LEN).optional().catch(void 0),
|
|
78
73
|
webhook_api_key: safeTextSchema(MAX_SECRET_LEN).optional().catch(void 0),
|
|
79
74
|
app: appConfigSchema.optional().catch(void 0),
|
|
80
|
-
network: z.string().regex(SAFE_NETWORK_RE).optional().catch(void 0),
|
|
81
75
|
verbose: z.boolean().optional().catch(void 0),
|
|
82
76
|
wallet_key_file: safeTextSchema(MAX_PATH_LEN).optional().catch(void 0),
|
|
83
77
|
wallet_address: safeTextSchema(MAX_SECRET_LEN).optional().catch(void 0),
|
|
@@ -212,9 +206,7 @@ function get(cfg, key) {
|
|
|
212
206
|
function validKeys() {
|
|
213
207
|
return [
|
|
214
208
|
"api-key",
|
|
215
|
-
"access-key",
|
|
216
209
|
"webhook-api-key",
|
|
217
|
-
"network",
|
|
218
210
|
"verbose",
|
|
219
211
|
"wallet-key-file",
|
|
220
212
|
"x402",
|
|
@@ -227,10 +219,8 @@ function validKeys() {
|
|
|
227
219
|
function toMap(cfg) {
|
|
228
220
|
const m = {};
|
|
229
221
|
if (cfg.api_key) m["api-key"] = maskIf(cfg.api_key);
|
|
230
|
-
if (cfg.access_key) m["access-key"] = maskIf(cfg.access_key);
|
|
231
222
|
if (cfg.webhook_api_key) m["webhook-api-key"] = maskIf(cfg.webhook_api_key);
|
|
232
223
|
if (cfg.app) m["app"] = `${cfg.app.name} (${cfg.app.id})`;
|
|
233
|
-
if (cfg.network) m["network"] = cfg.network;
|
|
234
224
|
if (cfg.verbose !== void 0) m["verbose"] = String(cfg.verbose);
|
|
235
225
|
if (cfg.wallet_key_file) m["wallet-key-file"] = cfg.wallet_key_file;
|
|
236
226
|
if (cfg.wallet_address) m["wallet-address"] = cfg.wallet_address;
|