@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
|
@@ -14,9 +14,9 @@ import fs3 from "fs";
|
|
|
14
14
|
import path3 from "path";
|
|
15
15
|
import os3 from "os";
|
|
16
16
|
import { isAddress as isAddress2 } from "viem";
|
|
17
|
-
import { privateKeyToAccount as
|
|
17
|
+
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
18
18
|
import {
|
|
19
|
-
getEnvironmentConfig,
|
|
19
|
+
getEnvironmentConfig as getEnvironmentConfig2,
|
|
20
20
|
getAvailableEnvironments,
|
|
21
21
|
isEnvironmentAvailable,
|
|
22
22
|
getAllAppsByDeveloper as getAllAppsByDeveloper2,
|
|
@@ -33,12 +33,43 @@ import {
|
|
|
33
33
|
|
|
34
34
|
// src/utils/appResolver.ts
|
|
35
35
|
import { isAddress } from "viem";
|
|
36
|
-
import { privateKeyToAccount } from "viem/accounts";
|
|
36
|
+
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
37
37
|
import {
|
|
38
38
|
UserApiClient,
|
|
39
39
|
getAllAppsByDeveloper
|
|
40
40
|
} from "@layr-labs/ecloud-sdk";
|
|
41
41
|
|
|
42
|
+
// src/utils/viemClients.ts
|
|
43
|
+
import {
|
|
44
|
+
createPublicClient,
|
|
45
|
+
http
|
|
46
|
+
} from "viem";
|
|
47
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
48
|
+
import {
|
|
49
|
+
getEnvironmentConfig,
|
|
50
|
+
addHexPrefix,
|
|
51
|
+
createViemClients as sdkCreateViemClients,
|
|
52
|
+
getChainFromID
|
|
53
|
+
} from "@layr-labs/ecloud-sdk";
|
|
54
|
+
function createViemClients(options) {
|
|
55
|
+
const privateKey = addHexPrefix(options.privateKey);
|
|
56
|
+
const environmentConfig = getEnvironmentConfig(options.environment);
|
|
57
|
+
const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
|
|
58
|
+
const chain = getChainFromID(environmentConfig.chainID);
|
|
59
|
+
const { publicClient, walletClient } = sdkCreateViemClients({
|
|
60
|
+
privateKey,
|
|
61
|
+
rpcUrl,
|
|
62
|
+
chainId: environmentConfig.chainID
|
|
63
|
+
});
|
|
64
|
+
const account = privateKeyToAccount(privateKey);
|
|
65
|
+
return {
|
|
66
|
+
publicClient,
|
|
67
|
+
walletClient,
|
|
68
|
+
chain,
|
|
69
|
+
address: account.address
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
42
73
|
// src/utils/globalConfig.ts
|
|
43
74
|
import * as fs from "fs";
|
|
44
75
|
import * as path from "path";
|
|
@@ -125,7 +156,7 @@ var APPS_DIR = path2.join(CONFIG_DIR, "apps");
|
|
|
125
156
|
|
|
126
157
|
// src/utils/version.ts
|
|
127
158
|
function getCliVersion() {
|
|
128
|
-
return true ? "0.2.
|
|
159
|
+
return true ? "0.2.1-dev" : "0.0.0";
|
|
129
160
|
}
|
|
130
161
|
function getClientId() {
|
|
131
162
|
return `ecloud-cli/v${getCliVersion()}`;
|
|
@@ -242,7 +273,7 @@ async function getPrivateKeyInteractive(privateKey) {
|
|
|
242
273
|
async function getEnvironmentInteractive(environment) {
|
|
243
274
|
if (environment) {
|
|
244
275
|
try {
|
|
245
|
-
|
|
276
|
+
getEnvironmentConfig2(environment);
|
|
246
277
|
if (!isEnvironmentAvailable(environment)) {
|
|
247
278
|
throw new Error(`Environment ${environment} is not available in this build`);
|
|
248
279
|
}
|
|
@@ -255,7 +286,7 @@ async function getEnvironmentInteractive(environment) {
|
|
|
255
286
|
const configDefaultEnv = getDefaultEnvironment();
|
|
256
287
|
if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
|
|
257
288
|
try {
|
|
258
|
-
|
|
289
|
+
getEnvironmentConfig2(configDefaultEnv);
|
|
259
290
|
defaultEnv = configDefaultEnv;
|
|
260
291
|
} catch {
|
|
261
292
|
}
|
|
@@ -322,16 +353,24 @@ import {
|
|
|
322
353
|
createComputeModule,
|
|
323
354
|
createBillingModule,
|
|
324
355
|
createBuildModule,
|
|
325
|
-
getEnvironmentConfig as
|
|
356
|
+
getEnvironmentConfig as getEnvironmentConfig3,
|
|
326
357
|
requirePrivateKey,
|
|
327
358
|
getPrivateKeyWithSource
|
|
328
359
|
} from "@layr-labs/ecloud-sdk";
|
|
329
360
|
async function createBuildClient(flags) {
|
|
330
361
|
flags = await validateCommonFlags(flags, { requirePrivateKey: false });
|
|
362
|
+
const environment = flags.environment || "mainnet";
|
|
363
|
+
const environmentConfig = getEnvironmentConfig3(environment);
|
|
364
|
+
const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
365
|
+
const { walletClient } = createViemClients({
|
|
366
|
+
privateKey: flags["private-key"],
|
|
367
|
+
rpcUrl,
|
|
368
|
+
environment
|
|
369
|
+
});
|
|
331
370
|
return createBuildModule({
|
|
332
371
|
verbose: flags.verbose,
|
|
333
|
-
|
|
334
|
-
environment
|
|
372
|
+
walletClient: flags["private-key"] ? walletClient : void 0,
|
|
373
|
+
environment,
|
|
335
374
|
clientId: getClientId(),
|
|
336
375
|
skipTelemetry: true
|
|
337
376
|
// CLI already has telemetry, skip SDK telemetry
|
|
@@ -561,6 +600,10 @@ Build ID: ${chalk.cyan(buildId)}`);
|
|
|
561
600
|
`
|
|
562
601
|
Use ${chalk.yellow(`ecloud compute build logs ${buildId} --follow`)} to watch progress`
|
|
563
602
|
);
|
|
603
|
+
this.log("");
|
|
604
|
+
this.log(chalk.gray("After the build completes, deploy or upgrade your app with the digest:"));
|
|
605
|
+
this.log(chalk.gray(" ecloud compute app deploy --verifiable --image-ref <digest>"));
|
|
606
|
+
this.log(chalk.gray(" ecloud compute app upgrade <app-id> --verifiable --image-ref <digest>"));
|
|
564
607
|
}
|
|
565
608
|
return;
|
|
566
609
|
}
|
|
@@ -607,6 +650,19 @@ Use ${chalk.yellow(`ecloud compute build logs ${buildId} --follow`)} to watch pr
|
|
|
607
650
|
})) {
|
|
608
651
|
this.log(line);
|
|
609
652
|
}
|
|
653
|
+
this.log("");
|
|
654
|
+
this.log(chalk.bold("Next Steps:"));
|
|
655
|
+
this.log(
|
|
656
|
+
chalk.gray(
|
|
657
|
+
"Submitting a build alone doesn't update your app. Deploy or upgrade with the new digest:"
|
|
658
|
+
)
|
|
659
|
+
);
|
|
660
|
+
this.log("");
|
|
661
|
+
this.log(chalk.yellow(" Deploy a new app:"));
|
|
662
|
+
this.log(` ecloud compute app deploy --verifiable --image-ref ${build.imageDigest}`);
|
|
663
|
+
this.log("");
|
|
664
|
+
this.log(chalk.yellow(" Upgrade an existing app:"));
|
|
665
|
+
this.log(` ecloud compute app upgrade <app-id> --verifiable --image-ref ${build.imageDigest}`);
|
|
610
666
|
} else {
|
|
611
667
|
this.log(chalk.red(`Build failed: ${build.errorMessage ?? "Unknown error"}`));
|
|
612
668
|
}
|