@alchemy/cli 0.13.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-OE6B6S2H.js → chunk-22KBYYLI.js} +3 -3
- package/dist/{chunk-5BEJA752.js → chunk-CFIDLPKB.js} +12 -0
- package/dist/{chunk-PRSZJXA6.js → chunk-CXR7CCJ7.js} +42 -4
- package/dist/{chunk-I6YQX7PF.js → chunk-CZWKHYTE.js} +1 -1
- package/dist/{chunk-RPSHRYCZ.js → chunk-EJB4WDTU.js} +1 -1
- package/dist/{chunk-PYIVNQEI.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-DWNXGFON.js → chunk-RQDWIB62.js} +2 -2
- package/dist/{chunk-5DR7BHUX.js → chunk-WDGPT4OT.js} +6 -6
- package/dist/{errors-6BEPCY5N.js → errors-VS7SGW7B.js} +3 -1
- package/dist/index.js +233 -48
- package/dist/{interactive-6SOB4IYV.js → interactive-XNDXNMAJ.js} +7 -7
- package/dist/{onboarding-TYRUMFUL.js → onboarding-QE43IUEK.js} +6 -6
- package/dist/{policy-prompt-LY6DMMT4.js → policy-prompt-UNNIF63S.js} +5 -5
- package/dist/{resolve-GELBKDTP.js → resolve-IRTGQL4A.js} +3 -3
- package/package.json +1 -1
- package/dist/auth-YB6AALZO.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";
|
|
@@ -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 = [
|
|
@@ -1880,7 +1881,9 @@ var CONNECT_TIMEOUT_MS = 5 * 6e4;
|
|
|
1880
1881
|
var DEFAULT_WALLET_CAPABILITIES = {
|
|
1881
1882
|
"evm.signMessage": true,
|
|
1882
1883
|
"evm.signTypedData": true,
|
|
1883
|
-
"evm.signAuthorization": true
|
|
1884
|
+
"evm.signAuthorization": true,
|
|
1885
|
+
"evm.prepareCalls": true,
|
|
1886
|
+
"evm.sendCalls": true
|
|
1884
1887
|
};
|
|
1885
1888
|
var DEFAULT_SOLANA_SESSION_CAPABILITIES = {
|
|
1886
1889
|
"solana.signTransaction": true
|
|
@@ -2060,6 +2063,30 @@ function formatWalletStatus(value) {
|
|
|
2060
2063
|
if (value === "active") return green("active");
|
|
2061
2064
|
return dim(value);
|
|
2062
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
|
+
}
|
|
2063
2090
|
function walletKeysDirPath() {
|
|
2064
2091
|
return join(configDir(), WALLET_KEYS_DIR);
|
|
2065
2092
|
}
|
|
@@ -2786,6 +2813,11 @@ function registerWallets(program2) {
|
|
|
2786
2813
|
Boolean(localState.evmAddress)
|
|
2787
2814
|
);
|
|
2788
2815
|
if (isJSONMode()) {
|
|
2816
|
+
const modes = walletModeSummary({
|
|
2817
|
+
sessionActive: snap.status === "active",
|
|
2818
|
+
localEvmConfigured: Boolean(localState.evmAddress),
|
|
2819
|
+
localSolanaConfigured: Boolean(localSolanaAddress)
|
|
2820
|
+
});
|
|
2789
2821
|
printJSON({
|
|
2790
2822
|
// Preserved top-level fields (session-scoped, backward-compatible).
|
|
2791
2823
|
walletAddress: snap.walletAddress,
|
|
@@ -2819,7 +2851,8 @@ function registerWallets(program2) {
|
|
|
2819
2851
|
},
|
|
2820
2852
|
localEvm: localState.evmAddress ? { address: localState.evmAddress, keyFile: localState.evmKeyFile } : null,
|
|
2821
2853
|
localSolana: localSolanaAddress ? { address: localSolanaAddress, keyFile: localState.solanaKeyFile } : null,
|
|
2822
|
-
activeSigner
|
|
2854
|
+
activeSigner,
|
|
2855
|
+
modes
|
|
2823
2856
|
});
|
|
2824
2857
|
return;
|
|
2825
2858
|
}
|
|
@@ -2830,7 +2863,9 @@ function registerWallets(program2) {
|
|
|
2830
2863
|
["Local EVM", localState.evmAddress ?? dim("not configured")],
|
|
2831
2864
|
["Local Solana", localSolanaAddress ?? dim("not configured")],
|
|
2832
2865
|
["Environment", snap.environment ?? dim("none")],
|
|
2833
|
-
["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")]
|
|
2834
2869
|
];
|
|
2835
2870
|
if (snap.connectionRequestId) {
|
|
2836
2871
|
pairs.push(["Connection Request ID", snap.connectionRequestId]);
|
|
@@ -6263,6 +6298,41 @@ Examples:
|
|
|
6263
6298
|
}
|
|
6264
6299
|
|
|
6265
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
|
+
};
|
|
6266
6336
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
6267
6337
|
ErrorCode.RATE_LIMITED,
|
|
6268
6338
|
ErrorCode.NETWORK_ERROR
|
|
@@ -6281,6 +6351,7 @@ var ERROR_RECOVERY = {
|
|
|
6281
6351
|
PAYMENT_REQUIRED: "Fund your x402 wallet or switch to API key auth",
|
|
6282
6352
|
SETUP_REQUIRED: "Run preflight: alchemy --json --no-interactive config status, then follow nextCommands",
|
|
6283
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",
|
|
6284
6355
|
INTERNAL_ERROR: "Unexpected error; retry or report a bug"
|
|
6285
6356
|
};
|
|
6286
6357
|
function buildCommandSchema(cmd) {
|
|
@@ -6315,6 +6386,56 @@ function buildCommandSchema(cmd) {
|
|
|
6315
6386
|
}
|
|
6316
6387
|
return schema;
|
|
6317
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
|
+
}
|
|
6318
6439
|
function buildAgentPrompt(program2) {
|
|
6319
6440
|
const errors = {};
|
|
6320
6441
|
for (const [code, exitCode] of Object.entries(EXIT_CODES)) {
|
|
@@ -6343,6 +6464,11 @@ function buildAgentPrompt(program2) {
|
|
|
6343
6464
|
command: "alchemy --json --no-interactive config status",
|
|
6344
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."
|
|
6345
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
|
+
],
|
|
6346
6472
|
runtimeDiscovery: {
|
|
6347
6473
|
installed: {
|
|
6348
6474
|
command: "alchemy --json --no-interactive agent-prompt",
|
|
@@ -6476,6 +6602,11 @@ function formatAsSystemPrompt(payload) {
|
|
|
6476
6602
|
lines.push(` Command: ${payload.preflight.command}`);
|
|
6477
6603
|
lines.push(` ${payload.preflight.description}`);
|
|
6478
6604
|
lines.push("");
|
|
6605
|
+
lines.push("Transaction preflight:");
|
|
6606
|
+
for (const rule of payload.transactionPreflight) {
|
|
6607
|
+
lines.push(` - ${rule}`);
|
|
6608
|
+
}
|
|
6609
|
+
lines.push("");
|
|
6479
6610
|
lines.push("Runtime discovery:");
|
|
6480
6611
|
lines.push(` Installed CLI: ${payload.runtimeDiscovery.installed.command}`);
|
|
6481
6612
|
lines.push(` ${payload.runtimeDiscovery.installed.description}`);
|
|
@@ -6531,13 +6662,18 @@ function formatAsSystemPrompt(payload) {
|
|
|
6531
6662
|
return lines.join("\n");
|
|
6532
6663
|
}
|
|
6533
6664
|
function registerAgentPrompt(program2) {
|
|
6534
|
-
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) => {
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
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);
|
|
6539
6676
|
}
|
|
6540
|
-
printHuman(formatAsSystemPrompt(payload), payload);
|
|
6541
6677
|
});
|
|
6542
6678
|
}
|
|
6543
6679
|
|
|
@@ -6670,6 +6806,55 @@ function registrySymbolSuggestions(network) {
|
|
|
6670
6806
|
return listRegistryTokens(network).map((t) => t.symbol);
|
|
6671
6807
|
}
|
|
6672
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
|
+
|
|
6673
6858
|
// src/commands/approve.ts
|
|
6674
6859
|
function isNativeToken(address3) {
|
|
6675
6860
|
return address3.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
@@ -6848,10 +7033,10 @@ async function performApprove(program2, spenderArg, opts) {
|
|
|
6848
7033
|
const { id } = await withSpinner(
|
|
6849
7034
|
"Sending approval\u2026",
|
|
6850
7035
|
"Approval submitted",
|
|
6851
|
-
() => client.sendCalls({
|
|
7036
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
6852
7037
|
calls,
|
|
6853
7038
|
capabilities: paymaster ? { paymaster } : void 0
|
|
6854
|
-
})
|
|
7039
|
+
}))
|
|
6855
7040
|
);
|
|
6856
7041
|
const status = await withSpinner(
|
|
6857
7042
|
"Waiting for confirmation\u2026",
|
|
@@ -7296,10 +7481,10 @@ async function performContractCall(program2, addressArg, functionArg, opts) {
|
|
|
7296
7481
|
const { id } = await withSpinner(
|
|
7297
7482
|
"Sending transaction\u2026",
|
|
7298
7483
|
"Transaction submitted",
|
|
7299
|
-
() => client.sendCalls({
|
|
7484
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
7300
7485
|
calls: [call],
|
|
7301
7486
|
capabilities: paymaster ? { paymaster } : void 0
|
|
7302
|
-
})
|
|
7487
|
+
}))
|
|
7303
7488
|
);
|
|
7304
7489
|
const status = await withSpinner(
|
|
7305
7490
|
"Waiting for confirmation\u2026",
|
|
@@ -8473,7 +8658,7 @@ Examples:
|
|
|
8473
8658
|
dryRun: opts.dryRun
|
|
8474
8659
|
});
|
|
8475
8660
|
} catch (err) {
|
|
8476
|
-
const { exitWithError: exitWithError2 } = await import("./errors-
|
|
8661
|
+
const { exitWithError: exitWithError2 } = await import("./errors-VS7SGW7B.js");
|
|
8477
8662
|
exitWithError2(err);
|
|
8478
8663
|
}
|
|
8479
8664
|
});
|
|
@@ -8550,10 +8735,10 @@ async function performEvmSend(program2, toArg, amountArg, tokenAddress, opts = {
|
|
|
8550
8735
|
const { id } = await withSpinner(
|
|
8551
8736
|
"Sending transaction\u2026",
|
|
8552
8737
|
"Transaction submitted",
|
|
8553
|
-
() => client.sendCalls({
|
|
8738
|
+
() => withPreflightRevert(() => client.sendCalls({
|
|
8554
8739
|
calls,
|
|
8555
8740
|
capabilities: paymaster ? { paymaster } : void 0
|
|
8556
|
-
})
|
|
8741
|
+
}))
|
|
8557
8742
|
);
|
|
8558
8743
|
const status = await withSpinner(
|
|
8559
8744
|
"Waiting for confirmation\u2026",
|
|
@@ -8679,7 +8864,7 @@ function buildWalletQuoteClient(program2, address3) {
|
|
|
8679
8864
|
}
|
|
8680
8865
|
|
|
8681
8866
|
// src/lib/quote-errors.ts
|
|
8682
|
-
function
|
|
8867
|
+
function errorText2(err) {
|
|
8683
8868
|
if (err instanceof CLIError) {
|
|
8684
8869
|
return [err.message, err.details].filter(Boolean).join(" ");
|
|
8685
8870
|
}
|
|
@@ -8737,7 +8922,7 @@ function normalizeQuoteError(err, flow) {
|
|
|
8737
8922
|
if (err instanceof CLIError && err.code !== ErrorCode.RPC_ERROR && err.code !== ErrorCode.INTERNAL_ERROR) {
|
|
8738
8923
|
return err;
|
|
8739
8924
|
}
|
|
8740
|
-
const detail =
|
|
8925
|
+
const detail = errorText2(err);
|
|
8741
8926
|
const cause = classifyQuoteFailure(detail);
|
|
8742
8927
|
return new CLIError(
|
|
8743
8928
|
ErrorCode.QUOTE_FAILED,
|
|
@@ -8810,10 +8995,10 @@ async function prepareQuoteForExecution(client, quote) {
|
|
|
8810
8995
|
const preparedQuote = await withSpinner(
|
|
8811
8996
|
"Preparing swap\u2026",
|
|
8812
8997
|
"Swap prepared",
|
|
8813
|
-
() => client.prepareCalls({
|
|
8998
|
+
() => withPreflightRevert(() => client.prepareCalls({
|
|
8814
8999
|
...permitQuote.modifiedRequest,
|
|
8815
9000
|
paymasterPermitSignature: permitSignature
|
|
8816
|
-
})
|
|
9001
|
+
}))
|
|
8817
9002
|
);
|
|
8818
9003
|
if ("type" in preparedQuote && preparedQuote.type === "paymaster-permit") {
|
|
8819
9004
|
throw errInvalidArgs("Swap quote still requires a paymaster permit after signing. The quote response format may be unsupported.");
|
|
@@ -8954,14 +9139,14 @@ async function performSwapExecute(program2, opts) {
|
|
|
8954
9139
|
async () => {
|
|
8955
9140
|
if ("rawCalls" in preparedQuote && preparedQuote.rawCalls === true) {
|
|
8956
9141
|
const rawCallsQuote = preparedQuote;
|
|
8957
|
-
return client.sendCalls({
|
|
9142
|
+
return withPreflightRevert(() => client.sendCalls({
|
|
8958
9143
|
calls: rawCallsQuote.calls,
|
|
8959
9144
|
capabilities: paymaster ? { paymaster } : void 0
|
|
8960
|
-
});
|
|
9145
|
+
}));
|
|
8961
9146
|
}
|
|
8962
9147
|
const executablePreparedQuote = preparedQuote;
|
|
8963
9148
|
const signedQuote = await client.signPreparedCalls(executablePreparedQuote);
|
|
8964
|
-
return client.sendPreparedCalls(signedQuote);
|
|
9149
|
+
return withPreflightRevert(() => client.sendPreparedCalls(signedQuote));
|
|
8965
9150
|
}
|
|
8966
9151
|
);
|
|
8967
9152
|
const status = await withSpinner(
|
|
@@ -9516,10 +9701,10 @@ async function prepareQuoteForExecution2(client, quote) {
|
|
|
9516
9701
|
const preparedQuote = await withSpinner(
|
|
9517
9702
|
"Preparing bridge\u2026",
|
|
9518
9703
|
"Bridge prepared",
|
|
9519
|
-
() => client.prepareCalls({
|
|
9704
|
+
() => withPreflightRevert(() => client.prepareCalls({
|
|
9520
9705
|
...permitQuote.modifiedRequest,
|
|
9521
9706
|
paymasterPermitSignature: permitSignature
|
|
9522
|
-
})
|
|
9707
|
+
}))
|
|
9523
9708
|
);
|
|
9524
9709
|
if ("type" in preparedQuote && preparedQuote.type === "paymaster-permit") {
|
|
9525
9710
|
throw errInvalidArgs("Bridge quote still requires a paymaster permit after signing. The quote response format may be unsupported.");
|
|
@@ -9673,14 +9858,14 @@ async function performBridgeExecute(program2, opts) {
|
|
|
9673
9858
|
async () => {
|
|
9674
9859
|
if ("rawCalls" in preparedQuote && preparedQuote.rawCalls === true) {
|
|
9675
9860
|
const rawCallsQuote = preparedQuote;
|
|
9676
|
-
return client.sendCalls({
|
|
9861
|
+
return withPreflightRevert(() => client.sendCalls({
|
|
9677
9862
|
calls: rawCallsQuote.calls,
|
|
9678
9863
|
capabilities: paymaster ? { paymaster } : void 0
|
|
9679
|
-
});
|
|
9864
|
+
}));
|
|
9680
9865
|
}
|
|
9681
9866
|
const executablePreparedQuote = preparedQuote;
|
|
9682
9867
|
const signedQuote = await client.signPreparedCalls(executablePreparedQuote);
|
|
9683
|
-
return client.sendPreparedCalls(signedQuote);
|
|
9868
|
+
return withPreflightRevert(() => client.sendPreparedCalls(signedQuote));
|
|
9684
9869
|
}
|
|
9685
9870
|
);
|
|
9686
9871
|
const status = await withSpinner(
|
|
@@ -10396,7 +10581,7 @@ async function flushProcessOutput() {
|
|
|
10396
10581
|
}
|
|
10397
10582
|
program.name("alchemy").description(
|
|
10398
10583
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
10399
|
-
).version("0.
|
|
10584
|
+
).version("0.14.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
|
|
10400
10585
|
"-n, --network <network>",
|
|
10401
10586
|
"Target network for networked commands"
|
|
10402
10587
|
).option("--x402", "Use x402 wallet-based gateway auth").option(
|
|
@@ -10583,11 +10768,11 @@ ${styledLine}`;
|
|
|
10583
10768
|
"wallet"
|
|
10584
10769
|
];
|
|
10585
10770
|
if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
|
|
10586
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
10771
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-IRTGQL4A.js");
|
|
10587
10772
|
const authToken = resolveAuthToken2(cfg);
|
|
10588
10773
|
const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
|
|
10589
10774
|
if (authToken && !hasApiKey) {
|
|
10590
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
10775
|
+
const { selectAppAfterAuth } = await import("./auth-ZBEPAFEP.js");
|
|
10591
10776
|
console.log("");
|
|
10592
10777
|
console.log(` No app selected. Please select an app to continue.`);
|
|
10593
10778
|
await selectAppAfterAuth(authToken);
|
|
@@ -10622,7 +10807,7 @@ ${styledLine}`;
|
|
|
10622
10807
|
if (isInteractiveAllowed(program)) {
|
|
10623
10808
|
let latestForInteractiveStartup = null;
|
|
10624
10809
|
if (shouldRunOnboarding(program, cfg)) {
|
|
10625
|
-
const { runOnboarding } = await import("./onboarding-
|
|
10810
|
+
const { runOnboarding } = await import("./onboarding-QE43IUEK.js");
|
|
10626
10811
|
const latest = getAvailableUpdateOnce();
|
|
10627
10812
|
const completed = await runOnboarding(program, latest);
|
|
10628
10813
|
updateShownDuringInteractiveStartup = Boolean(latest);
|
|
@@ -10636,7 +10821,7 @@ ${styledLine}`;
|
|
|
10636
10821
|
latestForInteractiveStartup
|
|
10637
10822
|
);
|
|
10638
10823
|
}
|
|
10639
|
-
const { startREPL } = await import("./interactive-
|
|
10824
|
+
const { startREPL } = await import("./interactive-XNDXNMAJ.js");
|
|
10640
10825
|
program.exitOverride();
|
|
10641
10826
|
program.configureOutput({
|
|
10642
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-YB6AALZO.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-5DR7BHUX.js";
|
|
7
|
-
import "./chunk-I6YQX7PF.js";
|
|
8
|
-
import "./chunk-RPSHRYCZ.js";
|
|
9
|
-
import "./chunk-PRSZJXA6.js";
|
|
10
|
-
import "./chunk-DXQAGBW6.js";
|
|
11
|
-
import "./chunk-LANOFNO6.js";
|
|
12
|
-
import "./chunk-5BEJA752.js";
|
|
13
|
-
export {
|
|
14
|
-
registerAuth,
|
|
15
|
-
selectAppAfterAuth
|
|
16
|
-
};
|