@alchemy/cli 0.12.0 → 0.14.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/dist/{auth-5XFZB2BU.js → auth-57YPPTNF.js} +2 -2
- package/dist/auth-ZBEPAFEP.js +16 -0
- package/dist/{chunk-BFOZ2KM7.js → chunk-22KBYYLI.js} +3 -3
- package/dist/{chunk-5BEJA752.js → chunk-CFIDLPKB.js} +12 -0
- package/dist/{chunk-OL5MEN62.js → chunk-CXR7CCJ7.js} +43 -5
- package/dist/{chunk-I6YQX7PF.js → chunk-CZWKHYTE.js} +1 -1
- package/dist/{chunk-RPSHRYCZ.js → chunk-EJB4WDTU.js} +1 -1
- package/dist/{chunk-CJDHJYLM.js → chunk-M7HFRKW6.js} +4 -4
- package/dist/{chunk-DXQAGBW6.js → chunk-OIRERSZT.js} +1 -1
- package/dist/{chunk-LANOFNO6.js → chunk-PISUI34T.js} +1 -1
- package/dist/{chunk-2VVJKVRL.js → chunk-RQDWIB62.js} +2 -2
- package/dist/{chunk-ILPOKA4Y.js → chunk-WDGPT4OT.js} +6 -6
- package/dist/{errors-6BEPCY5N.js → errors-VS7SGW7B.js} +3 -1
- package/dist/index.js +261 -53
- package/dist/{interactive-6L2HNSOS.js → interactive-XNDXNMAJ.js} +7 -7
- package/dist/{onboarding-RXNSVGSW.js → onboarding-QE43IUEK.js} +6 -6
- package/dist/{policy-prompt-YU6L2VJZ.js → policy-prompt-UNNIF63S.js} +5 -5
- package/dist/{resolve-WXXPXPCU.js → resolve-IRTGQL4A.js} +3 -3
- package/package.json +1 -1
- package/dist/auth-AU7LPEQL.js +0 -16
|
@@ -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-WDGPT4OT.js";
|
|
7
|
+
import "./chunk-CZWKHYTE.js";
|
|
8
|
+
import "./chunk-EJB4WDTU.js";
|
|
9
|
+
import "./chunk-CXR7CCJ7.js";
|
|
10
|
+
import "./chunk-OIRERSZT.js";
|
|
11
|
+
import "./chunk-PISUI34T.js";
|
|
12
|
+
import "./chunk-CFIDLPKB.js";
|
|
13
|
+
export {
|
|
14
|
+
registerAuth,
|
|
15
|
+
selectAppAfterAuth
|
|
16
|
+
};
|
|
@@ -2,10 +2,10 @@
|
|
|
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-PISUI34T.js";
|
|
6
6
|
import {
|
|
7
7
|
esc
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CFIDLPKB.js";
|
|
9
9
|
|
|
10
10
|
// src/lib/update-check.ts
|
|
11
11
|
import { execFileSync } from "child_process";
|
|
@@ -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.14.0" : "0.0.0";
|
|
57
57
|
}
|
|
58
58
|
function toUpdateStatus(latestVersion, checkedAt) {
|
|
59
59
|
const current = currentVersion();
|
|
@@ -301,6 +301,7 @@ var ErrorCode = {
|
|
|
301
301
|
PAYMENT_REQUIRED: "PAYMENT_REQUIRED",
|
|
302
302
|
SETUP_REQUIRED: "SETUP_REQUIRED",
|
|
303
303
|
QUOTE_FAILED: "QUOTE_FAILED",
|
|
304
|
+
PREFLIGHT_REVERT: "PREFLIGHT_REVERT",
|
|
304
305
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
305
306
|
};
|
|
306
307
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
@@ -321,6 +322,7 @@ var EXIT_CODES = {
|
|
|
321
322
|
PAYMENT_REQUIRED: 9,
|
|
322
323
|
SETUP_REQUIRED: 3,
|
|
323
324
|
QUOTE_FAILED: 10,
|
|
325
|
+
PREFLIGHT_REVERT: 11,
|
|
324
326
|
INTERNAL_ERROR: 1
|
|
325
327
|
};
|
|
326
328
|
var CLIError = class extends Error {
|
|
@@ -414,6 +416,15 @@ function errRPC(code, message) {
|
|
|
414
416
|
function errInvalidArgs(detail) {
|
|
415
417
|
return new CLIError(ErrorCode.INVALID_ARGS, detail);
|
|
416
418
|
}
|
|
419
|
+
function errPreflightRevert(reason, details) {
|
|
420
|
+
return new CLIError(
|
|
421
|
+
ErrorCode.PREFLIGHT_REVERT,
|
|
422
|
+
`Transaction preflight reverted: ${reason}`,
|
|
423
|
+
"Fix the revert reason, lower the amount, adjust allowance/balance, or try a dry run before submitting again.",
|
|
424
|
+
details,
|
|
425
|
+
{ reason }
|
|
426
|
+
);
|
|
427
|
+
}
|
|
417
428
|
function errNotFound(resource) {
|
|
418
429
|
return new CLIError(ErrorCode.NOT_FOUND, `Not found: ${resource}`);
|
|
419
430
|
}
|
|
@@ -549,6 +560,7 @@ export {
|
|
|
549
560
|
errNetworkRequired,
|
|
550
561
|
errRPC,
|
|
551
562
|
errInvalidArgs,
|
|
563
|
+
errPreflightRevert,
|
|
552
564
|
errNotFound,
|
|
553
565
|
errRateLimited,
|
|
554
566
|
errAccessDenied,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
configDir,
|
|
5
5
|
load,
|
|
6
6
|
save
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PISUI34T.js";
|
|
8
8
|
import {
|
|
9
9
|
CLIError,
|
|
10
10
|
ErrorCode,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
redactSensitiveText,
|
|
31
31
|
timeout,
|
|
32
32
|
verbose
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-CFIDLPKB.js";
|
|
34
34
|
|
|
35
35
|
// src/lib/resolve.ts
|
|
36
36
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -1092,7 +1092,7 @@ var AdminClient = class _AdminClient {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
async updateNetworkAllowlist(id, networks) {
|
|
1094
1094
|
const resp = await this.request("PUT", `/v1/apps/${id}/networks`, {
|
|
1095
|
-
|
|
1095
|
+
networkAllowlist: networks
|
|
1096
1096
|
});
|
|
1097
1097
|
return resp.data;
|
|
1098
1098
|
}
|
|
@@ -1272,8 +1272,10 @@ var walletSessionCapabilitiesSchema = z.object({
|
|
|
1272
1272
|
"evm.signMessage": z.boolean().optional(),
|
|
1273
1273
|
"evm.signTypedData": z.boolean().optional(),
|
|
1274
1274
|
"evm.signAuthorization": z.boolean().optional(),
|
|
1275
|
+
"evm.prepareCalls": z.boolean().optional(),
|
|
1276
|
+
"evm.sendCalls": z.boolean().optional(),
|
|
1275
1277
|
"solana.signTransaction": z.boolean().optional()
|
|
1276
|
-
}).
|
|
1278
|
+
}).catchall(z.boolean());
|
|
1277
1279
|
var walletSessionEnvironmentSchema = z.object({
|
|
1278
1280
|
platform: z.string().min(1),
|
|
1279
1281
|
arch: z.string().min(1),
|
|
@@ -1320,6 +1322,42 @@ var walletSessionSchema = z.object({
|
|
|
1320
1322
|
solana: chainWalletSessionSchema.optional()
|
|
1321
1323
|
}).strict().optional()
|
|
1322
1324
|
}).strict();
|
|
1325
|
+
var LEGACY_PERSISTED_CAPABILITY_KEYS = [
|
|
1326
|
+
"evm.signMessage",
|
|
1327
|
+
"evm.signTypedData",
|
|
1328
|
+
"evm.signAuthorization",
|
|
1329
|
+
"solana.signTransaction"
|
|
1330
|
+
];
|
|
1331
|
+
function persistedCapabilities(capabilities) {
|
|
1332
|
+
if (!capabilities) return void 0;
|
|
1333
|
+
const persisted = {};
|
|
1334
|
+
for (const key of LEGACY_PERSISTED_CAPABILITY_KEYS) {
|
|
1335
|
+
const value = capabilities[key];
|
|
1336
|
+
if (value !== void 0) {
|
|
1337
|
+
persisted[key] = value;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return Object.keys(persisted).length > 0 ? persisted : void 0;
|
|
1341
|
+
}
|
|
1342
|
+
function withPersistedChainCapabilities(chainSession) {
|
|
1343
|
+
const { capabilities, ...rest } = chainSession;
|
|
1344
|
+
const persisted = persistedCapabilities(capabilities);
|
|
1345
|
+
return persisted ? { ...rest, capabilities: persisted } : rest;
|
|
1346
|
+
}
|
|
1347
|
+
function toPersistedSession(session) {
|
|
1348
|
+
const aliased = withCompatibilityAliases(session);
|
|
1349
|
+
const { capabilities, sessionsByChain, ...rest } = aliased;
|
|
1350
|
+
const persistedCapabilitiesForSession = persistedCapabilities(capabilities);
|
|
1351
|
+
const persistedSessionsByChain = sessionsByChain ? {
|
|
1352
|
+
...sessionsByChain.evm ? { evm: withPersistedChainCapabilities(sessionsByChain.evm) } : {},
|
|
1353
|
+
...sessionsByChain.solana ? { solana: withPersistedChainCapabilities(sessionsByChain.solana) } : {}
|
|
1354
|
+
} : void 0;
|
|
1355
|
+
return {
|
|
1356
|
+
...rest,
|
|
1357
|
+
...persistedCapabilitiesForSession ? { capabilities: persistedCapabilitiesForSession } : {},
|
|
1358
|
+
...persistedSessionsByChain ? { sessionsByChain: persistedSessionsByChain } : {}
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1323
1361
|
function sessionPath() {
|
|
1324
1362
|
return join(configDir(), SESSION_FILE);
|
|
1325
1363
|
}
|
|
@@ -1475,7 +1513,7 @@ function loadStoredSession() {
|
|
|
1475
1513
|
return store.load();
|
|
1476
1514
|
}
|
|
1477
1515
|
function saveSession(session) {
|
|
1478
|
-
getWalletSessionStore().save(
|
|
1516
|
+
getWalletSessionStore().save(toPersistedSession(session));
|
|
1479
1517
|
}
|
|
1480
1518
|
function updateSession(updates) {
|
|
1481
1519
|
const session = loadSession();
|
|
@@ -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-CXR7CCJ7.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-OIRERSZT.js";
|
|
15
15
|
import {
|
|
16
16
|
load,
|
|
17
17
|
save
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PISUI34T.js";
|
|
19
19
|
import {
|
|
20
20
|
errAppRequired,
|
|
21
21
|
errInvalidArgs,
|
|
22
22
|
errLoginRequired
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CFIDLPKB.js";
|
|
24
24
|
|
|
25
25
|
// src/lib/policy-prompt.ts
|
|
26
26
|
var CREATE_NEW_SENTINEL = "__create_new__";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
isInteractiveAllowed
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EJB4WDTU.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveAuthToken,
|
|
8
8
|
resolveWalletSession
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CXR7CCJ7.js";
|
|
10
10
|
|
|
11
11
|
// src/lib/onboarding.ts
|
|
12
12
|
var SETUP_CAPABILITY_ORDER = [
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
completeLogin,
|
|
5
5
|
prepareLogin,
|
|
6
6
|
revokeToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CZWKHYTE.js";
|
|
8
8
|
import {
|
|
9
9
|
isInteractiveAllowed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EJB4WDTU.js";
|
|
11
11
|
import {
|
|
12
12
|
AdminClient,
|
|
13
13
|
resolveAuthToken
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CXR7CCJ7.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-OIRERSZT.js";
|
|
24
24
|
import {
|
|
25
25
|
configPath,
|
|
26
26
|
load,
|
|
27
27
|
maskIf,
|
|
28
28
|
save
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PISUI34T.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-CFIDLPKB.js";
|
|
38
38
|
|
|
39
39
|
// src/commands/auth.ts
|
|
40
40
|
function registerAuth(program) {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
errNetworkRequired,
|
|
17
17
|
errNoActiveSession,
|
|
18
18
|
errNotFound,
|
|
19
|
+
errPreflightRevert,
|
|
19
20
|
errRPC,
|
|
20
21
|
errRateLimited,
|
|
21
22
|
errSessionExpired,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
exitWithError,
|
|
28
29
|
isReplMode,
|
|
29
30
|
setReplMode
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CFIDLPKB.js";
|
|
31
32
|
export {
|
|
32
33
|
CLIError,
|
|
33
34
|
EXIT_CODES,
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
errNetworkRequired,
|
|
45
46
|
errNoActiveSession,
|
|
46
47
|
errNotFound,
|
|
48
|
+
errPreflightRevert,
|
|
47
49
|
errRPC,
|
|
48
50
|
errRateLimited,
|
|
49
51
|
errSessionExpired,
|
package/dist/index.js
CHANGED
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-M7HFRKW6.js";
|
|
9
9
|
import {
|
|
10
10
|
registerAuth
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WDGPT4OT.js";
|
|
12
12
|
import {
|
|
13
13
|
openBrowser
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CZWKHYTE.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-RQDWIB62.js";
|
|
22
22
|
import {
|
|
23
23
|
isInteractiveAllowed
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-EJB4WDTU.js";
|
|
25
25
|
import {
|
|
26
26
|
RpcApiError,
|
|
27
27
|
adminClientFromFlags,
|
|
@@ -63,12 +63,12 @@ import {
|
|
|
63
63
|
updateSession,
|
|
64
64
|
validateNetwork,
|
|
65
65
|
walletNetworkToChain
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-CXR7CCJ7.js";
|
|
67
67
|
import {
|
|
68
68
|
getAvailableUpdate,
|
|
69
69
|
getUpdateStatus,
|
|
70
70
|
printUpdateNotice
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-22KBYYLI.js";
|
|
72
72
|
import {
|
|
73
73
|
bold,
|
|
74
74
|
brand,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
weiToEth,
|
|
93
93
|
withSpinner,
|
|
94
94
|
yellow
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-OIRERSZT.js";
|
|
96
96
|
import {
|
|
97
97
|
KEY_MAP,
|
|
98
98
|
configDir,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
save,
|
|
104
104
|
toMap,
|
|
105
105
|
validKeys
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-PISUI34T.js";
|
|
107
107
|
import {
|
|
108
108
|
CLIError,
|
|
109
109
|
EXIT_CODES,
|
|
@@ -116,6 +116,7 @@ import {
|
|
|
116
116
|
errNetwork,
|
|
117
117
|
errNoActiveSession,
|
|
118
118
|
errNotFound,
|
|
119
|
+
errPreflightRevert,
|
|
119
120
|
errRPC,
|
|
120
121
|
errRateLimited,
|
|
121
122
|
errSessionExpired,
|
|
@@ -144,7 +145,7 @@ import {
|
|
|
144
145
|
setNoColor,
|
|
145
146
|
timeout,
|
|
146
147
|
verbose
|
|
147
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-CFIDLPKB.js";
|
|
148
149
|
|
|
149
150
|
// src/index.ts
|
|
150
151
|
import { Command, Help } from "commander";
|
|
@@ -581,8 +582,8 @@ function registerConfig(program2) {
|
|
|
581
582
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set evm-gas-policy-id <id>`."
|
|
582
583
|
);
|
|
583
584
|
}
|
|
584
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
585
|
-
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-
|
|
585
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-UNNIF63S.js");
|
|
586
|
+
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-IRTGQL4A.js");
|
|
586
587
|
const network = resolveNetwork2(program2);
|
|
587
588
|
await selectOrCreatePolicy2({
|
|
588
589
|
flavor: "sponsorship",
|
|
@@ -636,8 +637,8 @@ function registerConfig(program2) {
|
|
|
636
637
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set solana-fee-policy-id <id>`."
|
|
637
638
|
);
|
|
638
639
|
}
|
|
639
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
640
|
-
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-
|
|
640
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-UNNIF63S.js");
|
|
641
|
+
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-IRTGQL4A.js");
|
|
641
642
|
const network = resolveSolanaNetwork2(program2);
|
|
642
643
|
await selectOrCreatePolicy2({
|
|
643
644
|
flavor: "solana",
|
|
@@ -694,7 +695,7 @@ function registerConfig(program2) {
|
|
|
694
695
|
printJSON(toMap(cfg));
|
|
695
696
|
return;
|
|
696
697
|
}
|
|
697
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
698
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-IRTGQL4A.js");
|
|
698
699
|
const validToken = resolveAuthToken2(cfg);
|
|
699
700
|
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");
|
|
700
701
|
const pairs = [
|
|
@@ -874,6 +875,21 @@ function matchesSearch(app, query) {
|
|
|
874
875
|
function appToTableRow(app) {
|
|
875
876
|
return [app.id, app.name, String(app.chainNetworks.length), app.createdAt];
|
|
876
877
|
}
|
|
878
|
+
function appToListJSON(app) {
|
|
879
|
+
return {
|
|
880
|
+
id: app.id,
|
|
881
|
+
name: app.name,
|
|
882
|
+
createdAt: app.createdAt,
|
|
883
|
+
networkCount: app.chainNetworks.length,
|
|
884
|
+
networks: app.chainNetworks.map((network) => ({
|
|
885
|
+
id: network.id,
|
|
886
|
+
name: network.name
|
|
887
|
+
}))
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
function appToJSON(app, opts) {
|
|
891
|
+
return opts.full ? maskAppSecrets(app) : appToListJSON(app);
|
|
892
|
+
}
|
|
877
893
|
function handleDryRun(opts, action, payload, humanMsg) {
|
|
878
894
|
if (!opts.dryRun) return false;
|
|
879
895
|
if (isJSONMode()) {
|
|
@@ -885,7 +901,7 @@ function handleDryRun(opts, action, payload, humanMsg) {
|
|
|
885
901
|
}
|
|
886
902
|
function registerApps(program2) {
|
|
887
903
|
const cmd = program2.command("app").description("Manage Alchemy apps");
|
|
888
|
-
cmd.command("list").description("List all apps").option("--cursor <cursor>", "Pagination cursor").option("--limit <n>", "Max results per page", parseInt).option("--all", "Fetch all pages").option("--search <query>", "Search apps by name or id (client-side)").option("--id <appId>", "Filter by exact app id (client-side)").action(async (opts) => {
|
|
904
|
+
cmd.command("list").description("List all apps").option("--cursor <cursor>", "Pagination cursor").option("--limit <n>", "Max results per page", parseInt).option("--all", "Fetch all pages").option("--search <query>", "Search apps by name or id (client-side)").option("--id <appId>", "Filter by exact app id (client-side)").option("--full", "Return full sanitized app payload in JSON mode").action(async (opts) => {
|
|
889
905
|
try {
|
|
890
906
|
const admin = adminClientFromFlags(program2);
|
|
891
907
|
const fetchAll = Boolean(opts.all);
|
|
@@ -918,7 +934,7 @@ function registerApps(program2) {
|
|
|
918
934
|
const filteredApps = hasId ? result2.apps.filter((a) => a.id === idQuery) : hasSearch ? result2.apps.filter((a) => matchesSearch(a, searchQuery)) : result2.apps;
|
|
919
935
|
if (isJSONMode()) {
|
|
920
936
|
printJSON({
|
|
921
|
-
apps: filteredApps.map(
|
|
937
|
+
apps: filteredApps.map((app) => appToJSON(app, { full: opts.full })),
|
|
922
938
|
pageInfo: {
|
|
923
939
|
mode: fetchAll ? "all" : "search",
|
|
924
940
|
pages: result2.pages,
|
|
@@ -952,7 +968,10 @@ function registerApps(program2) {
|
|
|
952
968
|
() => admin.listApps({ cursor: opts.cursor, limit: opts.limit })
|
|
953
969
|
);
|
|
954
970
|
if (isJSONMode()) {
|
|
955
|
-
printJSON({
|
|
971
|
+
printJSON({
|
|
972
|
+
...result,
|
|
973
|
+
apps: result.apps.map((app) => appToJSON(app, { full: opts.full }))
|
|
974
|
+
});
|
|
956
975
|
return;
|
|
957
976
|
}
|
|
958
977
|
const interactivePagination = isInteractiveAllowed(program2) && !opts.all;
|
|
@@ -1043,7 +1062,7 @@ function registerApps(program2) {
|
|
|
1043
1062
|
const products = opts.products ? splitCommaList(opts.products) : void 0;
|
|
1044
1063
|
const payload = {
|
|
1045
1064
|
name: opts.name,
|
|
1046
|
-
networks,
|
|
1065
|
+
networkAllowlist: networks,
|
|
1047
1066
|
...opts.description && { description: opts.description },
|
|
1048
1067
|
...products && { products }
|
|
1049
1068
|
};
|
|
@@ -1134,7 +1153,12 @@ function registerApps(program2) {
|
|
|
1134
1153
|
cmd.command("networks <id>").description("Update app network allowlist").requiredOption("--networks <networks>", "Comma-separated network IDs").option("--dry-run", "Preview without executing").action(async (id, opts) => {
|
|
1135
1154
|
try {
|
|
1136
1155
|
const networks = splitCommaList(opts.networks);
|
|
1137
|
-
if (handleDryRun(
|
|
1156
|
+
if (handleDryRun(
|
|
1157
|
+
opts,
|
|
1158
|
+
"networks",
|
|
1159
|
+
{ id, networkAllowlist: networks },
|
|
1160
|
+
`Would update networks for app ${id}: ${networks.join(", ")}`
|
|
1161
|
+
)) return;
|
|
1138
1162
|
const admin = adminClientFromFlags(program2);
|
|
1139
1163
|
const app = await withSpinner(
|
|
1140
1164
|
"Updating networks\u2026",
|
|
@@ -1857,7 +1881,9 @@ var CONNECT_TIMEOUT_MS = 5 * 6e4;
|
|
|
1857
1881
|
var DEFAULT_WALLET_CAPABILITIES = {
|
|
1858
1882
|
"evm.signMessage": true,
|
|
1859
1883
|
"evm.signTypedData": true,
|
|
1860
|
-
"evm.signAuthorization": true
|
|
1884
|
+
"evm.signAuthorization": true,
|
|
1885
|
+
"evm.prepareCalls": true,
|
|
1886
|
+
"evm.sendCalls": true
|
|
1861
1887
|
};
|
|
1862
1888
|
var DEFAULT_SOLANA_SESSION_CAPABILITIES = {
|
|
1863
1889
|
"solana.signTransaction": true
|
|
@@ -2037,6 +2063,30 @@ function formatWalletStatus(value) {
|
|
|
2037
2063
|
if (value === "active") return green("active");
|
|
2038
2064
|
return dim(value);
|
|
2039
2065
|
}
|
|
2066
|
+
function walletModeSummary(args) {
|
|
2067
|
+
return {
|
|
2068
|
+
session: {
|
|
2069
|
+
available: args.sessionActive,
|
|
2070
|
+
signing: "delegated session approval",
|
|
2071
|
+
transactionSupport: ["wallet_prepareCalls", "wallet_sendCalls"],
|
|
2072
|
+
preflightSimulation: true,
|
|
2073
|
+
sponsorshipEligible: true,
|
|
2074
|
+
nonceManagement: "Alchemy smart wallet",
|
|
2075
|
+
supportedCallShapes: ["single call", "batch calls", "paymaster capabilities"]
|
|
2076
|
+
},
|
|
2077
|
+
local: {
|
|
2078
|
+
available: args.localEvmConfigured || args.localSolanaConfigured,
|
|
2079
|
+
evmConfigured: args.localEvmConfigured,
|
|
2080
|
+
solanaConfigured: args.localSolanaConfigured,
|
|
2081
|
+
signing: "local private key",
|
|
2082
|
+
transactionSupport: ["wallet_sendCalls for EVM smart-wallet commands", "Solana transaction signing"],
|
|
2083
|
+
preflightSimulation: false,
|
|
2084
|
+
sponsorshipEligible: true,
|
|
2085
|
+
nonceManagement: "local signer / chain-specific client",
|
|
2086
|
+
supportedCallShapes: ["single call", "batch calls when routed through EVM smart-wallet commands"]
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2040
2090
|
function walletKeysDirPath() {
|
|
2041
2091
|
return join(configDir(), WALLET_KEYS_DIR);
|
|
2042
2092
|
}
|
|
@@ -2763,6 +2813,11 @@ function registerWallets(program2) {
|
|
|
2763
2813
|
Boolean(localState.evmAddress)
|
|
2764
2814
|
);
|
|
2765
2815
|
if (isJSONMode()) {
|
|
2816
|
+
const modes = walletModeSummary({
|
|
2817
|
+
sessionActive: snap.status === "active",
|
|
2818
|
+
localEvmConfigured: Boolean(localState.evmAddress),
|
|
2819
|
+
localSolanaConfigured: Boolean(localSolanaAddress)
|
|
2820
|
+
});
|
|
2766
2821
|
printJSON({
|
|
2767
2822
|
// Preserved top-level fields (session-scoped, backward-compatible).
|
|
2768
2823
|
walletAddress: snap.walletAddress,
|
|
@@ -2796,7 +2851,8 @@ function registerWallets(program2) {
|
|
|
2796
2851
|
},
|
|
2797
2852
|
localEvm: localState.evmAddress ? { address: localState.evmAddress, keyFile: localState.evmKeyFile } : null,
|
|
2798
2853
|
localSolana: localSolanaAddress ? { address: localSolanaAddress, keyFile: localState.solanaKeyFile } : null,
|
|
2799
|
-
activeSigner
|
|
2854
|
+
activeSigner,
|
|
2855
|
+
modes
|
|
2800
2856
|
});
|
|
2801
2857
|
return;
|
|
2802
2858
|
}
|
|
@@ -2807,7 +2863,9 @@ function registerWallets(program2) {
|
|
|
2807
2863
|
["Local EVM", localState.evmAddress ?? dim("not configured")],
|
|
2808
2864
|
["Local Solana", localSolanaAddress ?? dim("not configured")],
|
|
2809
2865
|
["Environment", snap.environment ?? dim("none")],
|
|
2810
|
-
["Signer Capabilities", snap.signerCapabilities.length > 0 ? snap.signerCapabilities.join(", ") : dim("none")]
|
|
2866
|
+
["Signer Capabilities", snap.signerCapabilities.length > 0 ? snap.signerCapabilities.join(", ") : dim("none")],
|
|
2867
|
+
["Session Mode", snap.status === "active" ? "smart-wallet calls, preflight simulation, sponsorship eligible, managed nonce" : dim("not active")],
|
|
2868
|
+
["Local Mode", localState.evmAddress || localSolanaAddress ? "local key signing; sponsorship only where command supports it" : dim("not configured")]
|
|
2811
2869
|
];
|
|
2812
2870
|
if (snap.connectionRequestId) {
|
|
2813
2871
|
pairs.push(["Connection Request ID", snap.connectionRequestId]);
|
|
@@ -6240,6 +6298,41 @@ Examples:
|
|
|
6240
6298
|
}
|
|
6241
6299
|
|
|
6242
6300
|
// src/commands/agent-prompt.ts
|
|
6301
|
+
var AGENT_PROMPT_SCOPES = [
|
|
6302
|
+
"wallet",
|
|
6303
|
+
"evm",
|
|
6304
|
+
"solana",
|
|
6305
|
+
"webhook",
|
|
6306
|
+
"app",
|
|
6307
|
+
"data",
|
|
6308
|
+
"xchain"
|
|
6309
|
+
];
|
|
6310
|
+
var SCOPE_COMMAND_PATHS = {
|
|
6311
|
+
app: ["app", "auth", "config"],
|
|
6312
|
+
data: ["evm data", "evm logs", "evm block", "evm tx", "evm receipt"],
|
|
6313
|
+
evm: ["evm"],
|
|
6314
|
+
solana: ["solana"],
|
|
6315
|
+
wallet: [
|
|
6316
|
+
"wallet",
|
|
6317
|
+
"evm send",
|
|
6318
|
+
"evm contract",
|
|
6319
|
+
"evm swap",
|
|
6320
|
+
"evm approve",
|
|
6321
|
+
"evm status",
|
|
6322
|
+
"xchain bridge"
|
|
6323
|
+
],
|
|
6324
|
+
webhook: ["webhook", "config set webhook-api-key"],
|
|
6325
|
+
xchain: ["xchain"]
|
|
6326
|
+
};
|
|
6327
|
+
var SCOPE_EXAMPLE_MATCHERS = {
|
|
6328
|
+
app: [" app ", " auth ", " config "],
|
|
6329
|
+
data: [" evm data ", " evm logs ", " evm block ", " evm tx ", " evm receipt "],
|
|
6330
|
+
evm: [" evm "],
|
|
6331
|
+
solana: [" solana "],
|
|
6332
|
+
wallet: [" wallet ", " evm send ", " evm swap ", " evm approve ", " xchain bridge "],
|
|
6333
|
+
webhook: [" webhook "],
|
|
6334
|
+
xchain: [" xchain "]
|
|
6335
|
+
};
|
|
6243
6336
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
6244
6337
|
ErrorCode.RATE_LIMITED,
|
|
6245
6338
|
ErrorCode.NETWORK_ERROR
|
|
@@ -6258,6 +6351,7 @@ var ERROR_RECOVERY = {
|
|
|
6258
6351
|
PAYMENT_REQUIRED: "Fund your x402 wallet or switch to API key auth",
|
|
6259
6352
|
SETUP_REQUIRED: "Run preflight: alchemy --json --no-interactive config status, then follow nextCommands",
|
|
6260
6353
|
QUOTE_FAILED: "Quote unavailable; check data.cause for the specific reason (INSUFFICIENT_BALANCE, INSUFFICIENT_LIQUIDITY, UNSUPPORTED_ROUTE, QUOTE_REVERTED, QUOTE_FAILED) and follow the hint",
|
|
6354
|
+
PREFLIGHT_REVERT: "Transaction preflight reverted; inspect data.reason, fix balance/allowance/calldata, and retry with --dry-run when available",
|
|
6261
6355
|
INTERNAL_ERROR: "Unexpected error; retry or report a bug"
|
|
6262
6356
|
};
|
|
6263
6357
|
function buildCommandSchema(cmd) {
|
|
@@ -6292,6 +6386,56 @@ function buildCommandSchema(cmd) {
|
|
|
6292
6386
|
}
|
|
6293
6387
|
return schema;
|
|
6294
6388
|
}
|
|
6389
|
+
function commandMatchesPath(cmd, path) {
|
|
6390
|
+
if (path[0] !== cmd.name) return null;
|
|
6391
|
+
if (path.length === 1) return cmd;
|
|
6392
|
+
if (!cmd.subcommands) return null;
|
|
6393
|
+
const childMatches = filterCommandSchemas(cmd.subcommands, [path.slice(1)]);
|
|
6394
|
+
if (childMatches.length === 0) return null;
|
|
6395
|
+
return {
|
|
6396
|
+
...cmd,
|
|
6397
|
+
subcommands: childMatches
|
|
6398
|
+
};
|
|
6399
|
+
}
|
|
6400
|
+
function filterCommandSchemas(commands, paths) {
|
|
6401
|
+
const filtered = [];
|
|
6402
|
+
for (const cmd of commands) {
|
|
6403
|
+
const matches = paths.map((path) => commandMatchesPath(cmd, path)).filter((match) => Boolean(match));
|
|
6404
|
+
if (matches.length === 0) continue;
|
|
6405
|
+
if (matches.some((match) => match === cmd)) {
|
|
6406
|
+
filtered.push(cmd);
|
|
6407
|
+
continue;
|
|
6408
|
+
}
|
|
6409
|
+
const subcommands = matches.flatMap((match) => match.subcommands ?? []);
|
|
6410
|
+
filtered.push({
|
|
6411
|
+
...cmd,
|
|
6412
|
+
subcommands
|
|
6413
|
+
});
|
|
6414
|
+
}
|
|
6415
|
+
return filtered;
|
|
6416
|
+
}
|
|
6417
|
+
function parseScope(value) {
|
|
6418
|
+
if (value === void 0) return void 0;
|
|
6419
|
+
const normalized = value.trim().toLowerCase();
|
|
6420
|
+
if (AGENT_PROMPT_SCOPES.includes(normalized)) {
|
|
6421
|
+
return normalized;
|
|
6422
|
+
}
|
|
6423
|
+
throw errInvalidArgs(
|
|
6424
|
+
`Unknown agent-prompt scope '${value}'. Use one of: ${AGENT_PROMPT_SCOPES.join(", ")}.`
|
|
6425
|
+
);
|
|
6426
|
+
}
|
|
6427
|
+
function applyScope(payload, scope) {
|
|
6428
|
+
if (!scope) return;
|
|
6429
|
+
payload.scope = scope;
|
|
6430
|
+
payload.commands = filterCommandSchemas(
|
|
6431
|
+
payload.commands,
|
|
6432
|
+
SCOPE_COMMAND_PATHS[scope].map((path) => path.split(" "))
|
|
6433
|
+
);
|
|
6434
|
+
const matchers = SCOPE_EXAMPLE_MATCHERS[scope];
|
|
6435
|
+
payload.examples = payload.examples.filter(
|
|
6436
|
+
(example) => matchers.some((matcher) => ` ${example} `.includes(matcher))
|
|
6437
|
+
);
|
|
6438
|
+
}
|
|
6295
6439
|
function buildAgentPrompt(program2) {
|
|
6296
6440
|
const errors = {};
|
|
6297
6441
|
for (const [code, exitCode] of Object.entries(EXIT_CODES)) {
|
|
@@ -6320,6 +6464,11 @@ function buildAgentPrompt(program2) {
|
|
|
6320
6464
|
command: "alchemy --json --no-interactive config status",
|
|
6321
6465
|
description: "Check auth readiness before first command. Use capabilities.rpc_data/admin_api/notify_webhooks/wallet_signing/x402 to scope setup to the intended command family."
|
|
6322
6466
|
},
|
|
6467
|
+
transactionPreflight: [
|
|
6468
|
+
"Before `evm send`, check the sender's native balance with `alchemy --json --no-interactive evm data balance <address> -n <network>`.",
|
|
6469
|
+
"Before ERC-20 sends, swaps, approvals, or bridges, verify the source token balance/allowance or request a quote first; do not infer spendability from a configured wallet alone.",
|
|
6470
|
+
"If a balance is zero or below the requested amount, stop and report the funding gap instead of retrying the transaction."
|
|
6471
|
+
],
|
|
6323
6472
|
runtimeDiscovery: {
|
|
6324
6473
|
installed: {
|
|
6325
6474
|
command: "alchemy --json --no-interactive agent-prompt",
|
|
@@ -6453,6 +6602,11 @@ function formatAsSystemPrompt(payload) {
|
|
|
6453
6602
|
lines.push(` Command: ${payload.preflight.command}`);
|
|
6454
6603
|
lines.push(` ${payload.preflight.description}`);
|
|
6455
6604
|
lines.push("");
|
|
6605
|
+
lines.push("Transaction preflight:");
|
|
6606
|
+
for (const rule of payload.transactionPreflight) {
|
|
6607
|
+
lines.push(` - ${rule}`);
|
|
6608
|
+
}
|
|
6609
|
+
lines.push("");
|
|
6456
6610
|
lines.push("Runtime discovery:");
|
|
6457
6611
|
lines.push(` Installed CLI: ${payload.runtimeDiscovery.installed.command}`);
|
|
6458
6612
|
lines.push(` ${payload.runtimeDiscovery.installed.description}`);
|
|
@@ -6508,13 +6662,18 @@ function formatAsSystemPrompt(payload) {
|
|
|
6508
6662
|
return lines.join("\n");
|
|
6509
6663
|
}
|
|
6510
6664
|
function registerAgentPrompt(program2) {
|
|
6511
|
-
program2.command("agent-prompt").description("Emit complete agent/automation usage instructions").option("--commands <list>", "Filter to specific commands in JSON output (requires --json). Comma-separated (e.g. data,rpc,gas)").action((opts) => {
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6665
|
+
program2.command("agent-prompt").description("Emit complete agent/automation usage instructions").option("--scope <scope>", "Filter output to a command area: wallet, evm, solana, webhook, app, data, xchain").option("--commands <list>", "Filter to specific commands in JSON output (requires --json). Comma-separated (e.g. data,rpc,gas)").action((opts) => {
|
|
6666
|
+
try {
|
|
6667
|
+
const payload = buildAgentPrompt(program2);
|
|
6668
|
+
applyScope(payload, parseScope(opts.scope));
|
|
6669
|
+
if (opts.commands) {
|
|
6670
|
+
const filter = new Set(opts.commands.split(",").map((s) => s.trim().toLowerCase()));
|
|
6671
|
+
payload.commands = payload.commands.filter((cmd) => filter.has(cmd.name.toLowerCase()));
|
|
6672
|
+
}
|
|
6673
|
+
printHuman(formatAsSystemPrompt(payload), payload);
|
|
6674
|
+
} catch (err) {
|
|
6675
|
+
exitWithError(err);
|
|
6516
6676
|
}
|
|
6517
|
-
printHuman(formatAsSystemPrompt(payload), payload);
|
|
6518
6677
|
});
|
|
6519
6678
|
}
|
|
6520
6679
|
|
|
@@ -6647,6 +6806,55 @@ function registrySymbolSuggestions(network) {
|
|
|
6647
6806
|
return listRegistryTokens(network).map((t) => t.symbol);
|
|
6648
6807
|
}
|
|
6649
6808
|
|
|
6809
|
+
// src/lib/preflight-errors.ts
|
|
6810
|
+
function errorText(err) {
|
|
6811
|
+
if (err instanceof CLIError) {
|
|
6812
|
+
return [err.message, err.details].filter(Boolean).join(" ");
|
|
6813
|
+
}
|
|
6814
|
+
if (err instanceof Error) {
|
|
6815
|
+
return err.message;
|
|
6816
|
+
}
|
|
6817
|
+
return String(err);
|
|
6818
|
+
}
|
|
6819
|
+
function cleanReason(value) {
|
|
6820
|
+
return value.replace(/^["'`]+|["'`]+$/g, "").replace(/\s+/g, " ").trim();
|
|
6821
|
+
}
|
|
6822
|
+
function extractRevertReason(text) {
|
|
6823
|
+
const patterns = [
|
|
6824
|
+
/An error occurred while executing user operation:\s*["'`]?([^"'`\n]+)["'`]?/i,
|
|
6825
|
+
/reverted with the following reason:\s*["'`]?([^"'`\n]+)["'`]?/i,
|
|
6826
|
+
/execution reverted(?::|[ \t]+with reason string)[ \t]*["'`]?([^"'`\n]+)["'`]?/i,
|
|
6827
|
+
/reverted with (?:the )?reason(?: string)?:?[ \t]*["'`]?([^"'`\n]+)["'`]?/i,
|
|
6828
|
+
/\breason:[ \t]*["'`]?([^"'`\n]+)["'`]?/i,
|
|
6829
|
+
/\brevert(?:ed)?[: \t]+["'`]?([^"'`\n]+)["'`]?/i
|
|
6830
|
+
];
|
|
6831
|
+
for (const pattern of patterns) {
|
|
6832
|
+
const match = text.match(pattern);
|
|
6833
|
+
const reason = match?.[1] ? cleanReason(match[1]) : "";
|
|
6834
|
+
if (reason) return reason;
|
|
6835
|
+
}
|
|
6836
|
+
if (/\b(revert|reverted|execution reverted|call exception)\b/i.test(text)) {
|
|
6837
|
+
return "execution reverted";
|
|
6838
|
+
}
|
|
6839
|
+
return null;
|
|
6840
|
+
}
|
|
6841
|
+
function normalizePreflightRevertError(err) {
|
|
6842
|
+
if (err instanceof CLIError && err.code === ErrorCode.PREFLIGHT_REVERT) {
|
|
6843
|
+
return err;
|
|
6844
|
+
}
|
|
6845
|
+
const detail = errorText(err);
|
|
6846
|
+
const reason = extractRevertReason(detail);
|
|
6847
|
+
if (!reason) return null;
|
|
6848
|
+
return errPreflightRevert(reason, detail || void 0);
|
|
6849
|
+
}
|
|
6850
|
+
async function withPreflightRevert(fn) {
|
|
6851
|
+
try {
|
|
6852
|
+
return await fn();
|
|
6853
|
+
} catch (err) {
|
|
6854
|
+
throw normalizePreflightRevertError(err) ?? err;
|
|
6855
|
+
}
|
|
6856
|
+
}
|
|
6857
|
+
|
|
6650
6858
|
// src/commands/approve.ts
|
|
6651
6859
|
function isNativeToken(address3) {
|
|
6652
6860
|
return address3.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
@@ -6825,10 +7033,10 @@ async function performApprove(program2, spenderArg, opts) {
|
|
|
6825
7033
|
const { id } = await withSpinner(
|
|
6826
7034
|
"Sending approval\u2026",
|
|
6827
7035
|
"Approval submitted",
|
|
6828
|
-
() => client.sendCalls({
|
|
7036
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
6829
7037
|
calls,
|
|
6830
7038
|
capabilities: paymaster ? { paymaster } : void 0
|
|
6831
|
-
})
|
|
7039
|
+
}))
|
|
6832
7040
|
);
|
|
6833
7041
|
const status = await withSpinner(
|
|
6834
7042
|
"Waiting for confirmation\u2026",
|
|
@@ -7273,10 +7481,10 @@ async function performContractCall(program2, addressArg, functionArg, opts) {
|
|
|
7273
7481
|
const { id } = await withSpinner(
|
|
7274
7482
|
"Sending transaction\u2026",
|
|
7275
7483
|
"Transaction submitted",
|
|
7276
|
-
() => client.sendCalls({
|
|
7484
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
7277
7485
|
calls: [call],
|
|
7278
7486
|
capabilities: paymaster ? { paymaster } : void 0
|
|
7279
|
-
})
|
|
7487
|
+
}))
|
|
7280
7488
|
);
|
|
7281
7489
|
const status = await withSpinner(
|
|
7282
7490
|
"Waiting for confirmation\u2026",
|
|
@@ -8450,7 +8658,7 @@ Examples:
|
|
|
8450
8658
|
dryRun: opts.dryRun
|
|
8451
8659
|
});
|
|
8452
8660
|
} catch (err) {
|
|
8453
|
-
const { exitWithError: exitWithError2 } = await import("./errors-
|
|
8661
|
+
const { exitWithError: exitWithError2 } = await import("./errors-VS7SGW7B.js");
|
|
8454
8662
|
exitWithError2(err);
|
|
8455
8663
|
}
|
|
8456
8664
|
});
|
|
@@ -8527,10 +8735,10 @@ async function performEvmSend(program2, toArg, amountArg, tokenAddress, opts = {
|
|
|
8527
8735
|
const { id } = await withSpinner(
|
|
8528
8736
|
"Sending transaction\u2026",
|
|
8529
8737
|
"Transaction submitted",
|
|
8530
|
-
() => client.sendCalls({
|
|
8738
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
8531
8739
|
calls,
|
|
8532
8740
|
capabilities: paymaster ? { paymaster } : void 0
|
|
8533
|
-
})
|
|
8741
|
+
}))
|
|
8534
8742
|
);
|
|
8535
8743
|
const status = await withSpinner(
|
|
8536
8744
|
"Waiting for confirmation\u2026",
|
|
@@ -8656,7 +8864,7 @@ function buildWalletQuoteClient(program2, address3) {
|
|
|
8656
8864
|
}
|
|
8657
8865
|
|
|
8658
8866
|
// src/lib/quote-errors.ts
|
|
8659
|
-
function
|
|
8867
|
+
function errorText2(err) {
|
|
8660
8868
|
if (err instanceof CLIError) {
|
|
8661
8869
|
return [err.message, err.details].filter(Boolean).join(" ");
|
|
8662
8870
|
}
|
|
@@ -8714,7 +8922,7 @@ function normalizeQuoteError(err, flow) {
|
|
|
8714
8922
|
if (err instanceof CLIError && err.code !== ErrorCode.RPC_ERROR && err.code !== ErrorCode.INTERNAL_ERROR) {
|
|
8715
8923
|
return err;
|
|
8716
8924
|
}
|
|
8717
|
-
const detail =
|
|
8925
|
+
const detail = errorText2(err);
|
|
8718
8926
|
const cause = classifyQuoteFailure(detail);
|
|
8719
8927
|
return new CLIError(
|
|
8720
8928
|
ErrorCode.QUOTE_FAILED,
|
|
@@ -8787,10 +8995,10 @@ async function prepareQuoteForExecution(client, quote) {
|
|
|
8787
8995
|
const preparedQuote = await withSpinner(
|
|
8788
8996
|
"Preparing swap\u2026",
|
|
8789
8997
|
"Swap prepared",
|
|
8790
|
-
() => client.prepareCalls({
|
|
8998
|
+
() => withPreflightRevert(() => client.prepareCalls({
|
|
8791
8999
|
...permitQuote.modifiedRequest,
|
|
8792
9000
|
paymasterPermitSignature: permitSignature
|
|
8793
|
-
})
|
|
9001
|
+
}))
|
|
8794
9002
|
);
|
|
8795
9003
|
if ("type" in preparedQuote && preparedQuote.type === "paymaster-permit") {
|
|
8796
9004
|
throw errInvalidArgs("Swap quote still requires a paymaster permit after signing. The quote response format may be unsupported.");
|
|
@@ -8931,14 +9139,14 @@ async function performSwapExecute(program2, opts) {
|
|
|
8931
9139
|
async () => {
|
|
8932
9140
|
if ("rawCalls" in preparedQuote && preparedQuote.rawCalls === true) {
|
|
8933
9141
|
const rawCallsQuote = preparedQuote;
|
|
8934
|
-
return client.sendCalls({
|
|
9142
|
+
return withPreflightRevert(() => client.sendCalls({
|
|
8935
9143
|
calls: rawCallsQuote.calls,
|
|
8936
9144
|
capabilities: paymaster ? { paymaster } : void 0
|
|
8937
|
-
});
|
|
9145
|
+
}));
|
|
8938
9146
|
}
|
|
8939
9147
|
const executablePreparedQuote = preparedQuote;
|
|
8940
9148
|
const signedQuote = await client.signPreparedCalls(executablePreparedQuote);
|
|
8941
|
-
return client.sendPreparedCalls(signedQuote);
|
|
9149
|
+
return withPreflightRevert(() => client.sendPreparedCalls(signedQuote));
|
|
8942
9150
|
}
|
|
8943
9151
|
);
|
|
8944
9152
|
const status = await withSpinner(
|
|
@@ -9493,10 +9701,10 @@ async function prepareQuoteForExecution2(client, quote) {
|
|
|
9493
9701
|
const preparedQuote = await withSpinner(
|
|
9494
9702
|
"Preparing bridge\u2026",
|
|
9495
9703
|
"Bridge prepared",
|
|
9496
|
-
() => client.prepareCalls({
|
|
9704
|
+
() => withPreflightRevert(() => client.prepareCalls({
|
|
9497
9705
|
...permitQuote.modifiedRequest,
|
|
9498
9706
|
paymasterPermitSignature: permitSignature
|
|
9499
|
-
})
|
|
9707
|
+
}))
|
|
9500
9708
|
);
|
|
9501
9709
|
if ("type" in preparedQuote && preparedQuote.type === "paymaster-permit") {
|
|
9502
9710
|
throw errInvalidArgs("Bridge quote still requires a paymaster permit after signing. The quote response format may be unsupported.");
|
|
@@ -9650,14 +9858,14 @@ async function performBridgeExecute(program2, opts) {
|
|
|
9650
9858
|
async () => {
|
|
9651
9859
|
if ("rawCalls" in preparedQuote && preparedQuote.rawCalls === true) {
|
|
9652
9860
|
const rawCallsQuote = preparedQuote;
|
|
9653
|
-
return client.sendCalls({
|
|
9861
|
+
return withPreflightRevert(() => client.sendCalls({
|
|
9654
9862
|
calls: rawCallsQuote.calls,
|
|
9655
9863
|
capabilities: paymaster ? { paymaster } : void 0
|
|
9656
|
-
});
|
|
9864
|
+
}));
|
|
9657
9865
|
}
|
|
9658
9866
|
const executablePreparedQuote = preparedQuote;
|
|
9659
9867
|
const signedQuote = await client.signPreparedCalls(executablePreparedQuote);
|
|
9660
|
-
return client.sendPreparedCalls(signedQuote);
|
|
9868
|
+
return withPreflightRevert(() => client.sendPreparedCalls(signedQuote));
|
|
9661
9869
|
}
|
|
9662
9870
|
);
|
|
9663
9871
|
const status = await withSpinner(
|
|
@@ -10373,7 +10581,7 @@ async function flushProcessOutput() {
|
|
|
10373
10581
|
}
|
|
10374
10582
|
program.name("alchemy").description(
|
|
10375
10583
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
10376
|
-
).version("0.
|
|
10584
|
+
).version("0.14.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
|
|
10377
10585
|
"-n, --network <network>",
|
|
10378
10586
|
"Target network for networked commands"
|
|
10379
10587
|
).option("--x402", "Use x402 wallet-based gateway auth").option(
|
|
@@ -10560,11 +10768,11 @@ ${styledLine}`;
|
|
|
10560
10768
|
"wallet"
|
|
10561
10769
|
];
|
|
10562
10770
|
if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
|
|
10563
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
10771
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-IRTGQL4A.js");
|
|
10564
10772
|
const authToken = resolveAuthToken2(cfg);
|
|
10565
10773
|
const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
|
|
10566
10774
|
if (authToken && !hasApiKey) {
|
|
10567
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
10775
|
+
const { selectAppAfterAuth } = await import("./auth-ZBEPAFEP.js");
|
|
10568
10776
|
console.log("");
|
|
10569
10777
|
console.log(` No app selected. Please select an app to continue.`);
|
|
10570
10778
|
await selectAppAfterAuth(authToken);
|
|
@@ -10599,7 +10807,7 @@ ${styledLine}`;
|
|
|
10599
10807
|
if (isInteractiveAllowed(program)) {
|
|
10600
10808
|
let latestForInteractiveStartup = null;
|
|
10601
10809
|
if (shouldRunOnboarding(program, cfg)) {
|
|
10602
|
-
const { runOnboarding } = await import("./onboarding-
|
|
10810
|
+
const { runOnboarding } = await import("./onboarding-QE43IUEK.js");
|
|
10603
10811
|
const latest = getAvailableUpdateOnce();
|
|
10604
10812
|
const completed = await runOnboarding(program, latest);
|
|
10605
10813
|
updateShownDuringInteractiveStartup = Boolean(latest);
|
|
@@ -10613,7 +10821,7 @@ ${styledLine}`;
|
|
|
10613
10821
|
latestForInteractiveStartup
|
|
10614
10822
|
);
|
|
10615
10823
|
}
|
|
10616
|
-
const { startREPL } = await import("./interactive-
|
|
10824
|
+
const { startREPL } = await import("./interactive-XNDXNMAJ.js");
|
|
10617
10825
|
program.exitOverride();
|
|
10618
10826
|
program.configureOutput({
|
|
10619
10827
|
writeErr: () => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getSetupMethod
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-RQDWIB62.js";
|
|
6
|
+
import "./chunk-EJB4WDTU.js";
|
|
7
7
|
import {
|
|
8
8
|
getRPCNetworkIds
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CXR7CCJ7.js";
|
|
10
10
|
import {
|
|
11
11
|
getUpdateNoticeLines
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-22KBYYLI.js";
|
|
13
13
|
import {
|
|
14
14
|
bold,
|
|
15
15
|
brand,
|
|
@@ -17,18 +17,18 @@ import {
|
|
|
17
17
|
dim,
|
|
18
18
|
green,
|
|
19
19
|
setBrandedHelpSuppressed
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OIRERSZT.js";
|
|
21
21
|
import {
|
|
22
22
|
configDir,
|
|
23
23
|
load
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PISUI34T.js";
|
|
25
25
|
import {
|
|
26
26
|
bgRgb,
|
|
27
27
|
isJSONMode,
|
|
28
28
|
noColor,
|
|
29
29
|
rgb,
|
|
30
30
|
setReplMode
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CFIDLPKB.js";
|
|
32
32
|
|
|
33
33
|
// src/commands/interactive.ts
|
|
34
34
|
import * as readline from "readline";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getUpdateNoticeLines
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-22KBYYLI.js";
|
|
6
6
|
import {
|
|
7
7
|
bold,
|
|
8
8
|
brand,
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
dim,
|
|
11
11
|
green,
|
|
12
12
|
promptText
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OIRERSZT.js";
|
|
14
14
|
import {
|
|
15
15
|
load,
|
|
16
16
|
save
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-PISUI34T.js";
|
|
18
|
+
import "./chunk-CFIDLPKB.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/onboarding.ts
|
|
21
21
|
async function runOnboarding(_program, latestUpdate = null) {
|
|
@@ -38,7 +38,7 @@ async function runOnboarding(_program, latestUpdate = null) {
|
|
|
38
38
|
if (answer === null) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-
|
|
41
|
+
const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-57YPPTNF.js");
|
|
42
42
|
console.log(` Opening browser to log in...`);
|
|
43
43
|
console.log(` ${dim(getLoginUrl(AUTH_PORT))}`);
|
|
44
44
|
console.log(` ${dim("Waiting for authentication...")}`);
|
|
@@ -51,7 +51,7 @@ async function runOnboarding(_program, latestUpdate = null) {
|
|
|
51
51
|
auth_token_expires_at: result.expiresAt
|
|
52
52
|
});
|
|
53
53
|
console.log(` ${green("\u2713")} Logged in successfully`);
|
|
54
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
54
|
+
const { selectAppAfterAuth } = await import("./auth-ZBEPAFEP.js");
|
|
55
55
|
await selectAppAfterAuth(result.token);
|
|
56
56
|
return true;
|
|
57
57
|
} catch (err) {
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-M7HFRKW6.js";
|
|
9
|
+
import "./chunk-CXR7CCJ7.js";
|
|
10
|
+
import "./chunk-OIRERSZT.js";
|
|
11
|
+
import "./chunk-PISUI34T.js";
|
|
12
|
+
import "./chunk-CFIDLPKB.js";
|
|
13
13
|
export {
|
|
14
14
|
createPolicyInteractive,
|
|
15
15
|
errNotLoggedInForPolicyLookup,
|
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
resolveWalletSession,
|
|
27
27
|
resolveX402,
|
|
28
28
|
resolveX402Client
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-CXR7CCJ7.js";
|
|
30
|
+
import "./chunk-PISUI34T.js";
|
|
31
|
+
import "./chunk-CFIDLPKB.js";
|
|
32
32
|
export {
|
|
33
33
|
adminClientFromFlags,
|
|
34
34
|
apiKeyClientFromFlags,
|
package/package.json
CHANGED
package/dist/auth-AU7LPEQL.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
|
-
import {
|
|
4
|
-
registerAuth,
|
|
5
|
-
selectAppAfterAuth
|
|
6
|
-
} from "./chunk-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
|
-
};
|