@layr-labs/ecloud-cli 0.2.0-dev.1 → 0.2.0-dev.2
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/generate.js +2 -2
- package/dist/commands/auth/generate.js.map +1 -1
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/logout.js.map +1 -1
- package/dist/commands/auth/migrate.js.map +1 -1
- package/dist/commands/auth/whoami.js +3 -5
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/cancel.js +3 -6
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/status.js +3 -6
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +7 -12
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +86 -614
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +10 -59
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +9 -10
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +11 -61
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +20 -145
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/start.js +11 -61
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/stop.js +11 -61
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +11 -61
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +52 -615
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/environment/list.js.map +1 -1
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/environment/show.js.map +1 -1
- package/dist/commands/compute/undelegate.js +9 -11
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/version.js.map +1 -1
- package/package.json +2 -7
- package/dist/commands/compute/app/releases.js +0 -1111
- package/dist/commands/compute/app/releases.js.map +0 -1
- package/dist/commands/compute/build/info.js +0 -500
- package/dist/commands/compute/build/info.js.map +0 -1
- package/dist/commands/compute/build/list.js +0 -494
- package/dist/commands/compute/build/list.js.map +0 -1
- package/dist/commands/compute/build/logs.js +0 -459
- package/dist/commands/compute/build/logs.js.map +0 -1
- package/dist/commands/compute/build/status.js +0 -481
- package/dist/commands/compute/build/status.js.map +0 -1
- package/dist/commands/compute/build/submit.js +0 -618
- package/dist/commands/compute/build/submit.js.map +0 -1
- package/dist/commands/compute/build/verify.js +0 -439
- package/dist/commands/compute/build/verify.js.map +0 -1
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// src/commands/compute/app/profile/set.ts
|
|
4
4
|
import { Command, Args, Flags as Flags2 } from "@oclif/core";
|
|
5
|
-
import { getEnvironmentConfig as
|
|
5
|
+
import { getEnvironmentConfig as getEnvironmentConfig2, UserApiClient as UserApiClient3 } from "@layr-labs/ecloud-sdk";
|
|
6
6
|
|
|
7
7
|
// src/flags.ts
|
|
8
8
|
import { Flags } from "@oclif/core";
|
|
9
|
-
import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
|
|
10
9
|
|
|
11
10
|
// src/utils/prompts.ts
|
|
12
11
|
import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
|
|
@@ -88,27 +87,6 @@ function saveGlobalConfig(config) {
|
|
|
88
87
|
const content = dumpYaml(config, { lineWidth: -1 });
|
|
89
88
|
fs.writeFileSync(configPath, content, { mode: 420 });
|
|
90
89
|
}
|
|
91
|
-
function normalizeDirectoryPath(directoryPath) {
|
|
92
|
-
const resolved = path.resolve(directoryPath);
|
|
93
|
-
try {
|
|
94
|
-
return fs.realpathSync(resolved);
|
|
95
|
-
} catch {
|
|
96
|
-
return resolved;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function getLinkedAppForDirectory(environment, directoryPath) {
|
|
100
|
-
if (!directoryPath) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const config = loadGlobalConfig();
|
|
104
|
-
const links = config.directory_links?.[environment];
|
|
105
|
-
if (!links) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const normalizedPath = normalizeDirectoryPath(directoryPath);
|
|
109
|
-
const appId = links[normalizedPath];
|
|
110
|
-
return appId || null;
|
|
111
|
-
}
|
|
112
90
|
function getDefaultEnvironment() {
|
|
113
91
|
const config = loadGlobalConfig();
|
|
114
92
|
return config.default_environment;
|
|
@@ -254,7 +232,7 @@ function listApps(environment) {
|
|
|
254
232
|
|
|
255
233
|
// src/utils/version.ts
|
|
256
234
|
function getCliVersion() {
|
|
257
|
-
return true ? "0.2.0-dev.
|
|
235
|
+
return true ? "0.2.0-dev.2" : "0.0.0";
|
|
258
236
|
}
|
|
259
237
|
function getClientId() {
|
|
260
238
|
return `ecloud-cli/v${getCliVersion()}`;
|
|
@@ -445,9 +423,6 @@ function addHexPrefix(value) {
|
|
|
445
423
|
}
|
|
446
424
|
return `0x${value}`;
|
|
447
425
|
}
|
|
448
|
-
function getCurrentProjectPath() {
|
|
449
|
-
return process.env.INIT_CWD || process.cwd();
|
|
450
|
-
}
|
|
451
426
|
var ContractAppStatusStarted = 1;
|
|
452
427
|
var ContractAppStatusStopped = 2;
|
|
453
428
|
var ContractAppStatusTerminated = 3;
|
|
@@ -586,7 +561,6 @@ Select an app to ${action}:
|
|
|
586
561
|
switch (action) {
|
|
587
562
|
case "view":
|
|
588
563
|
case "view info for":
|
|
589
|
-
case "view releases for":
|
|
590
564
|
case "set profile for":
|
|
591
565
|
return true;
|
|
592
566
|
case "start":
|
|
@@ -615,19 +589,7 @@ Select an app to ${action}:
|
|
|
615
589
|
index: i
|
|
616
590
|
});
|
|
617
591
|
}
|
|
618
|
-
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
619
|
-
const normalizedLinkedAppId = linkedAppId ? linkedAppId.toLowerCase() : "";
|
|
620
592
|
appItems.sort((a, b) => {
|
|
621
|
-
if (normalizedLinkedAppId) {
|
|
622
|
-
const aLinked = String(a.addr).toLowerCase() === normalizedLinkedAppId;
|
|
623
|
-
const bLinked = String(b.addr).toLowerCase() === normalizedLinkedAppId;
|
|
624
|
-
if (aLinked && !bLinked) {
|
|
625
|
-
return -1;
|
|
626
|
-
}
|
|
627
|
-
if (bLinked && !aLinked) {
|
|
628
|
-
return 1;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
593
|
const aPriority = getStatusPriority(a.status, false);
|
|
632
594
|
const bPriority = getStatusPriority(b.status, false);
|
|
633
595
|
if (aPriority !== bPriority) {
|
|
@@ -693,18 +655,7 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
|
|
|
693
655
|
}
|
|
694
656
|
throw new Error(`Invalid app ID address: ${appIDInput}`);
|
|
695
657
|
}
|
|
696
|
-
const
|
|
697
|
-
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
698
|
-
if (linkedAppId) {
|
|
699
|
-
const linkedIndex = entries.findIndex(
|
|
700
|
-
([, appId]) => String(appId).toLowerCase() === linkedAppId.toLowerCase()
|
|
701
|
-
);
|
|
702
|
-
if (linkedIndex > 0) {
|
|
703
|
-
const [linkedEntry] = entries.splice(linkedIndex, 1);
|
|
704
|
-
entries.unshift(linkedEntry);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
const choices = entries.map(([name, appID]) => {
|
|
658
|
+
const choices = Object.entries(allApps).map(([name, appID]) => {
|
|
708
659
|
const displayName = `${name} (${appID})`;
|
|
709
660
|
return { name: displayName, value: appID };
|
|
710
661
|
});
|
|
@@ -752,8 +703,8 @@ async function getPrivateKeyInteractive(privateKey) {
|
|
|
752
703
|
}
|
|
753
704
|
return privateKey;
|
|
754
705
|
}
|
|
755
|
-
const { getPrivateKeyWithSource
|
|
756
|
-
const result = await
|
|
706
|
+
const { getPrivateKeyWithSource } = await import("@layr-labs/ecloud-sdk");
|
|
707
|
+
const result = await getPrivateKeyWithSource({ privateKey: void 0 });
|
|
757
708
|
if (result) {
|
|
758
709
|
return result.key;
|
|
759
710
|
}
|
|
@@ -772,50 +723,6 @@ async function getPrivateKeyInteractive(privateKey) {
|
|
|
772
723
|
});
|
|
773
724
|
return key.trim();
|
|
774
725
|
}
|
|
775
|
-
async function getEnvironmentInteractive(environment) {
|
|
776
|
-
if (environment) {
|
|
777
|
-
try {
|
|
778
|
-
getEnvironmentConfig(environment);
|
|
779
|
-
if (!isEnvironmentAvailable(environment)) {
|
|
780
|
-
throw new Error(`Environment ${environment} is not available in this build`);
|
|
781
|
-
}
|
|
782
|
-
return environment;
|
|
783
|
-
} catch {
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
const availableEnvs = getAvailableEnvironments();
|
|
787
|
-
let defaultEnv;
|
|
788
|
-
const configDefaultEnv = getDefaultEnvironment();
|
|
789
|
-
if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
|
|
790
|
-
try {
|
|
791
|
-
getEnvironmentConfig(configDefaultEnv);
|
|
792
|
-
defaultEnv = configDefaultEnv;
|
|
793
|
-
} catch {
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
const choices = [];
|
|
797
|
-
if (availableEnvs.includes("sepolia")) {
|
|
798
|
-
choices.push({ name: "sepolia - Ethereum Sepolia testnet", value: "sepolia" });
|
|
799
|
-
}
|
|
800
|
-
if (availableEnvs.includes("sepolia-dev")) {
|
|
801
|
-
choices.push({ name: "sepolia-dev - Ethereum Sepolia testnet (dev)", value: "sepolia-dev" });
|
|
802
|
-
}
|
|
803
|
-
if (availableEnvs.includes("mainnet-alpha")) {
|
|
804
|
-
choices.push({
|
|
805
|
-
name: "mainnet-alpha - Ethereum mainnet (\u26A0\uFE0F uses real funds)",
|
|
806
|
-
value: "mainnet-alpha"
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
|
-
if (choices.length === 0) {
|
|
810
|
-
throw new Error("No environments available in this build");
|
|
811
|
-
}
|
|
812
|
-
const env = await select({
|
|
813
|
-
message: "Select environment:",
|
|
814
|
-
choices,
|
|
815
|
-
default: defaultEnv
|
|
816
|
-
});
|
|
817
|
-
return env;
|
|
818
|
-
}
|
|
819
726
|
var MAX_DESCRIPTION_LENGTH = 1e3;
|
|
820
727
|
var MAX_IMAGE_SIZE = 4 * 1024 * 1024;
|
|
821
728
|
var VALID_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png"];
|
|
@@ -1078,8 +985,7 @@ var commonFlags = {
|
|
|
1078
985
|
environment: Flags.string({
|
|
1079
986
|
required: false,
|
|
1080
987
|
description: "Deployment environment to use",
|
|
1081
|
-
env: "ECLOUD_ENV"
|
|
1082
|
-
default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "sepolia")
|
|
988
|
+
env: "ECLOUD_ENV"
|
|
1083
989
|
}),
|
|
1084
990
|
"private-key": Flags.string({
|
|
1085
991
|
required: false,
|
|
@@ -1097,44 +1003,6 @@ var commonFlags = {
|
|
|
1097
1003
|
default: false
|
|
1098
1004
|
})
|
|
1099
1005
|
};
|
|
1100
|
-
async function validateCommonFlags(flags, options) {
|
|
1101
|
-
flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
|
|
1102
|
-
if (options?.requirePrivateKey !== false) {
|
|
1103
|
-
flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
|
|
1104
|
-
}
|
|
1105
|
-
return flags;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
// src/client.ts
|
|
1109
|
-
import {
|
|
1110
|
-
createComputeModule,
|
|
1111
|
-
createBillingModule,
|
|
1112
|
-
createBuildModule,
|
|
1113
|
-
getEnvironmentConfig as getEnvironmentConfig2,
|
|
1114
|
-
requirePrivateKey,
|
|
1115
|
-
getPrivateKeyWithSource
|
|
1116
|
-
} from "@layr-labs/ecloud-sdk";
|
|
1117
|
-
async function createComputeClient(flags) {
|
|
1118
|
-
flags = await validateCommonFlags(flags);
|
|
1119
|
-
const environment = flags.environment;
|
|
1120
|
-
const environmentConfig = getEnvironmentConfig2(environment);
|
|
1121
|
-
const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
1122
|
-
const { key: privateKey, source } = await requirePrivateKey({
|
|
1123
|
-
privateKey: flags["private-key"]
|
|
1124
|
-
});
|
|
1125
|
-
if (flags.verbose) {
|
|
1126
|
-
console.log(`Using private key from: ${source}`);
|
|
1127
|
-
}
|
|
1128
|
-
return createComputeModule({
|
|
1129
|
-
verbose: flags.verbose,
|
|
1130
|
-
privateKey,
|
|
1131
|
-
rpcUrl,
|
|
1132
|
-
environment,
|
|
1133
|
-
clientId: getClientId(),
|
|
1134
|
-
skipTelemetry: true
|
|
1135
|
-
// CLI already has telemetry, skip SDK telemetry
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
1006
|
|
|
1139
1007
|
// src/commands/compute/app/profile/set.ts
|
|
1140
1008
|
import chalk from "chalk";
|
|
@@ -1147,7 +1015,7 @@ import {
|
|
|
1147
1015
|
addMetric,
|
|
1148
1016
|
addMetricWithDimensions,
|
|
1149
1017
|
emitMetrics,
|
|
1150
|
-
getBuildType as
|
|
1018
|
+
getBuildType as getBuildType2
|
|
1151
1019
|
} from "@layr-labs/ecloud-sdk";
|
|
1152
1020
|
function createCLITelemetryClient() {
|
|
1153
1021
|
const userUUID = getOrCreateUserUUID();
|
|
@@ -1165,7 +1033,7 @@ async function withTelemetry(command, action) {
|
|
|
1165
1033
|
metrics.properties["command"] = command.id || command.constructor.name;
|
|
1166
1034
|
const environment = getDefaultEnvironment() || "sepolia";
|
|
1167
1035
|
metrics.properties["environment"] = environment;
|
|
1168
|
-
const buildType =
|
|
1036
|
+
const buildType = getBuildType2() || "prod";
|
|
1169
1037
|
metrics.properties["build_type"] = buildType;
|
|
1170
1038
|
const cliVersion = command.config.version;
|
|
1171
1039
|
if (cliVersion) {
|
|
@@ -1232,11 +1100,10 @@ var ProfileSet = class _ProfileSet extends Command {
|
|
|
1232
1100
|
async run() {
|
|
1233
1101
|
return withTelemetry(this, async () => {
|
|
1234
1102
|
const { args, flags } = await this.parse(_ProfileSet);
|
|
1235
|
-
const
|
|
1236
|
-
const
|
|
1237
|
-
const environmentConfig = getEnvironmentConfig3(environment);
|
|
1103
|
+
const environment = flags.environment || "sepolia";
|
|
1104
|
+
const environmentConfig = getEnvironmentConfig2(environment);
|
|
1238
1105
|
const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
1239
|
-
const privateKey = flags["private-key"];
|
|
1106
|
+
const privateKey = await getPrivateKeyInteractive(flags["private-key"]);
|
|
1240
1107
|
const resolver = createAppResolver(environment, environmentConfig, privateKey, rpcUrl);
|
|
1241
1108
|
const appId = await getOrPromptAppID({
|
|
1242
1109
|
appID: args["app-id"],
|
|
@@ -1276,8 +1143,16 @@ ${chalk.gray("Profile setup cancelled")}`);
|
|
|
1276
1143
|
}
|
|
1277
1144
|
}
|
|
1278
1145
|
this.log("\nUploading app profile...");
|
|
1146
|
+
const userApiClient = new UserApiClient3(environmentConfig, privateKey, rpcUrl);
|
|
1279
1147
|
try {
|
|
1280
|
-
const response = await
|
|
1148
|
+
const response = await userApiClient.uploadAppProfile(
|
|
1149
|
+
appId,
|
|
1150
|
+
profile.name,
|
|
1151
|
+
profile.website,
|
|
1152
|
+
profile.description,
|
|
1153
|
+
profile.xURL,
|
|
1154
|
+
profile.imagePath
|
|
1155
|
+
);
|
|
1281
1156
|
resolver.updateCacheEntry(appId, response.name);
|
|
1282
1157
|
invalidateProfileCache(environment);
|
|
1283
1158
|
this.log(`
|