@layr-labs/ecloud-cli 0.2.0-dev.3 → 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/commands/compute/app/releases.ts
|
|
4
4
|
import { Command, Args, Flags as Flags2 } from "@oclif/core";
|
|
5
|
-
import { getEnvironmentConfig as
|
|
5
|
+
import { getEnvironmentConfig as getEnvironmentConfig3, UserApiClient as UserApiClient3 } from "@layr-labs/ecloud-sdk";
|
|
6
6
|
|
|
7
7
|
// src/flags.ts
|
|
8
8
|
import { Flags } from "@oclif/core";
|
|
@@ -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";
|
|
@@ -205,7 +236,7 @@ function listApps(environment) {
|
|
|
205
236
|
|
|
206
237
|
// src/utils/version.ts
|
|
207
238
|
function getCliVersion() {
|
|
208
|
-
return true ? "0.2.
|
|
239
|
+
return true ? "0.2.1-dev" : "0.0.0";
|
|
209
240
|
}
|
|
210
241
|
function getClientId() {
|
|
211
242
|
return `ecloud-cli/v${getCliVersion()}`;
|
|
@@ -228,7 +259,7 @@ async function getAppInfosChunked(userApiClient, appIds, addressCount) {
|
|
|
228
259
|
}
|
|
229
260
|
|
|
230
261
|
// src/utils/prompts.ts
|
|
231
|
-
function
|
|
262
|
+
function addHexPrefix2(value) {
|
|
232
263
|
if (value.startsWith("0x")) {
|
|
233
264
|
return value;
|
|
234
265
|
}
|
|
@@ -292,7 +323,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
292
323
|
};
|
|
293
324
|
}
|
|
294
325
|
if (options.appID) {
|
|
295
|
-
const normalized = typeof options.appID === "string" ?
|
|
326
|
+
const normalized = typeof options.appID === "string" ? addHexPrefix2(options.appID) : options.appID;
|
|
296
327
|
if (isAddress2(normalized)) {
|
|
297
328
|
return normalized;
|
|
298
329
|
}
|
|
@@ -308,7 +339,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
308
339
|
const apps = listApps(options.environment);
|
|
309
340
|
const foundAppID = apps[options.appID];
|
|
310
341
|
if (foundAppID) {
|
|
311
|
-
return
|
|
342
|
+
return addHexPrefix2(foundAppID);
|
|
312
343
|
}
|
|
313
344
|
throw new Error(
|
|
314
345
|
`App name '${options.appID}' not found in environment '${options.environment}'`
|
|
@@ -319,18 +350,23 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
|
319
350
|
async function getAppIDInteractive(options) {
|
|
320
351
|
const action = options.action || "view";
|
|
321
352
|
const environment = options.environment || "sepolia";
|
|
322
|
-
const environmentConfig =
|
|
353
|
+
const environmentConfig = getEnvironmentConfig2(environment);
|
|
323
354
|
if (!options.privateKey || !options.rpcUrl) {
|
|
324
355
|
return getAppIDInteractiveFromRegistry(environment, action);
|
|
325
356
|
}
|
|
326
357
|
console.log(`
|
|
327
358
|
Select an app to ${action}:
|
|
328
359
|
`);
|
|
329
|
-
const privateKeyHex =
|
|
330
|
-
const account =
|
|
360
|
+
const privateKeyHex = addHexPrefix2(options.privateKey);
|
|
361
|
+
const account = privateKeyToAccount3(privateKeyHex);
|
|
331
362
|
const developerAddr = account.address;
|
|
363
|
+
const { publicClient, walletClient } = createViemClients({
|
|
364
|
+
privateKey: options.privateKey,
|
|
365
|
+
rpcUrl: options.rpcUrl,
|
|
366
|
+
environment
|
|
367
|
+
});
|
|
332
368
|
const { apps, appConfigs } = await getAllAppsByDeveloper2(
|
|
333
|
-
|
|
369
|
+
publicClient,
|
|
334
370
|
environmentConfig,
|
|
335
371
|
developerAddr
|
|
336
372
|
);
|
|
@@ -343,8 +379,8 @@ Select an app to ${action}:
|
|
|
343
379
|
try {
|
|
344
380
|
const userApiClient = new UserApiClient2(
|
|
345
381
|
environmentConfig,
|
|
346
|
-
|
|
347
|
-
|
|
382
|
+
walletClient,
|
|
383
|
+
publicClient,
|
|
348
384
|
getClientId()
|
|
349
385
|
);
|
|
350
386
|
const appInfos = await getAppInfosChunked(userApiClient, apps);
|
|
@@ -469,14 +505,14 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
|
|
|
469
505
|
if (!value) {
|
|
470
506
|
return "App ID or name cannot be empty";
|
|
471
507
|
}
|
|
472
|
-
const normalized2 =
|
|
508
|
+
const normalized2 = addHexPrefix2(value);
|
|
473
509
|
if (isAddress2(normalized2)) {
|
|
474
510
|
return true;
|
|
475
511
|
}
|
|
476
512
|
return "Invalid app ID address";
|
|
477
513
|
}
|
|
478
514
|
});
|
|
479
|
-
const normalized =
|
|
515
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
480
516
|
if (isAddress2(normalized)) {
|
|
481
517
|
return normalized;
|
|
482
518
|
}
|
|
@@ -512,7 +548,7 @@ Select an app to ${action}:`);
|
|
|
512
548
|
if (!value) {
|
|
513
549
|
return "App ID or name cannot be empty";
|
|
514
550
|
}
|
|
515
|
-
const normalized2 =
|
|
551
|
+
const normalized2 = addHexPrefix2(value);
|
|
516
552
|
if (isAddress2(normalized2)) {
|
|
517
553
|
return true;
|
|
518
554
|
}
|
|
@@ -522,17 +558,17 @@ Select an app to ${action}:`);
|
|
|
522
558
|
return "Invalid app ID or name not found";
|
|
523
559
|
}
|
|
524
560
|
});
|
|
525
|
-
const normalized =
|
|
561
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
526
562
|
if (isAddress2(normalized)) {
|
|
527
563
|
return normalized;
|
|
528
564
|
}
|
|
529
565
|
const foundAppID = allApps[appIDInput];
|
|
530
566
|
if (foundAppID) {
|
|
531
|
-
return
|
|
567
|
+
return addHexPrefix2(foundAppID);
|
|
532
568
|
}
|
|
533
569
|
throw new Error(`Failed to resolve app ID from input: ${appIDInput}`);
|
|
534
570
|
}
|
|
535
|
-
return
|
|
571
|
+
return addHexPrefix2(selected);
|
|
536
572
|
}
|
|
537
573
|
async function getPrivateKeyInteractive(privateKey) {
|
|
538
574
|
if (privateKey) {
|
|
@@ -564,7 +600,7 @@ async function getPrivateKeyInteractive(privateKey) {
|
|
|
564
600
|
async function getEnvironmentInteractive(environment) {
|
|
565
601
|
if (environment) {
|
|
566
602
|
try {
|
|
567
|
-
|
|
603
|
+
getEnvironmentConfig2(environment);
|
|
568
604
|
if (!isEnvironmentAvailable(environment)) {
|
|
569
605
|
throw new Error(`Environment ${environment} is not available in this build`);
|
|
570
606
|
}
|
|
@@ -577,7 +613,7 @@ async function getEnvironmentInteractive(environment) {
|
|
|
577
613
|
const configDefaultEnv = getDefaultEnvironment();
|
|
578
614
|
if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
|
|
579
615
|
try {
|
|
580
|
-
|
|
616
|
+
getEnvironmentConfig2(configDefaultEnv);
|
|
581
617
|
defaultEnv = configDefaultEnv;
|
|
582
618
|
} catch {
|
|
583
619
|
}
|
|
@@ -964,7 +1000,7 @@ var AppReleases = class _AppReleases extends Command {
|
|
|
964
1000
|
requirePrivateKey: needsPrivateKey
|
|
965
1001
|
});
|
|
966
1002
|
const environment = validatedFlags.environment || "sepolia";
|
|
967
|
-
const environmentConfig =
|
|
1003
|
+
const environmentConfig = getEnvironmentConfig3(environment);
|
|
968
1004
|
const rpcUrl = validatedFlags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
969
1005
|
const privateKey = validatedFlags["private-key"];
|
|
970
1006
|
const appID = await getOrPromptAppID({
|
|
@@ -974,7 +1010,15 @@ var AppReleases = class _AppReleases extends Command {
|
|
|
974
1010
|
rpcUrl,
|
|
975
1011
|
action: "view releases for"
|
|
976
1012
|
});
|
|
977
|
-
|
|
1013
|
+
if (!privateKey) {
|
|
1014
|
+
this.error("Private key is required to fetch releases. Please provide --private-key.");
|
|
1015
|
+
}
|
|
1016
|
+
const { publicClient, walletClient } = createViemClients({
|
|
1017
|
+
privateKey,
|
|
1018
|
+
rpcUrl,
|
|
1019
|
+
environment
|
|
1020
|
+
});
|
|
1021
|
+
const userApiClient = new UserApiClient3(environmentConfig, walletClient, publicClient, getClientId());
|
|
978
1022
|
const data = await userApiClient.getApp(appID);
|
|
979
1023
|
const releases = sortReleasesOldestFirst(data.releases);
|
|
980
1024
|
if (releases.length === 0) {
|