@layr-labs/ecloud-cli 0.2.0 → 0.2.2-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.
Files changed (48) hide show
  1. package/VERSION +2 -2
  2. package/dist/commands/auth/whoami.js +16 -3
  3. package/dist/commands/auth/whoami.js.map +1 -1
  4. package/dist/commands/billing/cancel.js +44 -5
  5. package/dist/commands/billing/cancel.js.map +1 -1
  6. package/dist/commands/billing/status.js +44 -5
  7. package/dist/commands/billing/status.js.map +1 -1
  8. package/dist/commands/billing/subscribe.js +44 -5
  9. package/dist/commands/billing/subscribe.js.map +1 -1
  10. package/dist/commands/compute/app/create.js +16 -3
  11. package/dist/commands/compute/app/create.js.map +1 -1
  12. package/dist/commands/compute/app/deploy.js +120 -25
  13. package/dist/commands/compute/app/deploy.js.map +1 -1
  14. package/dist/commands/compute/app/info.js +124 -35
  15. package/dist/commands/compute/app/info.js.map +1 -1
  16. package/dist/commands/compute/app/list.js +78 -17
  17. package/dist/commands/compute/app/list.js.map +1 -1
  18. package/dist/commands/compute/app/logs.js +69 -28
  19. package/dist/commands/compute/app/logs.js.map +1 -1
  20. package/dist/commands/compute/app/profile/set.js +109 -40
  21. package/dist/commands/compute/app/profile/set.js.map +1 -1
  22. package/dist/commands/compute/app/releases.js +82 -120
  23. package/dist/commands/compute/app/releases.js.map +1 -1
  24. package/dist/commands/compute/app/start.js +77 -35
  25. package/dist/commands/compute/app/start.js.map +1 -1
  26. package/dist/commands/compute/app/stop.js +77 -35
  27. package/dist/commands/compute/app/stop.js.map +1 -1
  28. package/dist/commands/compute/app/terminate.js +77 -35
  29. package/dist/commands/compute/app/terminate.js.map +1 -1
  30. package/dist/commands/compute/app/upgrade.js +117 -39
  31. package/dist/commands/compute/app/upgrade.js.map +1 -1
  32. package/dist/commands/compute/build/info.js +56 -16
  33. package/dist/commands/compute/build/info.js.map +1 -1
  34. package/dist/commands/compute/build/list.js +72 -67
  35. package/dist/commands/compute/build/list.js.map +1 -1
  36. package/dist/commands/compute/build/logs.js +55 -13
  37. package/dist/commands/compute/build/logs.js.map +1 -1
  38. package/dist/commands/compute/build/status.js +55 -13
  39. package/dist/commands/compute/build/status.js.map +1 -1
  40. package/dist/commands/compute/build/submit.js +68 -9
  41. package/dist/commands/compute/build/submit.js.map +1 -1
  42. package/dist/commands/compute/build/verify.js +55 -13
  43. package/dist/commands/compute/build/verify.js.map +1 -1
  44. package/dist/commands/compute/environment/set.js +20 -7
  45. package/dist/commands/compute/environment/set.js.map +1 -1
  46. package/dist/commands/compute/undelegate.js +46 -10
  47. package/dist/commands/compute/undelegate.js.map +1 -1
  48. package/package.json +2 -2
@@ -2,14 +2,14 @@
2
2
 
3
3
  // src/commands/compute/app/logs.ts
4
4
  import { Command, Args, Flags as Flags2 } from "@oclif/core";
5
- import { getEnvironmentConfig as getEnvironmentConfig3 } from "@layr-labs/ecloud-sdk";
5
+ import { getEnvironmentConfig as getEnvironmentConfig4 } from "@layr-labs/ecloud-sdk";
6
6
 
7
7
  // src/client.ts
8
8
  import {
9
9
  createComputeModule,
10
10
  createBillingModule,
11
11
  createBuildModule,
12
- getEnvironmentConfig as getEnvironmentConfig2,
12
+ getEnvironmentConfig as getEnvironmentConfig3,
13
13
  requirePrivateKey,
14
14
  getPrivateKeyWithSource
15
15
  } from "@layr-labs/ecloud-sdk";
@@ -24,9 +24,9 @@ import fs3 from "fs";
24
24
  import path3 from "path";
25
25
  import os3 from "os";
26
26
  import { isAddress as isAddress2 } from "viem";
