@layr-labs/ecloud-cli 0.2.0 → 0.2.1-dev
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/VERSION +2 -2
- package/dist/commands/auth/whoami.js +16 -3
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/cancel.js +44 -5
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/status.js +44 -5
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +44 -5
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/compute/app/create.js +16 -3
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +111 -24
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +107 -33
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +70 -13
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +68 -27
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +107 -38
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/releases.js +68 -24
- package/dist/commands/compute/app/releases.js.map +1 -1
- package/dist/commands/compute/app/start.js +76 -34
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/stop.js +76 -34
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +76 -34
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +106 -36
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +52 -13
- package/dist/commands/compute/build/info.js.map +1 -1
- package/dist/commands/compute/build/list.js +52 -13
- package/dist/commands/compute/build/list.js.map +1 -1
- package/dist/commands/compute/build/logs.js +52 -13
- package/dist/commands/compute/build/logs.js.map +1 -1
- package/dist/commands/compute/build/status.js +52 -13
- package/dist/commands/compute/build/status.js.map +1 -1
- package/dist/commands/compute/build/submit.js +65 -9
- package/dist/commands/compute/build/submit.js.map +1 -1
- package/dist/commands/compute/build/verify.js +52 -13
- package/dist/commands/compute/build/verify.js.map +1 -1
- package/dist/commands/compute/environment/set.js +20 -7
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/undelegate.js +46 -10
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// src/commands/compute/app/info.ts
|
|
4
4
|
import { Command, Args, Flags as Flags2 } from "@oclif/core";
|
|
5
5
|
import {
|
|
6
|
-
getEnvironmentConfig as
|
|
6
|
+
getEnvironmentConfig as getEnvironmentConfig3,
|
|
7
7
|
getAppLatestReleaseBlockNumbers,
|
|
8
8
|
getBlockTimestamps,
|
|
9
9
|
UserApiClient as UserApiClient3
|
|
@@ -19,9 +19,9 @@ import fs3 from "fs";
|
|
|
19
19
|
import path3 from "path";
|
|
20
20
|
import os3 from "os";
|
|
21
21
|
import { isAddress as isAddress2 } from "viem";
|
|
22
|
-
import { privateKeyToAccount as
|
|
22
|
+
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
23
23
|
import {
|
|
24
|
-
getEnvironmentConfig,
|
|
24
|
+
getEnvironmentConfig as getEnvironmentConfig2,
|
|
25
25
|
getAvailableEnvironments,
|
|
26
26
|
isEnvironmentAvailable,
|
|
27
27
|
getAllAppsByDeveloper as getAllAppsByDeveloper2,
|
|
@@ -38,12 +38,43 @@ import {
|
|
|
38
38
|
|
|
39
39
|
// src/utils/appResolver.ts
|
|
40
40
|
import { isAddress } from "viem";
|
|
41
|
-
import { privateKeyToAccount } from "viem/accounts";
|
|
41
|
+
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
42
42
|
import {
|
|
43
43
|
UserApiClient,
|
|
44
44
|
getAllAppsByDeveloper
|
|
45
45
|
} from "@layr-labs/ecloud-sdk";
|
|
46
46
|
|
|
47
|
+
// src/utils/viemClients.ts
|
|
48
|
+
import {
|
|
49
|
+
createPublicClient,
|
|
50
|
+
http
|
|
51
|
+
} from "viem";
|
|
52
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
53
|
+
import {
|
|
54
|
+
getEnvironmentConfig,
|
|
55
|
+
addHexPrefix,
|
|
56
|
+
createViemClients as sdkCreateViemClients,
|
|
57
|
+
getChainFromID
|
|
58
|
+
} from "@layr-labs/ecloud-sdk";
|
|
59
|
+
function createViemClients(options) {
|
|
60
|
+
const privateKey = addHexPrefix(options.privateKey);
|
|
61
|
+
const environmentConfig = getEnvironmentConfig(options.environment);
|
|
62
|
+
const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
|
|
63
|
+
const chain = getChainFromID(environmentConfig.chainID);
|
|
64
|
+
const { publicClient, walletClient } = sdkCreateViemClients({
|
|
65
|
+
privateKey,
|
|
66
|
+
rpcUrl,
|
|
67
|
+
chainId: environmentConfig.chainID
|
|
68
|
+
});
|
|
69
|
+
const account = privateKeyToAccount(privateKey);
|
|
70
|
+
return {
|
|
71
|
+
publicClient,
|
|
72
|
+
walletClient,
|
|
73
|
+
chain,
|
|
74
|
+
address: account.address
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
47
78
|
// src/utils/globalConfig.ts
|
|
48
79
|
import * as fs from "fs";
|
|
49
80
|
import * as path from "path";
|
|
@@ -188,7 +219,7 @@ function listApps(environment) {
|
|
|
188
219
|
|
|
189
220
|
// src/utils/version.ts
|
|
190
221
|
function getCliVersion() {
|
|
191
|
-
return true ? "0.2.
|
|
222
|
+
return true ? "0.2.1-dev" : "0.0.0";
|
|
192
223
|
}
|
|
193
224
|
function getClientId() {
|
|
194
225
|
return `ecloud-cli/v${getCliVersion()}`;
|
|
@@ -211,7 +242,7 @@ async function getAppInfosChunked(userApiClient, appIds, addressCount) {
|
|
|
211
242
|
}
|
|
212
243
|
|
|
213
244
|
// src/utils/prompts.ts
|
|
214
|
-
function
|
|
245
|
+
function addHexPrefix2(value) {
|
|
215
246
|
if (value.startsWith("0x")) {
|
|
216
247
|
return value;
|
|
217
248
|
}
|
|
@@ -275,7 +306,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
275
306
|
};
|
|
276
307
|
}
|
|
277
308
|
if (options.appID) {
|
|
278
|
-
const normalized = typeof options.appID === "string" ?
|
|
309
|
+
const normalized = typeof options.appID === "string" ? addHexPrefix2(options.appID) : options.appID;
|
|
279
310
|
if (isAddress2(normalized)) {
|
|
280
311
|
return normalized;
|
|
281
312
|
}
|
|
@@ -291,7 +322,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
291
322
|
const apps = listApps(options.environment);
|
|
292
323
|
const foundAppID = apps[options.appID];
|
|
293
324
|
if (foundAppID) {
|
|
294
|
-
return
|
|
325
|
+
return addHexPrefix2(foundAppID);
|
|
295
326
|
}
|
|
296
327
|
throw new Error(
|
|
297
328
|
`App name '${options.appID}' not found in environment '${options.environment}'`
|
|
@@ -302,18 +333,23 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
302
333
|
async function getAppIDInteractive(options) {
|
|
303
334
|
const action = options.action || "view";
|
|
304
335
|
const environment = options.environment || "sepolia";
|
|
305
|
-
const environmentConfig =
|
|
336
|
+
const environmentConfig = getEnvironmentConfig2(environment);
|
|
306
337
|
if (!options.privateKey || !options.rpcUrl) {
|
|
307
338
|
return getAppIDInteractiveFromRegistry(environment, action);
|
|
308
339
|
}
|
|
309
340
|
console.log(`
|
|
310
341
|
Select an app to ${action}:
|
|
311
342
|
`);
|
|
312
|
-
const privateKeyHex =
|
|
313
|
-
const account =
|
|
343
|
+
const privateKeyHex = addHexPrefix2(options.privateKey);
|
|
344
|
+
const account = privateKeyToAccount3(privateKeyHex);
|
|
314
345
|
const developerAddr = account.address;
|
|
346
|
+
const { publicClient, walletClient } = createViemClients({
|
|
347
|
+
privateKey: options.privateKey,
|
|
348
|
+
rpcUrl: options.rpcUrl,
|
|
349
|
+
environment
|
|
350
|
+
});
|
|
315
351
|
const { apps, appConfigs } = await getAllAppsByDeveloper2(
|
|
316
|
-
|
|
352
|
+
publicClient,
|
|
317
353
|
environmentConfig,
|
|
318
354
|
developerAddr
|
|
319
355
|
);
|
|
@@ -326,8 +362,8 @@ Select an app to ${action}:
|
|
|
326
362
|
try {
|
|
327
363
|
const userApiClient = new UserApiClient2(
|
|
328
364
|
environmentConfig,
|
|
329
|
-
|
|
330
|
-
|
|
365
|
+
walletClient,
|
|
366
|
+
publicClient,
|
|
331
367
|
getClientId()
|
|
332
368
|
);
|
|
333
369
|
const appInfos = await getAppInfosChunked(userApiClient, apps);
|
|
@@ -452,14 +488,14 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
|
|
|
452
488
|
if (!value) {
|
|
453
489
|
return "App ID or name cannot be empty";
|
|
454
490
|
}
|
|
455
|
-
const normalized2 =
|
|
491
|
+
const normalized2 = addHexPrefix2(value);
|
|
456
492
|
if (isAddress2(normalized2)) {
|
|
457
493
|
return true;
|
|
458
494
|
}
|
|
459
495
|
return "Invalid app ID address";
|
|
460
496
|
}
|
|
461
497
|
});
|
|
462
|
-
const normalized =
|
|
498
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
463
499
|
if (isAddress2(normalized)) {
|
|
464
500
|
return normalized;
|
|
465
501
|
}
|
|
@@ -495,7 +531,7 @@ Select an app to ${action}:`);
|
|
|
495
531
|
if (!value) {
|
|
496
532
|
return "App ID or name cannot be empty";
|
|
497
533
|
}
|
|
498
|
-
const normalized2 =
|
|
534
|
+
const normalized2 = addHexPrefix2(value);
|
|
499
535
|
if (isAddress2(normalized2)) {
|
|
500
536
|
return true;
|
|
501
537
|
}
|
|
@@ -505,17 +541,17 @@ Select an app to ${action}:`);
|
|
|
505
541
|
return "Invalid app ID or name not found";
|
|
506
542
|
}
|
|
507
543
|
});
|
|
508
|
-
const normalized =
|
|
544
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
509
545
|
if (isAddress2(normalized)) {
|
|
510
546
|
return normalized;
|
|
511
547
|
}
|
|
512
548
|
const foundAppID = allApps[appIDInput];
|
|
513
549
|
if (foundAppID) {
|
|
514
|
-
return
|
|
550
|
+
return addHexPrefix2(foundAppID);
|
|
515
551
|
}
|
|
516
552
|
throw new Error(`Failed to resolve app ID from input: ${appIDInput}`);
|
|
517
553
|
}
|
|
518
|
-
return
|
|
554
|
+
return addHexPrefix2(selected);
|
|
519
555
|
}
|
|
520
556
|
async function getPrivateKeyInteractive(privateKey) {
|
|
521
557
|
if (privateKey) {
|
|
@@ -547,7 +583,7 @@ async function getPrivateKeyInteractive(privateKey) {
|
|
|
547
583
|
async function getEnvironmentInteractive(environment) {
|
|
548
584
|
if (environment) {
|
|
549
585
|
try {
|
|
550
|
-
|
|
586
|
+
getEnvironmentConfig2(environment);
|
|
551
587
|
if (!isEnvironmentAvailable(environment)) {
|
|
552
588
|
throw new Error(`Environment ${environment} is not available in this build`);
|
|
553
589
|
}
|
|
@@ -560,7 +596,7 @@ async function getEnvironmentInteractive(environment) {
|
|
|
560
596
|
const configDefaultEnv = getDefaultEnvironment();
|
|
561
597
|
if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
|
|
562
598
|
try {
|
|
563
|
-
|
|
599
|
+
getEnvironmentConfig2(configDefaultEnv);
|
|
564
600
|
defaultEnv = configDefaultEnv;
|
|
565
601
|
} catch {
|
|
566
602
|
}
|
|
@@ -748,6 +784,17 @@ function printAppDisplay(display, log, indent = " ", options = {}) {
|
|
|
748
784
|
}
|
|
749
785
|
}
|
|
750
786
|
|
|
787
|
+
// src/utils/dashboard.ts
|
|
788
|
+
var DASHBOARD_URLS = {
|
|
789
|
+
"sepolia-dev": "https://compute-dashboard-sepolia-dev.vercel.app",
|
|
790
|
+
sepolia: "https://verify-sepolia.eigencloud.xyz",
|
|
791
|
+
"mainnet-alpha": "https://verify.eigencloud.xyz"
|
|
792
|
+
};
|
|
793
|
+
function getDashboardUrl(environment, appAddress) {
|
|
794
|
+
const baseUrl = DASHBOARD_URLS[environment] || DASHBOARD_URLS["sepolia"];
|
|
795
|
+
return `${baseUrl}/app/${appAddress}`;
|
|
796
|
+
}
|
|
797
|
+
|
|
751
798
|
// src/commands/compute/app/info.ts
|
|
752
799
|
import chalk2 from "chalk";
|
|
753
800
|
var AppInfo2 = class _AppInfo extends Command {
|
|
@@ -774,7 +821,7 @@ var AppInfo2 = class _AppInfo extends Command {
|
|
|
774
821
|
const { args, flags } = await this.parse(_AppInfo);
|
|
775
822
|
const validatedFlags = await validateCommonFlags(flags);
|
|
776
823
|
const environment = validatedFlags.environment;
|
|
777
|
-
const environmentConfig =
|
|
824
|
+
const environmentConfig = getEnvironmentConfig3(environment);
|
|
778
825
|
const rpcUrl = validatedFlags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
779
826
|
const privateKey = validatedFlags["private-key"];
|
|
780
827
|
const appID = await getOrPromptAppID({
|
|
@@ -784,26 +831,31 @@ var AppInfo2 = class _AppInfo extends Command {
|
|
|
784
831
|
rpcUrl,
|
|
785
832
|
action: "view info for"
|
|
786
833
|
});
|
|
787
|
-
const
|
|
834
|
+
const { publicClient, walletClient } = createViemClients({
|
|
835
|
+
privateKey,
|
|
836
|
+
rpcUrl,
|
|
837
|
+
environment
|
|
838
|
+
});
|
|
839
|
+
const userApiClient = new UserApiClient3(environmentConfig, walletClient, publicClient, getClientId());
|
|
788
840
|
if (flags.watch) {
|
|
789
|
-
await this.watchMode(appID, userApiClient,
|
|
841
|
+
await this.watchMode(appID, userApiClient, publicClient, environmentConfig, flags["address-count"]);
|
|
790
842
|
} else {
|
|
791
843
|
await this.displayAppInfo(
|
|
792
844
|
appID,
|
|
793
845
|
userApiClient,
|
|
794
|
-
|
|
846
|
+
publicClient,
|
|
795
847
|
environmentConfig,
|
|
796
848
|
flags["address-count"]
|
|
797
849
|
);
|
|
798
850
|
}
|
|
799
851
|
}
|
|
800
|
-
async displayAppInfo(appID, userApiClient,
|
|
852
|
+
async displayAppInfo(appID, userApiClient, publicClient, environmentConfig, addressCount, clearScreen = false) {
|
|
801
853
|
const [appInfos, releaseBlockNumbers] = await Promise.all([
|
|
802
854
|
userApiClient.getInfos([appID], addressCount).catch((err) => {
|
|
803
855
|
this.warn(`Could not fetch app info: ${err}`);
|
|
804
856
|
return [];
|
|
805
857
|
}),
|
|
806
|
-
getAppLatestReleaseBlockNumbers(
|
|
858
|
+
getAppLatestReleaseBlockNumbers(publicClient, environmentConfig, [appID]).catch((err) => {
|
|
807
859
|
this.warn(`Could not fetch release block numbers: ${err}`);
|
|
808
860
|
return /* @__PURE__ */ new Map();
|
|
809
861
|
})
|
|
@@ -815,11 +867,28 @@ var AppInfo2 = class _AppInfo extends Command {
|
|
|
815
867
|
const releaseBlockNumber = releaseBlockNumbers.get(appID);
|
|
816
868
|
let releaseTimestamp;
|
|
817
869
|
if (releaseBlockNumber && releaseBlockNumber > 0) {
|
|
818
|
-
const blockTimestamps = await getBlockTimestamps(
|
|
870
|
+
const blockTimestamps = await getBlockTimestamps(publicClient, [
|
|
819
871
|
releaseBlockNumber
|
|
820
|
-
]).catch(() =>
|
|
872
|
+
]).catch((err) => {
|
|
873
|
+
this.debug(`Could not fetch block timestamps: ${err}`);
|
|
874
|
+
return /* @__PURE__ */ new Map();
|
|
875
|
+
});
|
|
821
876
|
releaseTimestamp = blockTimestamps.get(releaseBlockNumber);
|
|
822
877
|
}
|
|
878
|
+
let verifiabilityStatus;
|
|
879
|
+
try {
|
|
880
|
+
const appResponse = await userApiClient.getApp(appID);
|
|
881
|
+
const latestRelease = appResponse.releases?.[0];
|
|
882
|
+
if (latestRelease?.build?.provenanceSignature) {
|
|
883
|
+
verifiabilityStatus = chalk2.green("Verifiable \u2713");
|
|
884
|
+
} else {
|
|
885
|
+
verifiabilityStatus = chalk2.yellow(
|
|
886
|
+
"(dev image, not built verifiably, production workloads should always be verifiable)"
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
} catch (err) {
|
|
890
|
+
this.debug(`Could not determine verifiability status: ${err}`);
|
|
891
|
+
}
|
|
823
892
|
if (clearScreen) {
|
|
824
893
|
console.clear();
|
|
825
894
|
}
|
|
@@ -836,17 +905,22 @@ var AppInfo2 = class _AppInfo extends Command {
|
|
|
836
905
|
singleAddress: false,
|
|
837
906
|
showProfile: true
|
|
838
907
|
});
|
|
908
|
+
if (verifiabilityStatus) {
|
|
909
|
+
this.log(` Build: ${verifiabilityStatus}`);
|
|
910
|
+
}
|
|
911
|
+
const dashboardUrl = getDashboardUrl(environmentConfig.name, appID);
|
|
912
|
+
this.log(` Dashboard: ${chalk2.blue.underline(dashboardUrl)}`);
|
|
839
913
|
console.log();
|
|
840
914
|
}
|
|
841
|
-
async watchMode(appID, userApiClient,
|
|
915
|
+
async watchMode(appID, userApiClient, publicClient, environmentConfig, addressCount) {
|
|
842
916
|
const REFRESH_INTERVAL_SECONDS = 5;
|
|
843
|
-
await this.displayAppInfo(appID, userApiClient,
|
|
917
|
+
await this.displayAppInfo(appID, userApiClient, publicClient, environmentConfig, addressCount, true);
|
|
844
918
|
while (true) {
|
|
845
919
|
await showCountdown(REFRESH_INTERVAL_SECONDS);
|
|
846
920
|
await this.displayAppInfo(
|
|
847
921
|
appID,
|
|
848
922
|
userApiClient,
|
|
849
|
-
|
|
923
|
+
publicClient,
|
|
850
924
|
environmentConfig,
|
|
851
925
|
addressCount,
|
|
852
926
|
true
|