@layr-labs/ecloud-sdk 0.2.0-dev → 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/billing.cjs +19 -0
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +2 -1
- package/dist/billing.d.ts +2 -1
- package/dist/billing.js +2 -2
- package/dist/chunk-2RORGPLX.js +434 -0
- package/dist/chunk-2RORGPLX.js.map +1 -0
- package/dist/{chunk-HLH3AMQF.js → chunk-4SKRNFKQ.js} +2 -227
- package/dist/chunk-4SKRNFKQ.js.map +1 -0
- package/dist/{chunk-34DXGQ35.js → chunk-ZEZS5CNB.js} +30 -106
- package/dist/chunk-ZEZS5CNB.js.map +1 -0
- package/dist/compute.cjs +1 -79
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.js +2 -2
- package/dist/index.cjs +101 -782
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -303
- package/dist/index.d.ts +86 -303
- package/dist/index.js +17 -616
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-34DXGQ35.js.map +0 -1
- package/dist/chunk-HLH3AMQF.js.map +0 -1
- package/dist/chunk-LINGJMAS.js +0 -180
- package/dist/chunk-LINGJMAS.js.map +0 -1
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
getLogger,
|
|
18
18
|
stripHexPrefix,
|
|
19
19
|
withSDKTelemetry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZEZS5CNB.js";
|
|
21
21
|
|
|
22
22
|
// src/client/common/contract/eip7702.ts
|
|
23
23
|
import {
|
|
@@ -4634,64 +4634,6 @@ Please verify the image exists: docker manifest inspect ${finalImageRef}`
|
|
|
4634
4634
|
};
|
|
4635
4635
|
}
|
|
4636
4636
|
|
|
4637
|
-
// src/client/common/release/prebuilt.ts
|
|
4638
|
-
async function createReleaseFromImageDigest(options, logger) {
|
|
4639
|
-
const { imageRef, imageDigest, envFilePath, instanceType, environmentConfig, appId } = options;
|
|
4640
|
-
if (!/^sha256:[0-9a-f]{64}$/i.test(imageDigest)) {
|
|
4641
|
-
throw new Error(`imageDigest must be in format sha256:<64 hex>, got: ${imageDigest}`);
|
|
4642
|
-
}
|
|
4643
|
-
let publicEnv = {};
|
|
4644
|
-
let privateEnv = {};
|
|
4645
|
-
if (envFilePath) {
|
|
4646
|
-
logger.info("Parsing environment file...");
|
|
4647
|
-
const parsed = parseAndValidateEnvFile(envFilePath);
|
|
4648
|
-
publicEnv = parsed.public;
|
|
4649
|
-
privateEnv = parsed.private;
|
|
4650
|
-
} else {
|
|
4651
|
-
logger.info("Continuing without environment file");
|
|
4652
|
-
}
|
|
4653
|
-
publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
|
|
4654
|
-
logger.info(`Instance type: ${instanceType}`);
|
|
4655
|
-
logger.info("Encrypting environment variables...");
|
|
4656
|
-
const { encryptionKey } = getKMSKeysForEnvironment(environmentConfig.name, environmentConfig.build);
|
|
4657
|
-
const protectedHeaders = getAppProtectedHeaders(appId);
|
|
4658
|
-
const privateEnvBytes = Buffer.from(JSON.stringify(privateEnv));
|
|
4659
|
-
const encryptedEnvStr = await encryptRSAOAEPAndAES256GCM(
|
|
4660
|
-
encryptionKey,
|
|
4661
|
-
privateEnvBytes,
|
|
4662
|
-
protectedHeaders
|
|
4663
|
-
);
|
|
4664
|
-
const digestHex = imageDigest.split(":")[1];
|
|
4665
|
-
const digestBytes = new Uint8Array(Buffer.from(digestHex, "hex"));
|
|
4666
|
-
if (digestBytes.length !== 32) {
|
|
4667
|
-
throw new Error(`Digest must be exactly 32 bytes, got ${digestBytes.length}`);
|
|
4668
|
-
}
|
|
4669
|
-
const registry = extractRegistryNameNoDocker(imageRef);
|
|
4670
|
-
return {
|
|
4671
|
-
rmsRelease: {
|
|
4672
|
-
artifacts: [{ digest: digestBytes, registry }],
|
|
4673
|
-
upgradeByTime: Math.floor(Date.now() / 1e3) + 3600
|
|
4674
|
-
},
|
|
4675
|
-
publicEnv: new Uint8Array(Buffer.from(JSON.stringify(publicEnv))),
|
|
4676
|
-
encryptedEnv: new Uint8Array(Buffer.from(encryptedEnvStr))
|
|
4677
|
-
};
|
|
4678
|
-
}
|
|
4679
|
-
function extractRegistryNameNoDocker(imageRef) {
|
|
4680
|
-
let name = imageRef;
|
|
4681
|
-
const tagIndex = name.lastIndexOf(":");
|
|
4682
|
-
if (tagIndex !== -1 && !name.substring(tagIndex + 1).includes("/")) {
|
|
4683
|
-
name = name.substring(0, tagIndex);
|
|
4684
|
-
}
|
|
4685
|
-
const digestIndex = name.indexOf("@");
|
|
4686
|
-
if (digestIndex !== -1) {
|
|
4687
|
-
name = name.substring(0, digestIndex);
|
|
4688
|
-
}
|
|
4689
|
-
if ([...name].filter((c) => c === "/").length === 1) {
|
|
4690
|
-
name = `docker.io/${name}`;
|
|
4691
|
-
}
|
|
4692
|
-
return name;
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
4637
|
// src/client/common/contract/watcher.ts
|
|
4696
4638
|
var WATCH_POLL_INTERVAL_SECONDS = 5;
|
|
4697
4639
|
var APP_STATUS_RUNNING = "Running";
|
|
@@ -4873,95 +4815,6 @@ function validatePrivateKey(key) {
|
|
|
4873
4815
|
}
|
|
4874
4816
|
|
|
4875
4817
|
// src/client/modules/compute/app/deploy.ts
|
|
4876
|
-
async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger) {
|
|
4877
|
-
return withSDKTelemetry(
|
|
4878
|
-
{
|
|
4879
|
-
functionName: "prepareDeployFromVerifiableBuild",
|
|
4880
|
-
skipTelemetry: options.skipTelemetry,
|
|
4881
|
-
properties: {
|
|
4882
|
-
environment: options.environment || "sepolia"
|
|
4883
|
-
}
|
|
4884
|
-
},
|
|
4885
|
-
async () => {
|
|
4886
|
-
if (!options.privateKey) throw new Error("privateKey is required for deployment");
|
|
4887
|
-
if (!options.imageRef) throw new Error("imageRef is required for deployment");
|
|
4888
|
-
if (!options.imageDigest) throw new Error("imageDigest is required for deployment");
|
|
4889
|
-
assertValidImageReference(options.imageRef);
|
|
4890
|
-
validateAppName(options.appName);
|
|
4891
|
-
validateLogVisibility(options.logVisibility);
|
|
4892
|
-
if (!/^sha256:[0-9a-f]{64}$/i.test(options.imageDigest)) {
|
|
4893
|
-
throw new Error(`imageDigest must be in format sha256:<64 hex>, got: ${options.imageDigest}`);
|
|
4894
|
-
}
|
|
4895
|
-
const { publicLogs } = validateLogVisibility(options.logVisibility);
|
|
4896
|
-
validateResourceUsageMonitoring(options.resourceUsageMonitoring);
|
|
4897
|
-
logger.debug("Performing preflight checks...");
|
|
4898
|
-
const preflightCtx = await doPreflightChecks(
|
|
4899
|
-
{
|
|
4900
|
-
privateKey: options.privateKey,
|
|
4901
|
-
rpcUrl: options.rpcUrl,
|
|
4902
|
-
environment: options.environment
|
|
4903
|
-
},
|
|
4904
|
-
logger
|
|
4905
|
-
);
|
|
4906
|
-
logger.debug("Checking quota availability...");
|
|
4907
|
-
await checkQuotaAvailable(preflightCtx);
|
|
4908
|
-
const salt = generateRandomSalt();
|
|
4909
|
-
logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
|
|
4910
|
-
logger.debug("Calculating app ID...");
|
|
4911
|
-
const appIDToBeDeployed = await calculateAppID(
|
|
4912
|
-
preflightCtx.privateKey,
|
|
4913
|
-
options.rpcUrl || preflightCtx.rpcUrl,
|
|
4914
|
-
preflightCtx.environmentConfig,
|
|
4915
|
-
salt
|
|
4916
|
-
);
|
|
4917
|
-
logger.info(``);
|
|
4918
|
-
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
4919
|
-
logger.info(``);
|
|
4920
|
-
const release = await createReleaseFromImageDigest(
|
|
4921
|
-
{
|
|
4922
|
-
imageRef: options.imageRef,
|
|
4923
|
-
imageDigest: options.imageDigest,
|
|
4924
|
-
envFilePath: options.envFilePath,
|
|
4925
|
-
instanceType: options.instanceType,
|
|
4926
|
-
environmentConfig: preflightCtx.environmentConfig,
|
|
4927
|
-
appId: appIDToBeDeployed
|
|
4928
|
-
},
|
|
4929
|
-
logger
|
|
4930
|
-
);
|
|
4931
|
-
logger.debug("Preparing deploy batch...");
|
|
4932
|
-
const batch = await prepareDeployBatch(
|
|
4933
|
-
{
|
|
4934
|
-
privateKey: preflightCtx.privateKey,
|
|
4935
|
-
rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
|
|
4936
|
-
environmentConfig: preflightCtx.environmentConfig,
|
|
4937
|
-
salt,
|
|
4938
|
-
release,
|
|
4939
|
-
publicLogs
|
|
4940
|
-
},
|
|
4941
|
-
logger
|
|
4942
|
-
);
|
|
4943
|
-
logger.debug("Estimating gas...");
|
|
4944
|
-
const gasEstimate = await estimateBatchGas({
|
|
4945
|
-
publicClient: batch.publicClient,
|
|
4946
|
-
environmentConfig: batch.environmentConfig,
|
|
4947
|
-
executions: batch.executions
|
|
4948
|
-
});
|
|
4949
|
-
return {
|
|
4950
|
-
prepared: {
|
|
4951
|
-
batch,
|
|
4952
|
-
appName: options.appName,
|
|
4953
|
-
imageRef: options.imageRef,
|
|
4954
|
-
preflightCtx: {
|
|
4955
|
-
privateKey: preflightCtx.privateKey,
|
|
4956
|
-
rpcUrl: preflightCtx.rpcUrl,
|
|
4957
|
-
environmentConfig: preflightCtx.environmentConfig
|
|
4958
|
-
}
|
|
4959
|
-
},
|
|
4960
|
-
gasEstimate
|
|
4961
|
-
};
|
|
4962
|
-
}
|
|
4963
|
-
);
|
|
4964
|
-
}
|
|
4965
4818
|
function validateDeployOptions(options) {
|
|
4966
4819
|
if (!options.privateKey) {
|
|
4967
4820
|
throw new Error("privateKey is required for deployment");
|
|
@@ -5271,82 +5124,6 @@ async function checkAppLogPermission(preflightCtx, appAddress, logger) {
|
|
|
5271
5124
|
}
|
|
5272
5125
|
|
|
5273
5126
|
// src/client/modules/compute/app/upgrade.ts
|
|
5274
|
-
async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger) {
|
|
5275
|
-
return withSDKTelemetry(
|
|
5276
|
-
{
|
|
5277
|
-
functionName: "prepareUpgradeFromVerifiableBuild",
|
|
5278
|
-
skipTelemetry: options.skipTelemetry,
|
|
5279
|
-
properties: {
|
|
5280
|
-
environment: options.environment || "sepolia"
|
|
5281
|
-
}
|
|
5282
|
-
},
|
|
5283
|
-
async () => {
|
|
5284
|
-
logger.debug("Performing preflight checks...");
|
|
5285
|
-
const preflightCtx = await doPreflightChecks(
|
|
5286
|
-
{
|
|
5287
|
-
privateKey: options.privateKey,
|
|
5288
|
-
rpcUrl: options.rpcUrl,
|
|
5289
|
-
environment: options.environment
|
|
5290
|
-
},
|
|
5291
|
-
logger
|
|
5292
|
-
);
|
|
5293
|
-
const appID = validateUpgradeOptions(options);
|
|
5294
|
-
assertValidImageReference(options.imageRef);
|
|
5295
|
-
if (!/^sha256:[0-9a-f]{64}$/i.test(options.imageDigest)) {
|
|
5296
|
-
throw new Error(
|
|
5297
|
-
`imageDigest must be in format sha256:<64 hex>, got: ${options.imageDigest}`
|
|
5298
|
-
);
|
|
5299
|
-
}
|
|
5300
|
-
const { publicLogs } = validateLogVisibility(options.logVisibility);
|
|
5301
|
-
validateResourceUsageMonitoring(options.resourceUsageMonitoring);
|
|
5302
|
-
const envFilePath = options.envFilePath || "";
|
|
5303
|
-
logger.info("Preparing release (verifiable build, no local layering)...");
|
|
5304
|
-
const release = await createReleaseFromImageDigest(
|
|
5305
|
-
{
|
|
5306
|
-
imageRef: options.imageRef,
|
|
5307
|
-
imageDigest: options.imageDigest,
|
|
5308
|
-
envFilePath,
|
|
5309
|
-
instanceType: options.instanceType,
|
|
5310
|
-
environmentConfig: preflightCtx.environmentConfig,
|
|
5311
|
-
appId: appID
|
|
5312
|
-
},
|
|
5313
|
-
logger
|
|
5314
|
-
);
|
|
5315
|
-
logger.debug("Checking current log permission state...");
|
|
5316
|
-
const currentlyPublic = await checkAppLogPermission(preflightCtx, appID, logger);
|
|
5317
|
-
const needsPermissionChange = currentlyPublic !== publicLogs;
|
|
5318
|
-
logger.debug("Preparing upgrade batch...");
|
|
5319
|
-
const batch = await prepareUpgradeBatch({
|
|
5320
|
-
privateKey: preflightCtx.privateKey,
|
|
5321
|
-
rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
|
|
5322
|
-
environmentConfig: preflightCtx.environmentConfig,
|
|
5323
|
-
appId: appID,
|
|
5324
|
-
release,
|
|
5325
|
-
publicLogs,
|
|
5326
|
-
needsPermissionChange
|
|
5327
|
-
});
|
|
5328
|
-
logger.debug("Estimating gas...");
|
|
5329
|
-
const gasEstimate = await estimateBatchGas({
|
|
5330
|
-
publicClient: batch.publicClient,
|
|
5331
|
-
environmentConfig: batch.environmentConfig,
|
|
5332
|
-
executions: batch.executions
|
|
5333
|
-
});
|
|
5334
|
-
return {
|
|
5335
|
-
prepared: {
|
|
5336
|
-
batch,
|
|
5337
|
-
appId: appID,
|
|
5338
|
-
imageRef: options.imageRef,
|
|
5339
|
-
preflightCtx: {
|
|
5340
|
-
privateKey: preflightCtx.privateKey,
|
|
5341
|
-
rpcUrl: preflightCtx.rpcUrl,
|
|
5342
|
-
environmentConfig: preflightCtx.environmentConfig
|
|
5343
|
-
}
|
|
5344
|
-
},
|
|
5345
|
-
gasEstimate
|
|
5346
|
-
};
|
|
5347
|
-
}
|
|
5348
|
-
);
|
|
5349
|
-
}
|
|
5350
5127
|
function validateUpgradeOptions(options) {
|
|
5351
5128
|
if (!options.privateKey) {
|
|
5352
5129
|
throw new Error("privateKey is required for upgrade");
|
|
@@ -6490,11 +6267,9 @@ export {
|
|
|
6490
6267
|
validateUpgradeParams,
|
|
6491
6268
|
validateCreateAppParams,
|
|
6492
6269
|
validateLogsParams,
|
|
6493
|
-
prepareDeployFromVerifiableBuild,
|
|
6494
6270
|
prepareDeploy,
|
|
6495
6271
|
executeDeploy,
|
|
6496
6272
|
watchDeployment,
|
|
6497
|
-
prepareUpgradeFromVerifiableBuild,
|
|
6498
6273
|
prepareUpgrade,
|
|
6499
6274
|
executeUpgrade,
|
|
6500
6275
|
watchUpgrade,
|
|
@@ -6511,4 +6286,4 @@ export {
|
|
|
6511
6286
|
createAppModule,
|
|
6512
6287
|
createComputeModule
|
|
6513
6288
|
};
|
|
6514
|
-
//# sourceMappingURL=chunk-
|
|
6289
|
+
//# sourceMappingURL=chunk-4SKRNFKQ.js.map
|