27
- import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
27
+ import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
28
28
  import {
29
- getEnvironmentConfig,
29
+ getEnvironmentConfig as getEnvironmentConfig2,
30
30
  getAvailableEnvironments,
31
31
  isEnvironmentAvailable,
32
32
  getAllAppsByDeveloper as getAllAppsByDeveloper2,
@@ -43,12 +43,43 @@ import {
43
43
 
44
44
  // src/utils/appResolver.ts
45
45
  import { isAddress } from "viem";
46
- import { privateKeyToAccount } from "viem/accounts";
46
+ import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
47
47
  import {
48
48
  UserApiClient,
49
49
  getAllAppsByDeveloper
50
50
  } from "@layr-labs/ecloud-sdk";
51
51
 
52
+ // src/utils/viemClients.ts
53
+ import {
54
+ createPublicClient,
55
+ http
56
+ } from "viem";
57
+ import { privateKeyToAccount } from "viem/accounts";
58
+ import {
59
+ getEnvironmentConfig,
60
+ addHexPrefix,
61
+ createViemClients as sdkCreateViemClients,
62
+ getChainFromID
63
+ } from "@layr-labs/ecloud-sdk";
64
+ function createViemClients(options) {
65
+ const privateKey = addHexPrefix(options.privateKey);
66
+ const environmentConfig = getEnvironmentConfig(options.environment);
67
+ const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
68
+ const chain = getChainFromID(environmentConfig.chainID);
69
+ const { publicClient, walletClient } = sdkCreateViemClients({
70
+ privateKey,
71
+ rpcUrl,
72
+ chainId: environmentConfig.chainID
73
+ });
74
+ const account = privateKeyToAccount(privateKey);
75
+ return {
76
+ publicClient,
77
+ walletClient,
78
+ chain,
79
+ address: account.address
80
+ };
81
+ }
82
+
52
83
  // src/utils/globalConfig.ts
53
84
  import * as fs from "fs";
54
85
  import * as path from "path";
@@ -215,7 +246,7 @@ function listApps(environment) {
215
246
 
216
247
  // src/utils/version.ts
217
248
  function getCliVersion() {
218
- return true ? "0.2.0" : "0.0.0";
249
+ return true ? "0.2.2-dev" : "0.0.0";
219
250
  }
220
251
  function getClientId() {
221
252
  return `ecloud-cli/v${getCliVersion()}`;
@@ -238,7 +269,7 @@ async function getAppInfosChunked(userApiClient, appIds, addressCount) {
238
269
  }
239
270
 
240
271
  // src/utils/prompts.ts
241
- function addHexPrefix(value) {
272
+ function addHexPrefix2(value) {
242
273
  if (value.startsWith("0x")) {
243
274
  return value;
244
275
  }
@@ -302,7 +333,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
302
333
  };
303
334
  }
304
335
  if (options.appID) {
305
- const normalized = typeof options.appID === "string" ? addHexPrefix(options.appID) : options.appID;
336
+ const normalized = typeof options.appID === "string" ? addHexPrefix2(options.appID) : options.appID;
306
337
  if (isAddress2(normalized)) {
307
338
  return normalized;
308
339
  }
@@ -318,7 +349,7 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
318
349
  const apps = listApps(options.environment);
319
350
  const foundAppID = apps[options.appID];
320
351
  if (foundAppID) {
321
- return addHexPrefix(foundAppID);
352
+ return addHexPrefix2(foundAppID);
322
353
  }
323
354
  throw new Error(
324
355
  `App name '${options.appID}' not found in environment '${options.environment}'`
@@ -329,18 +360,23 @@ async function getOrPromptAppID(appIDOrOptions, environment) {
329
360
  async function getAppIDInteractive(options) {
330
361
  const action = options.action || "view";
331
362
  const environment = options.environment || "sepolia";
332
- const environmentConfig = getEnvironmentConfig(environment);
363
+ const environmentConfig = getEnvironmentConfig2(environment);
333
364
  if (!options.privateKey || !options.rpcUrl) {
334
365
  return getAppIDInteractiveFromRegistry(environment, action);
335
366
  }
336
367
  console.log(`
337
368
  Select an app to ${action}:
338
369
  `);
339
- const privateKeyHex = addHexPrefix(options.privateKey);
340
- const account = privateKeyToAccount2(privateKeyHex);
370
+ const privateKeyHex = addHexPrefix2(options.privateKey);
371
+ const account = privateKeyToAccount3(privateKeyHex);
341
372
  const developerAddr = account.address;
373
+ const { publicClient, walletClient } = createViemClients({
374
+ privateKey: options.privateKey,
375
+ rpcUrl: options.rpcUrl,
376
+ environment
377
+ });
342
378
  const { apps, appConfigs } = await getAllAppsByDeveloper2(
343
- options.rpcUrl,
379
+ publicClient,
344
380
  environmentConfig,
345
381
  developerAddr
346
382
  );
@@ -353,9 +389,9 @@ Select an app to ${action}:
353
389
  try {
354
390
  const userApiClient = new UserApiClient2(
355
391
  environmentConfig,
356
- options.privateKey,
357
- options.rpcUrl,
358
- getClientId()
392
+ walletClient,
393
+ publicClient,
394
+ { clientId: getClientId() }
359
395
  );
360
396
  const appInfos = await getAppInfosChunked(userApiClient, apps);
361
397
  const freshProfiles = {};
@@ -479,14 +515,14 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
479
515
  if (!value) {
480
516
  return "App ID or name cannot be empty";
481
517
  }
482
- const normalized2 = addHexPrefix(value);
518
+ const normalized2 = addHexPrefix2(value);
483
519
  if (isAddress2(normalized2)) {
484
520
  return true;
485
521
  }
486
522
  return "Invalid app ID address";
487
523
  }
488
524
  });
489
- const normalized = addHexPrefix(appIDInput);
525
+ const normalized = addHexPrefix2(appIDInput);
490
526
  if (isAddress2(normalized)) {
491
527
  return normalized;
492
528
  }
@@ -522,7 +558,7 @@ Select an app to ${action}:`);
522
558
  if (!value) {
523
559
  return "App ID or name cannot be empty";
524
560
  }
525
- const normalized2 = addHexPrefix(value);
561
+ const normalized2 = addHexPrefix2(value);
526
562
  if (isAddress2(normalized2)) {
527
563
  return true;
528
564
  }
@@ -532,17 +568,17 @@ Select an app to ${action}:`);
532
568
  return "Invalid app ID or name not found";
533
569
  }
534
570
  });
535
- const normalized = addHexPrefix(appIDInput);
571
+ const normalized = addHexPrefix2(appIDInput);
536
572
  if (isAddress2(normalized)) {
537
573
  return normalized;
538
574
  }
539
575
  const foundAppID = allApps[appIDInput];
540
576
  if (foundAppID) {
541
- return addHexPrefix(foundAppID);
577
+ return addHexPrefix2(foundAppID);
542
578
  }
543
579
  throw new Error(`Failed to resolve app ID from input: ${appIDInput}`);
544
580
  }
545
- return addHexPrefix(selected);
581
+ return addHexPrefix2(selected);
546
582
  }
