@alchemy/cli 0.10.0 → 0.11.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 -26
- package/dist/{auth-KS6VPHHU.js → auth-5XFZB2BU.js} +2 -2
- package/dist/auth-6X2DBBYQ.js +16 -0
- package/dist/{chunk-HRWD4V2P.js → chunk-4QSVWWSK.js} +3 -3
- package/dist/{chunk-CTTW4PA4.js → chunk-5BEJA752.js} +21 -27
- package/dist/{chunk-ANONMDDZ.js → chunk-B5KVL3ZR.js} +61 -87
- package/dist/{chunk-VN5JUWHO.js → chunk-CSBYGYG6.js} +7 -12
- package/dist/{chunk-PMNRIXJI.js → chunk-DXQAGBW6.js} +1 -1
- package/dist/{chunk-AMGGO36F.js → chunk-I6YQX7PF.js} +1 -1
- package/dist/{chunk-D2RUM2DD.js → chunk-KIYIW6SX.js} +4 -4
- package/dist/{chunk-GLKB4JM7.js → chunk-LANOFNO6.js} +1 -11
- package/dist/{chunk-3GBDYROJ.js → chunk-RPSHRYCZ.js} +1 -1
- package/dist/{chunk-L5E7GEUU.js → chunk-XZS6KZHN.js} +6 -6
- package/dist/{errors-YPNK3AVF.js → errors-6BEPCY5N.js} +5 -5
- package/dist/index.js +152 -147
- package/dist/{interactive-D34T7RI6.js → interactive-EXQM6HWQ.js} +7 -9
- package/dist/{onboarding-A7IOH2MX.js → onboarding-2FLKQYLY.js} +6 -6
- package/dist/{policy-prompt-V6W7CPAO.js → policy-prompt-3EVE7DW3.js} +5 -5
- package/dist/{resolve-REZCFZZ7.js → resolve-FRMIY357.js} +9 -5
- package/package.json +1 -1
- package/dist/auth-23OYLRWN.js +0 -16
package/dist/index.js
CHANGED
|
@@ -5,26 +5,27 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KIYIW6SX.js";
|
|
9
9
|
import {
|
|
10
10
|
registerAuth
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XZS6KZHN.js";
|
|
12
12
|
import {
|
|
13
13
|
openBrowser
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-I6YQX7PF.js";
|
|
15
15
|
import {
|
|
16
16
|
SETUP_CAPABILITY_LABELS,
|
|
17
17
|
SETUP_CAPABILITY_ORDER,
|
|
18
18
|
getSetupStatus,
|
|
19
19
|
isSetupComplete,
|
|
20
20
|
shouldRunOnboarding
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CSBYGYG6.js";
|
|
22
22
|
import {
|
|
23
23
|
isInteractiveAllowed
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RPSHRYCZ.js";
|
|
25
25
|
import {
|
|
26
26
|
RpcApiError,
|
|
27
27
|
adminClientFromFlags,
|
|
28
|
+
apiKeyClientFromFlags,
|
|
28
29
|
clearSession,
|
|
29
30
|
clientFromFlags,
|
|
30
31
|
createPendingSession,
|
|
@@ -47,6 +48,8 @@ import {
|
|
|
47
48
|
resolveGasPolicyId,
|
|
48
49
|
resolveGasSponsored,
|
|
49
50
|
resolveNetwork,
|
|
51
|
+
resolveOptionalNetwork,
|
|
52
|
+
resolveRequiredNetwork,
|
|
50
53
|
resolveSolanaFeePolicyId,
|
|
51
54
|
resolveSolanaFeeSponsored,
|
|
52
55
|
resolveSolanaNetwork,
|
|
@@ -60,12 +63,12 @@ import {
|
|
|
60
63
|
updateSession,
|
|
61
64
|
validateNetwork,
|
|
62
65
|
walletNetworkToChain
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-B5KVL3ZR.js";
|
|
64
67
|
import {
|
|
65
68
|
getAvailableUpdate,
|
|
66
69
|
getUpdateStatus,
|
|
67
70
|
printUpdateNotice
|
|
68
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-4QSVWWSK.js";
|
|
69
72
|
import {
|
|
70
73
|
bold,
|
|
71
74
|
brand,
|
|
@@ -89,7 +92,7 @@ import {
|
|
|
89
92
|
weiToEth,
|
|
90
93
|
withSpinner,
|
|
91
94
|
yellow
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-DXQAGBW6.js";
|
|
93
96
|
import {
|
|
94
97
|
KEY_MAP,
|
|
95
98
|
configDir,
|
|
@@ -100,7 +103,7 @@ import {
|
|
|
100
103
|
save,
|
|
101
104
|
toMap,
|
|
102
105
|
validKeys
|
|
103
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-LANOFNO6.js";
|
|
104
107
|
import {
|
|
105
108
|
CLIError,
|
|
106
109
|
EXIT_CODES,
|
|
@@ -120,6 +123,7 @@ import {
|
|
|
120
123
|
errSolanaTransactionFailed,
|
|
121
124
|
errSolanaWalletKeyRequired,
|
|
122
125
|
errWalletKeyRequired,
|
|
126
|
+
errWalletRequired,
|
|
123
127
|
esc,
|
|
124
128
|
exitWithError,
|
|
125
129
|
fetchWithTimeout,
|
|
@@ -138,7 +142,7 @@ import {
|
|
|
138
142
|
setNoColor,
|
|
139
143
|
timeout,
|
|
140
144
|
verbose
|
|
141
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-5BEJA752.js";
|
|
142
146
|
|
|
143
147
|
// src/index.ts
|
|
144
148
|
import { Command, Help } from "commander";
|
|
@@ -497,16 +501,6 @@ function registerConfig(program2) {
|
|
|
497
501
|
exitWithError(err);
|
|
498
502
|
}
|
|
499
503
|
});
|
|
500
|
-
setCmd.command("network <network>").description("Set the default network (e.g. eth-mainnet, polygon-mainnet)").action((network) => {
|
|
501
|
-
try {
|
|
502
|
-
const cfg = load();
|
|
503
|
-
save({ ...cfg, network });
|
|
504
|
-
printHuman(`${green("\u2713")} Set network to ${network}
|
|
505
|
-
`, { key: "network", value: network, status: "set" });
|
|
506
|
-
} catch (err) {
|
|
507
|
-
exitWithError(err);
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
504
|
setCmd.command("verbose <enabled>").description("Set default verbose output (true|false)").action((enabled) => {
|
|
511
505
|
try {
|
|
512
506
|
const normalized = enabled.trim().toLowerCase();
|
|
@@ -585,8 +579,8 @@ function registerConfig(program2) {
|
|
|
585
579
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set evm-gas-policy-id <id>`."
|
|
586
580
|
);
|
|
587
581
|
}
|
|
588
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
589
|
-
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-
|
|
582
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-3EVE7DW3.js");
|
|
583
|
+
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-FRMIY357.js");
|
|
590
584
|
const network = resolveNetwork2(program2);
|
|
591
585
|
await selectOrCreatePolicy2({
|
|
592
586
|
flavor: "sponsorship",
|
|
@@ -640,8 +634,8 @@ function registerConfig(program2) {
|
|
|
640
634
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set solana-fee-policy-id <id>`."
|
|
641
635
|
);
|
|
642
636
|
}
|
|
643
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
644
|
-
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-
|
|
637
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-3EVE7DW3.js");
|
|
638
|
+
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-FRMIY357.js");
|
|
645
639
|
const network = resolveSolanaNetwork2(program2);
|
|
646
640
|
await selectOrCreatePolicy2({
|
|
647
641
|
flavor: "solana",
|
|
@@ -663,13 +657,12 @@ function registerConfig(program2) {
|
|
|
663
657
|
exitWithError(err);
|
|
664
658
|
}
|
|
665
659
|
});
|
|
666
|
-
cmd.command("get <key>").description("Get a config value (api-key, app,
|
|
660
|
+
cmd.command("get <key>").description("Get a config value (api-key, app, verbose, wallet-key-file, x402)").action((key) => {
|
|
667
661
|
const cfg = load();
|
|
668
662
|
let value = get(cfg, key);
|
|
669
663
|
let isDefault = false;
|
|
670
664
|
if (value === void 0) {
|
|
671
665
|
const defaults = {
|
|
672
|
-
network: "eth-mainnet",
|
|
673
666
|
verbose: "false",
|
|
674
667
|
x402: "false",
|
|
675
668
|
evm_gas_sponsored: "false",
|
|
@@ -699,7 +692,7 @@ function registerConfig(program2) {
|
|
|
699
692
|
printJSON(toMap(cfg));
|
|
700
693
|
return;
|
|
701
694
|
}
|
|
702
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
695
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-FRMIY357.js");
|
|
703
696
|
const validToken = resolveAuthToken2(cfg);
|
|
704
697
|
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");
|
|
705
698
|
const pairs = [
|
|
@@ -713,7 +706,6 @@ function registerConfig(program2) {
|
|
|
713
706
|
"app",
|
|
714
707
|
cfg.app ? `${cfg.app.name} ${dim(`(${cfg.app.id})`)}` : dim("(not set) \u2014 set automatically via 'alchemy auth' or 'config set app'")
|
|
715
708
|
],
|
|
716
|
-
["network", cfg.network || dim("(not set, defaults to eth-mainnet)")],
|
|
717
709
|
[
|
|
718
710
|
"verbose",
|
|
719
711
|
cfg.verbose !== void 0 ? String(cfg.verbose) : dim("(not set, defaults to false)")
|
|
@@ -3311,7 +3303,7 @@ function registerNetwork(program2) {
|
|
|
3311
3303
|
cmd.command("list").description("List RPC network IDs for use with --network (e.g. eth-mainnet)").option("--mainnet-only", "Show only mainnet networks").option("--testnet-only", "Show only testnet networks").option("--search <term>", "Filter networks by name or ID").action(async (opts) => {
|
|
3312
3304
|
try {
|
|
3313
3305
|
let display = getRPCNetworks();
|
|
3314
|
-
const current =
|
|
3306
|
+
const current = resolveOptionalNetwork(program2);
|
|
3315
3307
|
if (opts.mainnetOnly) {
|
|
3316
3308
|
display = display.filter((n) => !n.isTestnet);
|
|
3317
3309
|
} else if (opts.testnetOnly) {
|
|
@@ -3328,15 +3320,17 @@ function registerNetwork(program2) {
|
|
|
3328
3320
|
return;
|
|
3329
3321
|
}
|
|
3330
3322
|
const rows = display.map((network) => {
|
|
3331
|
-
const isCurrent = network.id === current;
|
|
3323
|
+
const isCurrent = current !== void 0 && network.id === current;
|
|
3332
3324
|
const idCell = isCurrent ? green(network.id) : network.id;
|
|
3333
3325
|
const nameCell = isCurrent ? green(network.name) : network.name;
|
|
3334
3326
|
const testnetCell = network.isTestnet ? dim("yes") : "no";
|
|
3335
3327
|
return [idCell, nameCell, network.family, testnetCell];
|
|
3336
3328
|
});
|
|
3337
3329
|
printTable(["Network ID", "Name", "Family", "Testnet"], rows);
|
|
3338
|
-
|
|
3330
|
+
if (current) {
|
|
3331
|
+
console.log(`
|
|
3339
3332
|
Current: ${green(current)}`);
|
|
3333
|
+
}
|
|
3340
3334
|
console.log(
|
|
3341
3335
|
` ${dim("Need Admin API chain identifiers (e.g. ETH_MAINNET)? See: app chains")}`
|
|
3342
3336
|
);
|
|
@@ -3348,7 +3342,7 @@ function registerNetwork(program2) {
|
|
|
3348
3342
|
printJSON({
|
|
3349
3343
|
mode: "all",
|
|
3350
3344
|
networks: display,
|
|
3351
|
-
currentNetwork: current
|
|
3345
|
+
currentNetwork: current ?? null
|
|
3352
3346
|
});
|
|
3353
3347
|
}
|
|
3354
3348
|
} catch (err) {
|
|
@@ -3400,7 +3394,7 @@ function formatTokenAmount(rawAmount, decimals) {
|
|
|
3400
3394
|
return frac ? `${whole}.${frac}` : whole;
|
|
3401
3395
|
}
|
|
3402
3396
|
async function fetchTokenDecimals(program2, tokenAddress, opts) {
|
|
3403
|
-
const client =
|
|
3397
|
+
const client = apiKeyClientFromFlags(
|
|
3404
3398
|
program2,
|
|
3405
3399
|
opts?.network ? { forceNetwork: opts.network } : void 0
|
|
3406
3400
|
);
|
|
@@ -5044,7 +5038,7 @@ function createAlchemyWalletTransport(apiKey) {
|
|
|
5044
5038
|
}
|
|
5045
5039
|
|
|
5046
5040
|
// src/lib/smart-wallet.ts
|
|
5047
|
-
async function ensureGasPolicyResolved(program2) {
|
|
5041
|
+
async function ensureGasPolicyResolved(program2, options = {}) {
|
|
5048
5042
|
const cfg = load();
|
|
5049
5043
|
if (!resolveGasSponsored(program2, cfg)) return void 0;
|
|
5050
5044
|
const existing = resolveGasPolicyId(program2, cfg);
|
|
@@ -5055,7 +5049,7 @@ async function ensureGasPolicyResolved(program2) {
|
|
|
5055
5049
|
if (!hasAuthLoginToken(cfg)) {
|
|
5056
5050
|
throw errNotLoggedInForPolicyLookup();
|
|
5057
5051
|
}
|
|
5058
|
-
const network = resolveNetwork(program2
|
|
5052
|
+
const network = options.networkOverride ?? resolveNetwork(program2);
|
|
5059
5053
|
const policyId = await selectOrCreatePolicy({
|
|
5060
5054
|
flavor: "sponsorship",
|
|
5061
5055
|
network,
|
|
@@ -5110,7 +5104,7 @@ function buildWalletClient(program2, options = {}) {
|
|
|
5110
5104
|
const apiKey = resolveAPIKey(program2);
|
|
5111
5105
|
if (!apiKey) throw errAuthRequired();
|
|
5112
5106
|
const cfg = load();
|
|
5113
|
-
const network = resolveNetwork(program2
|
|
5107
|
+
const network = options.networkOverride ?? resolveNetwork(program2);
|
|
5114
5108
|
const chain = networkToChain(network);
|
|
5115
5109
|
const gasSponsored = resolveGasSponsored(program2, cfg);
|
|
5116
5110
|
const gasPolicyId = options.gasPolicyIdOverride ?? resolveGasPolicyId(program2, cfg);
|
|
@@ -5152,7 +5146,9 @@ function buildWalletClient(program2, options = {}) {
|
|
|
5152
5146
|
address: evmSession.evmAddress
|
|
5153
5147
|
};
|
|
5154
5148
|
}
|
|
5155
|
-
if (!localKey)
|
|
5149
|
+
if (!localKey) {
|
|
5150
|
+
throw pref === "local" ? errWalletKeyRequired() : errWalletRequired();
|
|
5151
|
+
}
|
|
5156
5152
|
const account = privateKeyToAccount2(normalizeKey(localKey));
|
|
5157
5153
|
return {
|
|
5158
5154
|
signer: account,
|
|
@@ -5245,10 +5241,10 @@ function registerStatus(program2, options = {}) {
|
|
|
5245
5241
|
"after",
|
|
5246
5242
|
`
|
|
5247
5243
|
Examples:
|
|
5248
|
-
alchemy evm status call-123
|
|
5244
|
+
alchemy evm status call-123 -n eth-mainnet EVM smart wallet operation
|
|
5249
5245
|
alchemy evm status 0xTxHash... -n eth-mainnet Raw EVM transaction
|
|
5250
5246
|
alchemy solana status 5wHu1qwD7q... -n solana-devnet Solana transaction
|
|
5251
|
-
echo "call-123" | alchemy evm status
|
|
5247
|
+
echo "call-123" | alchemy evm status -n eth-mainnet
|
|
5252
5248
|
|
|
5253
5249
|
Tip: use an EVM network for operation IDs and tx hashes, or a Solana network for signatures.`
|
|
5254
5250
|
).action(async (idArg) => {
|
|
@@ -6236,10 +6232,8 @@ var ERROR_RECOVERY = {
|
|
|
6236
6232
|
AUTH_REQUIRED: "Set ALCHEMY_API_KEY env var or run: alchemy config set app",
|
|
6237
6233
|
INVALID_API_KEY: "Check your API key and select a valid app: alchemy config set app",
|
|
6238
6234
|
NETWORK_NOT_ENABLED: "Enable the target network for your app at dashboard.alchemy.com",
|
|
6239
|
-
INVALID_ACCESS_KEY: "Check your access key: https://dashboard.alchemy.com/",
|
|
6240
|
-
ACCESS_KEY_REQUIRED: "Set ALCHEMY_ACCESS_KEY env var or run: alchemy config set access-key <key>",
|
|
6241
6235
|
APP_REQUIRED: "Select an app: alchemy config set app <app-id>",
|
|
6242
|
-
ADMIN_API_ERROR: "Check the error message for details; verify
|
|
6236
|
+
ADMIN_API_ERROR: "Check the error message for details; verify account permissions",
|
|
6243
6237
|
NETWORK_ERROR: "Check internet connection and retry",
|
|
6244
6238
|
RPC_ERROR: "Check RPC method, params, and network; verify API key has access",
|
|
6245
6239
|
INVALID_ARGS: "Check command usage via: alchemy --json help <command>",
|
|
@@ -6355,11 +6349,10 @@ function buildAgentPrompt(program2) {
|
|
|
6355
6349
|
]
|
|
6356
6350
|
},
|
|
6357
6351
|
{
|
|
6358
|
-
method: "
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
notes: "No command-line flag exists for access-key auth; use the env var or saved config."
|
|
6352
|
+
method: "Alchemy login",
|
|
6353
|
+
setup: "alchemy auth login",
|
|
6354
|
+
commandFamilies: ["app", "evm network", "gas-manager"],
|
|
6355
|
+
notes: "Admin surfaces use the browser login session stored by `alchemy auth login`."
|
|
6363
6356
|
},
|
|
6364
6357
|
{
|
|
6365
6358
|
method: "Webhook API key",
|
|
@@ -6416,15 +6409,15 @@ function buildAgentPrompt(program2) {
|
|
|
6416
6409
|
examples: [
|
|
6417
6410
|
"alchemy --json --no-interactive config status",
|
|
6418
6411
|
"alchemy --json --no-interactive update-check",
|
|
6419
|
-
"alchemy --json --no-interactive evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --api-key $ALCHEMY_API_KEY",
|
|
6420
|
-
"
|
|
6421
|
-
"alchemy --json --no-interactive evm rpc eth_blockNumber --api-key $ALCHEMY_API_KEY",
|
|
6412
|
+
"alchemy --json --no-interactive evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --api-key $ALCHEMY_API_KEY -n eth-mainnet",
|
|
6413
|
+
"alchemy --json --no-interactive app list",
|
|
6414
|
+
"alchemy --json --no-interactive evm rpc eth_blockNumber --api-key $ALCHEMY_API_KEY -n eth-mainnet",
|
|
6422
6415
|
"alchemy --json --no-interactive evm network list",
|
|
6423
6416
|
"alchemy --json --no-interactive evm send 0xRecipient 0.001 --dry-run -n eth-sepolia",
|
|
6424
6417
|
`alchemy --json --no-interactive evm contract read 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 "balanceOf(address)(uint256)" --args '["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]' -n eth-mainnet`,
|
|
6425
6418
|
"alchemy --json --no-interactive evm swap quote --from 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE --to 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 --amount 1.0 --from-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet",
|
|
6426
|
-
"alchemy --json --no-interactive evm logs --from-block latest --limit 25",
|
|
6427
|
-
"alchemy --json --no-interactive evm block latest --summary",
|
|
6419
|
+
"alchemy --json --no-interactive evm logs --from-block latest --limit 25 -n eth-mainnet",
|
|
6420
|
+
"alchemy --json --no-interactive evm block latest --summary -n eth-mainnet",
|
|
6428
6421
|
"alchemy --json --no-interactive evm status 0xCallId -n eth-mainnet"
|
|
6429
6422
|
],
|
|
6430
6423
|
docs: "https://www.alchemy.com/docs"
|
|
@@ -6460,7 +6453,9 @@ function formatAsSystemPrompt(payload) {
|
|
|
6460
6453
|
lines.push("Auth methods:");
|
|
6461
6454
|
for (const auth of payload.auth) {
|
|
6462
6455
|
lines.push(` ${auth.method}:`);
|
|
6463
|
-
|
|
6456
|
+
if (auth.envVar) {
|
|
6457
|
+
lines.push(` env: ${auth.envVar}`);
|
|
6458
|
+
}
|
|
6464
6459
|
if (auth.flag) {
|
|
6465
6460
|
lines.push(` flag: ${auth.flag}`);
|
|
6466
6461
|
}
|
|
@@ -6744,11 +6739,11 @@ function registerApprove(program2) {
|
|
|
6744
6739
|
"after",
|
|
6745
6740
|
`
|
|
6746
6741
|
Examples:
|
|
6747
|
-
alchemy evm approve 0xRouter --token-address 0xUSDC --amount 100
|
|
6748
|
-
alchemy evm approve 0xRouter --token-address 0xUSDC --amount 100 --reset-first
|
|
6749
|
-
alchemy evm approve 0xRouter --token-address 0xUSDC --unlimited
|
|
6750
|
-
alchemy evm approve 0xRouter --token-address 0xUSDC --unlimited --yes
|
|
6751
|
-
alchemy evm approve 0xRouter --token-address 0xUSDC --revoke`
|
|
6742
|
+
alchemy evm approve 0xRouter --token-address 0xUSDC --amount 100 -n eth-mainnet
|
|
6743
|
+
alchemy evm approve 0xRouter --token-address 0xUSDC --amount 100 --reset-first -n eth-mainnet
|
|
6744
|
+
alchemy evm approve 0xRouter --token-address 0xUSDC --unlimited -n eth-mainnet
|
|
6745
|
+
alchemy evm approve 0xRouter --token-address 0xUSDC --unlimited --yes -n eth-mainnet
|
|
6746
|
+
alchemy evm approve 0xRouter --token-address 0xUSDC --revoke -n eth-mainnet`
|
|
6752
6747
|
).action(async (spenderArg, _opts, cmd) => {
|
|
6753
6748
|
try {
|
|
6754
6749
|
await performApprove(cmd, spenderArg, cmd.opts());
|
|
@@ -6770,8 +6765,8 @@ async function performApprove(program2, spenderArg, opts) {
|
|
|
6770
6765
|
signer,
|
|
6771
6766
|
...gasPolicyIdOverride && { gasPolicyIdOverride }
|
|
6772
6767
|
});
|
|
6773
|
-
const rpcClient =
|
|
6774
|
-
const tokenMeta = await fetchTokenDecimals(program2, opts.tokenAddress);
|
|
6768
|
+
const rpcClient = apiKeyClientFromFlags(program2, { forceNetwork: network });
|
|
6769
|
+
const tokenMeta = await fetchTokenDecimals(program2, opts.tokenAddress, { network });
|
|
6775
6770
|
const approval = buildApprovalRequest(opts, tokenMeta);
|
|
6776
6771
|
if (!await confirmUnlimitedApproval(program2, tokenMeta.symbol, spenderArg, opts)) {
|
|
6777
6772
|
return;
|
|
@@ -6887,9 +6882,9 @@ function registerBlock(program2) {
|
|
|
6887
6882
|
"after",
|
|
6888
6883
|
`
|
|
6889
6884
|
Examples:
|
|
6890
|
-
alchemy evm block latest
|
|
6891
|
-
alchemy evm block 17000000
|
|
6892
|
-
alchemy evm block 0x1`
|
|
6885
|
+
alchemy evm block latest -n eth-mainnet
|
|
6886
|
+
alchemy evm block 17000000 -n eth-mainnet
|
|
6887
|
+
alchemy evm block 0x1 -n eth-mainnet`
|
|
6893
6888
|
).action(async (blockId, opts) => {
|
|
6894
6889
|
try {
|
|
6895
6890
|
let blockParam;
|
|
@@ -7166,11 +7161,11 @@ function registerContract(program2) {
|
|
|
7166
7161
|
"after",
|
|
7167
7162
|
`
|
|
7168
7163
|
Examples:
|
|
7169
|
-
alchemy evm contract read 0xA0b8...USDC "balanceOf(address)(uint256)" --args '["0xHolder"]'
|
|
7170
|
-
alchemy evm contract read 0xA0b8...USDC "name()(string)"
|
|
7171
|
-
alchemy evm contract read 0xA0b8...USDC "decimals()(uint8)"
|
|
7172
|
-
alchemy evm contract read 0xContract balanceOf --abi-file ./erc20.json --args '["0xHolder"]'
|
|
7173
|
-
alchemy evm contract read 0xPool "quote((address,uint256))(uint256)" --args '[["0xToken", "1000000"]]' --block 12345678`
|
|
7164
|
+
alchemy evm contract read 0xA0b8...USDC "balanceOf(address)(uint256)" --args '["0xHolder"]' -n eth-mainnet
|
|
7165
|
+
alchemy evm contract read 0xA0b8...USDC "name()(string)" -n eth-mainnet
|
|
7166
|
+
alchemy evm contract read 0xA0b8...USDC "decimals()(uint8)" -n eth-mainnet
|
|
7167
|
+
alchemy evm contract read 0xContract balanceOf --abi-file ./erc20.json --args '["0xHolder"]' -n eth-mainnet
|
|
7168
|
+
alchemy evm contract read 0xPool "quote((address,uint256))(uint256)" --args '[["0xToken", "1000000"]]' --block 12345678 -n eth-mainnet`
|
|
7174
7169
|
).action(async (addressArg, functionArg, opts) => {
|
|
7175
7170
|
try {
|
|
7176
7171
|
await performContractRead(program2, addressArg, functionArg, opts);
|
|
@@ -7184,9 +7179,9 @@ Examples:
|
|
|
7184
7179
|
"after",
|
|
7185
7180
|
`
|
|
7186
7181
|
Examples:
|
|
7187
|
-
alchemy evm contract call 0xToken "approve(address,uint256)" --args '["0xSpender", "1000000"]'
|
|
7188
|
-
alchemy evm contract call 0xToken "transfer(address,uint256)" --args '["0xTo", "1000000"]'
|
|
7189
|
-
alchemy evm contract call 0xContract deposit --abi-file ./contract.json --value 0.1`
|
|
7182
|
+
alchemy evm contract call 0xToken "approve(address,uint256)" --args '["0xSpender", "1000000"]' -n eth-mainnet
|
|
7183
|
+
alchemy evm contract call 0xToken "transfer(address,uint256)" --args '["0xTo", "1000000"]' -n eth-mainnet
|
|
7184
|
+
alchemy evm contract call 0xContract deposit --abi-file ./contract.json --value 0.1 -n eth-mainnet`
|
|
7190
7185
|
).action(async (addressArg, functionArg, _opts, cmd2) => {
|
|
7191
7186
|
try {
|
|
7192
7187
|
const opts = cmd2.opts();
|
|
@@ -7250,7 +7245,7 @@ async function performContractCall(program2, addressArg, functionArg, opts) {
|
|
|
7250
7245
|
signer,
|
|
7251
7246
|
...gasPolicyIdOverride && { gasPolicyIdOverride }
|
|
7252
7247
|
});
|
|
7253
|
-
const rpcClient =
|
|
7248
|
+
const rpcClient = apiKeyClientFromFlags(program2, { forceNetwork: network });
|
|
7254
7249
|
const contractAddress = await resolveAddress(addressArg, rpcClient);
|
|
7255
7250
|
const data = encodeFunctionData2({ abi, functionName, args });
|
|
7256
7251
|
const value = opts.value !== void 0 ? parseEthValue(opts.value) : void 0;
|
|
@@ -7361,12 +7356,12 @@ function registerBalance(program2) {
|
|
|
7361
7356
|
"after",
|
|
7362
7357
|
`
|
|
7363
7358
|
Examples:
|
|
7364
|
-
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
7359
|
+
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet
|
|
7365
7360
|
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n polygon-mainnet
|
|
7366
|
-
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data balance
|
|
7367
|
-
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --block 15537393
|
|
7368
|
-
alchemy evm data balance vitalik.eth
|
|
7369
|
-
cat addresses.txt | alchemy evm data balance`
|
|
7361
|
+
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data balance -n eth-mainnet
|
|
7362
|
+
alchemy evm data balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --block 15537393 -n eth-mainnet
|
|
7363
|
+
alchemy evm data balance vitalik.eth -n eth-mainnet
|
|
7364
|
+
cat addresses.txt | alchemy evm data balance -n eth-mainnet`
|
|
7370
7365
|
).option("--block <block>", "Block number, hex, or tag (default: latest)").action(async (addressArg, opts) => {
|
|
7371
7366
|
try {
|
|
7372
7367
|
const blockParam = resolveBlockParam2(opts?.block);
|
|
@@ -7414,10 +7409,10 @@ function registerNFTs(program2) {
|
|
|
7414
7409
|
"after",
|
|
7415
7410
|
`
|
|
7416
7411
|
Examples:
|
|
7417
|
-
alchemy evm data nfts 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
7418
|
-
alchemy evm data nfts metadata --contract 0x... --token-id 1
|
|
7419
|
-
alchemy evm data nfts contract 0x...
|
|
7420
|
-
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data nfts`
|
|
7412
|
+
alchemy evm data nfts 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet
|
|
7413
|
+
alchemy evm data nfts metadata --contract 0x... --token-id 1 -n eth-mainnet
|
|
7414
|
+
alchemy evm data nfts contract 0x... -n eth-mainnet
|
|
7415
|
+
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data nfts -n eth-mainnet`
|
|
7421
7416
|
).action(async (addressArg, opts) => {
|
|
7422
7417
|
try {
|
|
7423
7418
|
const addressInput = addressArg ?? await readStdinArg("address");
|
|
@@ -7638,9 +7633,9 @@ function registerTokens(program2) {
|
|
|
7638
7633
|
"after",
|
|
7639
7634
|
`
|
|
7640
7635
|
Examples:
|
|
7641
|
-
alchemy evm data tokens balances 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
7642
|
-
alchemy evm data tokens balances 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --metadata
|
|
7643
|
-
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data tokens balances`
|
|
7636
|
+
alchemy evm data tokens balances 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet
|
|
7637
|
+
alchemy evm data tokens balances 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --metadata -n eth-mainnet
|
|
7638
|
+
echo 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 | alchemy evm data tokens balances -n eth-mainnet`
|
|
7644
7639
|
).action(async (addressArg, opts) => {
|
|
7645
7640
|
try {
|
|
7646
7641
|
const addressInput = addressArg ?? await readStdinArg("address");
|
|
@@ -7745,7 +7740,7 @@ Examples:
|
|
|
7745
7740
|
"after",
|
|
7746
7741
|
`
|
|
7747
7742
|
Examples:
|
|
7748
|
-
alchemy evm data tokens metadata 0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eB48`
|
|
7743
|
+
alchemy evm data tokens metadata 0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eB48 -n eth-mainnet`
|
|
7749
7744
|
).action(async (contract) => {
|
|
7750
7745
|
try {
|
|
7751
7746
|
validateAddress(contract);
|
|
@@ -7816,16 +7811,16 @@ function registerTransfers(program2) {
|
|
|
7816
7811
|
`
|
|
7817
7812
|
Examples:
|
|
7818
7813
|
# Outgoing transfers from an address
|
|
7819
|
-
alchemy evm data history 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
7814
|
+
alchemy evm data history 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet
|
|
7820
7815
|
|
|
7821
7816
|
# Incoming transfers to an address
|
|
7822
|
-
alchemy evm data history --to-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
7817
|
+
alchemy evm data history --to-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -n eth-mainnet
|
|
7823
7818
|
|
|
7824
7819
|
# Outgoing ERC-20 transfers only
|
|
7825
|
-
alchemy evm data history --from-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --category erc20
|
|
7820
|
+
alchemy evm data history --from-address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --category erc20 -n eth-mainnet
|
|
7826
7821
|
|
|
7827
7822
|
# Transfers within a block range
|
|
7828
|
-
alchemy evm data history 0xd8dA... --from-block 0x100000 --to-block latest`
|
|
7823
|
+
alchemy evm data history 0xd8dA... --from-block 0x100000 --to-block latest -n eth-mainnet`
|
|
7829
7824
|
).action(async (addressArg, opts) => {
|
|
7830
7825
|
try {
|
|
7831
7826
|
const client = clientFromFlags(program2);
|
|
@@ -8083,9 +8078,9 @@ function registerGas(program2) {
|
|
|
8083
8078
|
"after",
|
|
8084
8079
|
`
|
|
8085
8080
|
Examples:
|
|
8086
|
-
alchemy evm gas
|
|
8081
|
+
alchemy evm gas -n eth-mainnet
|
|
8087
8082
|
alchemy evm gas -n polygon-mainnet
|
|
8088
|
-
alchemy evm gas --json`
|
|
8083
|
+
alchemy evm gas --json -n eth-mainnet`
|
|
8089
8084
|
).action(async () => {
|
|
8090
8085
|
try {
|
|
8091
8086
|
const client = clientFromFlags(program2);
|
|
@@ -8197,10 +8192,10 @@ function registerLogs(program2) {
|
|
|
8197
8192
|
"after",
|
|
8198
8193
|
`
|
|
8199
8194
|
Examples:
|
|
8200
|
-
alchemy evm logs --from-block 18000000 --to-block 18000010
|
|
8201
|
-
alchemy evm logs --address 0xdAC17F958D2ee523a2206206994597C13D831ec7 --from-block 18000000 --to-block 18000010
|
|
8202
|
-
alchemy evm logs --address 0xdAC17F958D2ee523a2206206994597C13D831ec7 --topic 0xddf252ad...
|
|
8203
|
-
alchemy evm logs --from-block latest --json`
|
|
8195
|
+
alchemy evm logs --from-block 18000000 --to-block 18000010 -n eth-mainnet
|
|
8196
|
+
alchemy evm logs --address 0xdAC17F958D2ee523a2206206994597C13D831ec7 --from-block 18000000 --to-block 18000010 -n eth-mainnet
|
|
8197
|
+
alchemy evm logs --address 0xdAC17F958D2ee523a2206206994597C13D831ec7 --topic 0xddf252ad... -n eth-mainnet
|
|
8198
|
+
alchemy evm logs --from-block latest --json -n eth-mainnet`
|
|
8204
8199
|
).option("--address <address>", "Contract address to filter logs").option("--topic <topic...>", "Event topic(s) to filter (topic0, topic1, ...)").option("--from-block <block>", "Start block (number, hex, or tag)", "latest").option("--to-block <block>", "End block (number, hex, or tag)", "latest").option("--limit <n>", "Limit returned logs in output").action(async (opts) => {
|
|
8205
8200
|
try {
|
|
8206
8201
|
const outputLimit = parseOptionalInt(opts.limit, "--limit");
|
|
@@ -8289,10 +8284,10 @@ function registerReceipt(program2) {
|
|
|
8289
8284
|
"after",
|
|
8290
8285
|
`
|
|
8291
8286
|
Examples:
|
|
8292
|
-
alchemy evm receipt 0xabc123...
|
|
8293
|
-
echo 0xabc123... | alchemy evm receipt
|
|
8287
|
+
alchemy evm receipt 0xabc123... -n eth-mainnet
|
|
8288
|
+
echo 0xabc123... | alchemy evm receipt -n eth-mainnet
|
|
8294
8289
|
|
|
8295
|
-
Tip: use 'alchemy evm tx <hash>' for transaction details (value, block, nonce). Receipt provides execution results (status, gas used, logs).`
|
|
8290
|
+
Tip: use 'alchemy evm tx <hash> -n <net>' for transaction details (value, block, nonce). Receipt provides execution results (status, gas used, logs).`
|
|
8296
8291
|
).action(async (hashArg) => {
|
|
8297
8292
|
try {
|
|
8298
8293
|
const hash = hashArg ?? await readStdinArg("hash");
|
|
@@ -8356,9 +8351,9 @@ function registerRPC(program2) {
|
|
|
8356
8351
|
"after",
|
|
8357
8352
|
`
|
|
8358
8353
|
Examples:
|
|
8359
|
-
alchemy evm rpc eth_blockNumber
|
|
8360
|
-
alchemy evm rpc eth_getBalance "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" "latest"
|
|
8361
|
-
alchemy evm rpc eth_getBlockByNumber "0x1" true`
|
|
8354
|
+
alchemy evm rpc eth_blockNumber -n eth-mainnet
|
|
8355
|
+
alchemy evm rpc eth_getBalance "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" "latest" -n eth-mainnet
|
|
8356
|
+
alchemy evm rpc eth_getBlockByNumber "0x1" true -n eth-mainnet`
|
|
8362
8357
|
).action(async (method, params) => {
|
|
8363
8358
|
try {
|
|
8364
8359
|
if (outputRpcHelp(cmd, method, params)) {
|
|
@@ -8419,13 +8414,17 @@ function registerEvmSend(program2) {
|
|
|
8419
8414
|
sendCmd.option("--gas-sponsored", "Enable gas sponsorship (env: ALCHEMY_EVM_GAS_SPONSORED)").option("--gas-policy-id <id>", "Gas policy ID for sponsorship (env: ALCHEMY_EVM_GAS_POLICY_ID)").addHelpText(
|
|
8420
8415
|
"after",
|
|
8421
8416
|
`
|
|
8417
|
+
Omit --token to send the native token for the selected network.
|
|
8418
|
+
Network is required via -n/--network.
|
|
8419
|
+
|
|
8422
8420
|
Examples:
|
|
8423
|
-
alchemy evm send 0xAbC...123 1.5
|
|
8424
|
-
alchemy evm send vitalik.eth 0.1 -n base-mainnet
|
|
8425
|
-
alchemy evm send 0xAbC...123
|
|
8426
|
-
alchemy evm send 0xAbC...123
|
|
8427
|
-
alchemy evm send 0xAbC...123 1 --
|
|
8428
|
-
alchemy evm send 0xAbC...123 1
|
|
8421
|
+
alchemy evm send 0xAbC...123 1.5 -n eth-mainnet Send 1.5 ETH
|
|
8422
|
+
alchemy evm send vitalik.eth 0.1 -n base-mainnet Send 0.1 ETH on Base
|
|
8423
|
+
alchemy evm send 0xAbC...123 1 -n monad-testnet Send 1 MON
|
|
8424
|
+
alchemy evm send 0xAbC...123 100 --token 0xA0b8...USDC -n eth-mainnet Send 100 USDC
|
|
8425
|
+
alchemy evm send 0xAbC...123 1.5 --dry-run -n eth-mainnet Preview without signing or sending
|
|
8426
|
+
alchemy evm send 0xAbC...123 1 -n base-mainnet --gas-sponsored --gas-policy-id <id>
|
|
8427
|
+
alchemy evm send 0xAbC...123 1.5 --signer local -n eth-mainnet Force the local wallet`
|
|
8429
8428
|
).action(async (toArg, amountArg, _opts, cmd) => {
|
|
8430
8429
|
try {
|
|
8431
8430
|
const opts = cmd.opts();
|
|
@@ -8434,7 +8433,7 @@ Examples:
|
|
|
8434
8433
|
dryRun: opts.dryRun
|
|
8435
8434
|
});
|
|
8436
8435
|
} catch (err) {
|
|
8437
|
-
const { exitWithError: exitWithError2 } = await import("./errors-
|
|
8436
|
+
const { exitWithError: exitWithError2 } = await import("./errors-6BEPCY5N.js");
|
|
8438
8437
|
exitWithError2(err);
|
|
8439
8438
|
}
|
|
8440
8439
|
});
|
|
@@ -8443,17 +8442,25 @@ async function performEvmSend(program2, toArg, amountArg, tokenAddress, opts = {
|
|
|
8443
8442
|
if (tokenAddress) {
|
|
8444
8443
|
validateAddress(tokenAddress);
|
|
8445
8444
|
}
|
|
8446
|
-
const
|
|
8447
|
-
const
|
|
8445
|
+
const network = resolveRequiredNetwork(program2);
|
|
8446
|
+
const gasPolicyIdOverride = await ensureGasPolicyResolved(program2, {
|
|
8447
|
+
networkOverride: network
|
|
8448
|
+
});
|
|
8449
|
+
const { client, address: from, paymaster } = buildWalletClient(program2, {
|
|
8448
8450
|
signer: opts.signer,
|
|
8451
|
+
networkOverride: network,
|
|
8449
8452
|
...gasPolicyIdOverride && { gasPolicyIdOverride }
|
|
8450
8453
|
});
|
|
8451
|
-
const rpcClient =
|
|
8454
|
+
const rpcClient = apiKeyClientFromFlags(program2, {
|
|
8455
|
+
forceNetwork: network
|
|
8456
|
+
});
|
|
8452
8457
|
const to = await resolveAddress(toArg, rpcClient);
|
|
8453
8458
|
let decimals;
|
|
8454
8459
|
let symbol;
|
|
8455
8460
|
if (tokenAddress) {
|
|
8456
|
-
const meta = await fetchTokenDecimals(program2, tokenAddress
|
|
8461
|
+
const meta = await fetchTokenDecimals(program2, tokenAddress, {
|
|
8462
|
+
network
|
|
8463
|
+
});
|
|
8457
8464
|
decimals = meta.decimals;
|
|
8458
8465
|
symbol = meta.symbol;
|
|
8459
8466
|
} else {
|
|
@@ -8611,8 +8618,7 @@ import { parseAccount } from "viem/accounts";
|
|
|
8611
8618
|
function buildWalletQuoteClient(program2, address3) {
|
|
8612
8619
|
const apiKey = resolveAPIKey(program2);
|
|
8613
8620
|
if (!apiKey) throw errAuthRequired();
|
|
8614
|
-
const
|
|
8615
|
-
const network = resolveNetwork(program2, cfg);
|
|
8621
|
+
const network = resolveNetwork(program2);
|
|
8616
8622
|
const chain = networkToChain(network);
|
|
8617
8623
|
const client = createClient({
|
|
8618
8624
|
account: parseAccount(address3),
|
|
@@ -8715,7 +8721,7 @@ async function resolveTokenInfo(network, program2, tokenAddress) {
|
|
|
8715
8721
|
return { decimals: NATIVE_DECIMALS, symbol: nativeTokenSymbol(network) };
|
|
8716
8722
|
}
|
|
8717
8723
|
try {
|
|
8718
|
-
return await fetchTokenDecimals(program2, tokenAddress);
|
|
8724
|
+
return await fetchTokenDecimals(program2, tokenAddress, { network });
|
|
8719
8725
|
} catch (err) {
|
|
8720
8726
|
if (err instanceof CLIError && err.code === "INVALID_ARGS") {
|
|
8721
8727
|
throw err;
|
|
@@ -8781,14 +8787,14 @@ function registerSwap(program2) {
|
|
|
8781
8787
|
quoteCmd.addHelpText(
|
|
8782
8788
|
"after",
|
|
8783
8789
|
`
|
|
8784
|
-
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
8790
|
+
Tip: use 'alchemy evm token <SYMBOL> -n <net>' to resolve common token addresses
|
|
8785
8791
|
(ETH, USDC, WETH, USDT, DAI, \u2026). Example:
|
|
8786
|
-
--from $(alchemy evm token ETH --address-only) \\
|
|
8792
|
+
--from $(alchemy evm token ETH --address-only -n eth-mainnet) \\
|
|
8787
8793
|
--to $(alchemy evm token USDC --address-only -n eth-mainnet)
|
|
8788
8794
|
|
|
8789
8795
|
Examples:
|
|
8790
8796
|
alchemy evm swap quote --from 0xEeee...EEeE --to 0xA0b8...USDC --amount 1.0 -n eth-mainnet
|
|
8791
|
-
alchemy evm swap quote --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0`
|
|
8797
|
+
alchemy evm swap quote --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0 -n eth-mainnet`
|
|
8792
8798
|
).action(async (opts) => {
|
|
8793
8799
|
try {
|
|
8794
8800
|
await performSwapQuote(program2, opts);
|
|
@@ -8801,14 +8807,14 @@ Examples:
|
|
|
8801
8807
|
executeCmd.option("--gas-sponsored", "Enable gas sponsorship (env: ALCHEMY_EVM_GAS_SPONSORED)").option("--gas-policy-id <id>", "Gas policy ID for sponsorship (env: ALCHEMY_EVM_GAS_POLICY_ID)").addHelpText(
|
|
8802
8808
|
"after",
|
|
8803
8809
|
`
|
|
8804
|
-
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
8805
|
-
(ETH, USDC, WETH, USDT, DAI, \u2026). Run 'alchemy evm token list' to discover
|
|
8806
|
-
known symbols on
|
|
8810
|
+
Tip: use 'alchemy evm token <SYMBOL> -n <net>' to resolve common token addresses
|
|
8811
|
+
(ETH, USDC, WETH, USDT, DAI, \u2026). Run 'alchemy evm token list -n <net>' to discover
|
|
8812
|
+
known symbols on that network.
|
|
8807
8813
|
|
|
8808
8814
|
Examples:
|
|
8809
8815
|
alchemy evm swap execute --from 0xEeee...EEeE --to 0xA0b8...USDC --amount 1.0 -n eth-mainnet
|
|
8810
|
-
alchemy evm swap execute --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0
|
|
8811
|
-
alchemy evm swap execute --from 0xEeee...EEeE --to 0xUSDC --amount 0.1 --gas-sponsored --gas-policy-id <id
|
|
8816
|
+
alchemy evm swap execute --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0 -n eth-mainnet
|
|
8817
|
+
alchemy evm swap execute --from 0xEeee...EEeE --to 0xUSDC --amount 0.1 --gas-sponsored --gas-policy-id <id> -n eth-mainnet`
|
|
8812
8818
|
).action(async (_opts, cmd2) => {
|
|
8813
8819
|
try {
|
|
8814
8820
|
const opts = cmd2.opts();
|
|
@@ -8991,20 +8997,20 @@ applicable. The native gas token (ETH, POL, BNB, AVAX, \u2026) resolves to the
|
|
|
8991
8997
|
EIP-7528 native sentinel 0xEeee\u2026EEeE.
|
|
8992
8998
|
|
|
8993
8999
|
Examples:
|
|
8994
|
-
alchemy evm token ETH
|
|
9000
|
+
alchemy evm token ETH -n eth-mainnet
|
|
8995
9001
|
alchemy evm token USDC -n base-mainnet
|
|
8996
9002
|
alchemy evm token USDC.e -n arb-mainnet
|
|
8997
|
-
alchemy evm token USDC --address-only
|
|
8998
|
-
alchemy --json evm token USDC | jq -r .address
|
|
9003
|
+
alchemy evm token USDC --address-only -n base-mainnet
|
|
9004
|
+
alchemy --json evm token USDC -n base-mainnet | jq -r .address
|
|
8999
9005
|
|
|
9000
|
-
alchemy evm token list
|
|
9006
|
+
alchemy evm token list -n eth-mainnet
|
|
9001
9007
|
alchemy evm token list --all # list tokens across all networks`
|
|
9002
9008
|
).action(async (symbol, opts) => {
|
|
9003
9009
|
try {
|
|
9004
9010
|
if (!symbol) {
|
|
9005
9011
|
if (opts.addressOnly) {
|
|
9006
9012
|
throw errInvalidArgs(
|
|
9007
|
-
"--address-only requires a symbol. Example: alchemy evm token USDC --address-only"
|
|
9013
|
+
"--address-only requires a symbol. Example: alchemy evm token USDC --address-only -n base-mainnet"
|
|
9008
9014
|
);
|
|
9009
9015
|
}
|
|
9010
9016
|
await runList(program2, {});
|
|
@@ -9079,7 +9085,7 @@ async function runList(program2, opts) {
|
|
|
9079
9085
|
}
|
|
9080
9086
|
console.log(
|
|
9081
9087
|
`
|
|
9082
|
-
${dim("Tip: pass -n/--network <net> to scope a lookup. Use 'alchemy evm token <SYMBOL>' to fetch a single address.")}`
|
|
9088
|
+
${dim("Tip: pass -n/--network <net> to scope a lookup. Use 'alchemy evm token <SYMBOL> -n <net>' to fetch a single address.")}`
|
|
9083
9089
|
);
|
|
9084
9090
|
return;
|
|
9085
9091
|
}
|
|
@@ -9100,7 +9106,7 @@ async function runList(program2, opts) {
|
|
|
9100
9106
|
printTokenTable(tokens);
|
|
9101
9107
|
console.log(
|
|
9102
9108
|
`
|
|
9103
|
-
${dim("Tip: 'alchemy evm token <SYMBOL>' resolves one symbol. Add --all to see every network.")}`
|
|
9109
|
+
${dim("Tip: 'alchemy evm token <SYMBOL> -n <net>' resolves one symbol. Add --all to see every network.")}`
|
|
9104
9110
|
);
|
|
9105
9111
|
}
|
|
9106
9112
|
function printTokenTable(tokens) {
|
|
@@ -9146,10 +9152,10 @@ function registerTx(program2) {
|
|
|
9146
9152
|
"after",
|
|
9147
9153
|
`
|
|
9148
9154
|
Examples:
|
|
9149
|
-
alchemy evm tx 0xabc123...
|
|
9150
|
-
echo 0xabc123... | alchemy evm tx
|
|
9155
|
+
alchemy evm tx 0xabc123... -n eth-mainnet
|
|
9156
|
+
echo 0xabc123... | alchemy evm tx -n eth-mainnet
|
|
9151
9157
|
|
|
9152
|
-
Tip: use 'alchemy evm receipt <hash>' to get the transaction receipt (status, gas used, logs).`
|
|
9158
|
+
Tip: use 'alchemy evm receipt <hash> -n <net>' to get the transaction receipt (status, gas used, logs).`
|
|
9153
9159
|
).action(async (hashArg) => {
|
|
9154
9160
|
try {
|
|
9155
9161
|
const hash = hashArg ?? await readStdinArg("hash");
|
|
@@ -9497,7 +9503,7 @@ function registerBridge(program2) {
|
|
|
9497
9503
|
Source network comes from the global -n/--network flag. Use --to-network for the destination chain.
|
|
9498
9504
|
For same-chain token exchanges, use 'alchemy evm swap'.
|
|
9499
9505
|
|
|
9500
|
-
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
9506
|
+
Tip: use 'alchemy evm token <SYMBOL> -n <net>' to resolve common token addresses
|
|
9501
9507
|
(ETH, USDC, WETH, USDT, DAI, \u2026) per chain.
|
|
9502
9508
|
|
|
9503
9509
|
Examples:
|
|
@@ -9518,7 +9524,7 @@ Examples:
|
|
|
9518
9524
|
Source network comes from the global -n/--network flag. Use --to-network for the destination chain.
|
|
9519
9525
|
For same-chain token exchanges, use 'alchemy evm swap'.
|
|
9520
9526
|
|
|
9521
|
-
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
9527
|
+
Tip: use 'alchemy evm token <SYMBOL> -n <net>' to resolve common token addresses
|
|
9522
9528
|
(ETH, USDC, WETH, USDT, DAI, \u2026) per chain.
|
|
9523
9529
|
|
|
9524
9530
|
Examples:
|
|
@@ -10203,11 +10209,10 @@ function doctorSetupStatus(setup) {
|
|
|
10203
10209
|
...setup,
|
|
10204
10210
|
complete: x402OnlySetup ? false : setup.complete,
|
|
10205
10211
|
satisfiedBy: x402OnlySetup ? null : setup.satisfiedBy,
|
|
10206
|
-
missing: x402OnlySetup ? ["Provide one auth path: alchemy auth OR api-key
|
|
10212
|
+
missing: x402OnlySetup ? ["Provide one auth path: alchemy auth OR api-key"] : removeX402SetupMissing(setup.missing),
|
|
10207
10213
|
nextCommands: x402OnlySetup ? [
|
|
10208
10214
|
"alchemy auth",
|
|
10209
|
-
"alchemy config set app"
|
|
10210
|
-
"alchemy config set access-key <key> && alchemy config set app <app-id>"
|
|
10215
|
+
"alchemy config set app"
|
|
10211
10216
|
] : removeX402NextCommands(setup.nextCommands),
|
|
10212
10217
|
capabilities: sanitizedCapabilities
|
|
10213
10218
|
};
|
|
@@ -10351,9 +10356,9 @@ async function flushProcessOutput() {
|
|
|
10351
10356
|
}
|
|
10352
10357
|
program.name("alchemy").description(
|
|
10353
10358
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
10354
|
-
).version("0.
|
|
10359
|
+
).version("0.11.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
|
|
10355
10360
|
"-n, --network <network>",
|
|
10356
|
-
"Target network
|
|
10361
|
+
"Target network for networked commands"
|
|
10357
10362
|
).option("--x402", "Use x402 wallet-based gateway auth").option(
|
|
10358
10363
|
"--wallet-key-file <path>",
|
|
10359
10364
|
"Path to wallet private key file for x402"
|
|
@@ -10489,9 +10494,9 @@ ${styledLine}`;
|
|
|
10489
10494
|
`${hBrand("\u25C6")} ${hBold("Quick Start")}`,
|
|
10490
10495
|
` ${hDim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}`,
|
|
10491
10496
|
` ${hBrand("alchemy")} ${hDim("Interactive mode with guided setup")}`,
|
|
10492
|
-
` ${hBrand("alchemy evm data balance")} ${hDim("<address>")}
|
|
10493
|
-
` ${hBrand("alchemy evm block latest")}
|
|
10494
|
-
` ${hBrand("alchemy evm rpc eth_chainId")}
|
|
10497
|
+
` ${hBrand("alchemy evm data balance")} ${hDim("<address> -n eth-mainnet")} ${hDim("Get native token balance")}`,
|
|
10498
|
+
` ${hBrand("alchemy evm block latest")} ${hDim("-n eth-mainnet")} ${hDim("Latest block summary")}`,
|
|
10499
|
+
` ${hBrand("alchemy evm rpc eth_chainId")} ${hDim("-n eth-mainnet")} ${hDim("Raw JSON-RPC call")}`,
|
|
10495
10500
|
` ${hBrand("alchemy config list")} ${hDim("View current configuration")}`,
|
|
10496
10501
|
"",
|
|
10497
10502
|
`${hBrand("\u25C6")} ${hBold("Exit Codes")}`,
|
|
@@ -10538,11 +10543,11 @@ ${styledLine}`;
|
|
|
10538
10543
|
"wallet"
|
|
10539
10544
|
];
|
|
10540
10545
|
if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
|
|
10541
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
10546
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-FRMIY357.js");
|
|
10542
10547
|
const authToken = resolveAuthToken2(cfg);
|
|
10543
10548
|
const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
|
|
10544
10549
|
if (authToken && !hasApiKey) {
|
|
10545
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
10550
|
+
const { selectAppAfterAuth } = await import("./auth-6X2DBBYQ.js");
|
|
10546
10551
|
console.log("");
|
|
10547
10552
|
console.log(` No app selected. Please select an app to continue.`);
|
|
10548
10553
|
await selectAppAfterAuth(authToken);
|
|
@@ -10577,7 +10582,7 @@ ${styledLine}`;
|
|
|
10577
10582
|
if (isInteractiveAllowed(program)) {
|
|
10578
10583
|
let latestForInteractiveStartup = null;
|
|
10579
10584
|
if (shouldRunOnboarding(program, cfg)) {
|
|
10580
|
-
const { runOnboarding } = await import("./onboarding-
|
|
10585
|
+
const { runOnboarding } = await import("./onboarding-2FLKQYLY.js");
|
|
10581
10586
|
const latest = getAvailableUpdateOnce();
|
|
10582
10587
|
const completed = await runOnboarding(program, latest);
|
|
10583
10588
|
updateShownDuringInteractiveStartup = Boolean(latest);
|
|
@@ -10591,7 +10596,7 @@ ${styledLine}`;
|
|
|
10591
10596
|
latestForInteractiveStartup
|
|
10592
10597
|
);
|
|
10593
10598
|
}
|
|
10594
|
-
const { startREPL } = await import("./interactive-
|
|
10599
|
+
const { startREPL } = await import("./interactive-EXQM6HWQ.js");
|
|
10595
10600
|
program.exitOverride();
|
|
10596
10601
|
program.configureOutput({
|
|
10597
10602
|
writeErr: () => {
|