547
583
  async function getPrivateKeyInteractive(privateKey) {
548
584
  if (privateKey) {
@@ -574,7 +610,7 @@ async function getPrivateKeyInteractive(privateKey) {
574
610
  async function getEnvironmentInteractive(environment) {
575
611
  if (environment) {
576
612
  try {
577
- getEnvironmentConfig(environment);
613
+ getEnvironmentConfig2(environment);
578
614
  if (!isEnvironmentAvailable(environment)) {
579
615
  throw new Error(`Environment ${environment} is not available in this build`);
580
616
  }
@@ -587,7 +623,7 @@ async function getEnvironmentInteractive(environment) {
587
623
  const configDefaultEnv = getDefaultEnvironment();
588
624
  if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
589
625
  try {
590
- getEnvironmentConfig(configDefaultEnv);
626
+ getEnvironmentConfig2(configDefaultEnv);
591
627
  defaultEnv = configDefaultEnv;
592
628
  } catch {
593
629
  }
@@ -653,7 +689,7 @@ async function validateCommonFlags(flags, options) {
653
689
  async function createComputeClient(flags) {
654
690
  flags = await validateCommonFlags(flags);
655
691
  const environment = flags.environment;
656
- const environmentConfig = getEnvironmentConfig2(environment);
692
+ const environmentConfig = getEnvironmentConfig3(environment);
657
693
  const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
658
694
  const { key: privateKey, source } = await requirePrivateKey({
659
695
  privateKey: flags["private-key"]
@@ -661,10 +697,15 @@ async function createComputeClient(flags) {
661
697
  if (flags.verbose) {
662
698
  console.log(`Using private key from: ${source}`);
663
699
  }
664
- return createComputeModule({
665
- verbose: flags.verbose,
700
+ const { walletClient, publicClient } = createViemClients({
666
701
  privateKey,
667
702
  rpcUrl,
703
+ environment
704
+ });
705
+ return createComputeModule({
706
+ verbose: flags.verbose,
707
+ walletClient,
708
+ publicClient,
668
709
  environment,
669
710
  clientId: getClientId(),
670
711
  skipTelemetry: true
@@ -752,7 +793,7 @@ var AppLogs = class _AppLogs extends Command {
752
793
  const { args, flags } = await this.parse(_AppLogs);
753
794
  const compute = await createComputeClient(flags);
754
795
  const environment = flags.environment;
755
- const environmentConfig = getEnvironmentConfig3(environment);
796
+ const environmentConfig = getEnvironmentConfig4(environment);
756
797
  const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
757
798
  const appID = await getOrPromptAppID({
758
799
  appID: args["app-id"],