@layr-labs/ecloud-sdk 0.1.1-dev → 0.2.0-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/dist/index.d.cts CHANGED
@@ -2,10 +2,142 @@ import { C as ComputeModule } from './compute-B_ibIORD.cjs';
2
2
  export { e as ComputeModuleConfig, a as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, b as SDKLogsOptions, c as createApp, d as createComputeModule, f as encodeStartAppData, h as encodeStopAppData, i as encodeTerminateAppData, g as getAvailableTemplates, l as logs } from './compute-B_ibIORD.cjs';
3
3
  import { BillingModule } from './billing.cjs';
4
4
  export { BillingModuleConfig, createBillingModule } from './billing.cjs';
5
- import { E as EnvironmentConfig, L as Logger, D as DeployResult, S as SubscriptionStatus } from './index-D-SUX3IG.cjs';
5
+ import { E as EnvironmentConfig, S as SubscriptionStatus, L as Logger, D as DeployResult } from './index-D-SUX3IG.cjs';
6
6
  export { m as AlreadyActiveResponse, A as AppId, f as AppProfile, g as AppProfileResponse, c as AppRecord, B as BillingEnvironmentConfig, q as CancelResponse, p as CancelSuccessResponse, C as ChainID, k as CheckoutCreatedResponse, j as CreateSubscriptionResponse, a as DeployAppOpts, d as DeployOptions, e as DockerImageConfig, I as ImageDigestResult, b as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, n as PaymentIssueResponse, h as ProductID, r as ProductSubscriptionResponse, R as Release, o as SubscribeResponse, i as SubscriptionLineItem, s as SubscriptionOpts, U as UpgradeAppOpts, l as logVisibility } from './index-D-SUX3IG.cjs';
7
7
  import { Address, Hex, WalletClient, PublicClient, PrivateKeyAccount } from 'viem';
8
8
 
9
+ interface SubmitBuildRequest {
10
+ repoUrl: string;
11
+ gitRef: string;
12
+ dockerfilePath?: string;
13
+ /**
14
+ * Path to a Caddyfile within the repository (relative to buildContextPath).
15
+ * If omitted, the build service will not copy a Caddyfile into the image.
16
+ */
17
+ caddyfilePath?: string;
18
+ buildContextPath?: string;
19
+ dependencies?: string[];
20
+ }
21
+ interface SubmitBuildResponse {
22
+ buildId: string;
23
+ }
24
+ declare const BUILD_STATUS: {
25
+ readonly BUILDING: "building";
26
+ readonly SUCCESS: "success";
27
+ readonly FAILED: "failed";
28
+ };
29
+ type BuildStatus = (typeof BUILD_STATUS)[keyof typeof BUILD_STATUS];
30
+ interface Build {
31
+ buildId: string;
32
+ billingAddress: string;
33
+ repoUrl: string;
34
+ gitRef: string;
35
+ status: BuildStatus;
36
+ /** 'application' | 'dependency' (as returned by the API) */
37
+ buildType: string;
38
+ imageName: string;
39
+ imageUrl?: string;
40
+ imageDigest?: string;
41
+ provenanceJson?: Record<string, unknown>;
42
+ provenanceSignature?: string;
43
+ errorMessage?: string;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ dependencies?: Record<string, Build>;
47
+ }
48
+ type VerifyProvenanceResult = VerifyProvenanceSuccess | VerifyProvenanceFailure;
49
+ interface VerifyProvenanceSuccess {
50
+ status: "verified";
51
+ buildId: string;
52
+ imageUrl: string;
53
+ imageDigest: string;
54
+ repoUrl: string;
55
+ gitRef: string;
56
+ provenanceJson: Record<string, unknown>;
57
+ provenanceSignature: string;
58
+ payloadType: string;
59
+ payload: string;
60
+ }
61
+ interface VerifyProvenanceFailure {
62
+ status: "failed";
63
+ error: string;
64
+ buildId?: string;
65
+ }
66
+ interface LogChunk {
67
+ content: string;
68
+ totalLength: number;
69
+ isComplete: boolean;
70
+ finalStatus?: BuildStatus;
71
+ }
72
+ interface BuildProgress {
73
+ build: Build;
74
+ logs: string;
75
+ }
76
+
77
+ declare class BuildError extends Error {
78
+ constructor(message: string);
79
+ }
80
+ declare class AuthRequiredError extends BuildError {
81
+ constructor(message?: string);
82
+ }
83
+ declare class BuildFailedError extends BuildError {
84
+ readonly buildId: string;
85
+ constructor(message: string, buildId: string);
86
+ }
87
+ declare class ConflictError extends BuildError {
88
+ constructor(message?: string);
89
+ }
90
+ declare class NotFoundError extends BuildError {
91
+ constructor(message?: string);
92
+ }
93
+ declare class ForbiddenError extends BuildError {
94
+ constructor(message?: string);
95
+ }
96
+ declare class TimeoutError extends BuildError {
97
+ constructor(message?: string);
98
+ }
99
+ declare class BadRequestError extends BuildError {
100
+ constructor(message?: string);
101
+ }
102
+
103
+ /**
104
+ * Build module entry point (verifiable builds + provenance)
105
+ */
106
+
107
+ interface BuildModuleConfig {
108
+ privateKey?: string;
109
+ environment?: string;
110
+ verbose?: boolean;
111
+ clientId?: string;
112
+ skipTelemetry?: boolean;
113
+ }
114
+ interface BuildModule {
115
+ submit(request: SubmitBuildRequest): Promise<SubmitBuildResponse>;
116
+ getLogs(buildId: string): Promise<string>;
117
+ list(options: {
118
+ billingAddress: string;
119
+ limit?: number;
120
+ offset?: number;
121
+ }): Promise<Build[]>;
122
+ get(buildId: string): Promise<Build>;
123
+ getByDigest(digest: string): Promise<Build>;
124
+ verify(identifier: string): Promise<VerifyProvenanceResult>;
125
+ submitAndWait(request: SubmitBuildRequest, options?: {
126
+ onLog?: (chunk: string) => void;
127
+ onProgress?: (progress: BuildProgress) => void;
128
+ pollIntervalMs?: number;
129
+ timeoutMs?: number;
130
+ }): Promise<Build>;
131
+ waitForBuild(buildId: string, options?: {
132
+ onLog?: (chunk: string) => void;
133
+ onProgress?: (progress: BuildProgress) => void;
134
+ pollIntervalMs?: number;
135
+ timeoutMs?: number;
136
+ }): Promise<Build>;
137
+ streamLogs(buildId: string, pollIntervalMs?: number): AsyncGenerator<LogChunk, void, unknown>;
138
+ }
139
+ declare function createBuildModule(config: BuildModuleConfig): BuildModule;
140
+
9
141
  /**
10
142
  * Non-interactive validation utilities for SDK
11
143
  *
@@ -170,6 +302,145 @@ interface LogsParams {
170
302
  */
171
303
  declare function validateLogsParams(params: Partial<LogsParams>): void;
172
304
 
305
+ /**
306
+ * UserAPI Client to manage interactions with the coordinator
307
+ */
308
+
309
+ interface AppProfileInfo {
310
+ name: string;
311
+ website?: string;
312
+ description?: string;
313
+ xURL?: string;
314
+ imageURL?: string;
315
+ }
316
+ interface AppMetrics {
317
+ cpu_utilization_percent?: number;
318
+ memory_utilization_percent?: number;
319
+ memory_used_bytes?: number;
320
+ memory_total_bytes?: number;
321
+ }
322
+ interface DerivedAddress {
323
+ address: string;
324
+ derivationPath: string;
325
+ }
326
+ interface AppInfo {
327
+ address: Address;
328
+ status: string;
329
+ ip: string;
330
+ machineType: string;
331
+ profile?: AppProfileInfo;
332
+ metrics?: AppMetrics;
333
+ evmAddresses: DerivedAddress[];
334
+ solanaAddresses: DerivedAddress[];
335
+ }
336
+ type AppContractStatus = "STARTED" | "STOPPED" | "TERMINATED" | "SUSPENDED" | string;
337
+ interface AppReleaseBuild {
338
+ buildId?: string;
339
+ billingAddress?: string;
340
+ repoUrl?: string;
341
+ gitRef?: string;
342
+ status?: string;
343
+ buildType?: string;
344
+ imageName?: string;
345
+ imageDigest?: string;
346
+ imageUrl?: string;
347
+ provenanceJson?: unknown;
348
+ provenanceSignature?: string;
349
+ createdAt?: string;
350
+ updatedAt?: string;
351
+ errorMessage?: string;
352
+ dependencies?: Record<string, AppReleaseBuild>;
353
+ }
354
+ interface AppRelease {
355
+ appId?: string;
356
+ rmsReleaseId?: string;
357
+ imageDigest?: string;
358
+ registryUrl?: string;
359
+ publicEnv?: string;
360
+ encryptedEnv?: string;
361
+ upgradeByTime?: number;
362
+ createdAt?: string;
363
+ createdAtBlock?: string;
364
+ build?: AppReleaseBuild;
365
+ }
366
+ interface AppResponse {
367
+ id: string;
368
+ creator?: string;
369
+ contractStatus?: AppContractStatus;
370
+ releases: AppRelease[];
371
+ }
372
+ declare class UserApiClient {
373
+ private readonly config;
374
+ private readonly account?;
375
+ private readonly rpcUrl?;
376
+ private readonly clientId;
377
+ constructor(config: EnvironmentConfig, privateKey?: string | Hex, rpcUrl?: string, clientId?: string);
378
+ getInfos(appIDs: Address[], addressCount?: number): Promise<AppInfo[]>;
379
+ /**
380
+ * Get app details from UserAPI (includes releases and build/provenance info when available).
381
+ *
382
+ * Endpoint: GET /apps/:appAddress
383
+ */
384
+ getApp(appAddress: Address): Promise<AppResponse>;
385
+ /**
386
+ * Get available SKUs (instance types) from UserAPI
387
+ */
388
+ getSKUs(): Promise<{
389
+ skus: Array<{
390
+ sku: string;
391
+ description: string;
392
+ }>;
393
+ }>;
394
+ /**
395
+ * Get logs for an app
396
+ */
397
+ getLogs(appID: Address): Promise<string>;
398
+ /**
399
+ * Get statuses for apps
400
+ */
401
+ getStatuses(appIDs: Address[]): Promise<Array<{
402
+ address: Address;
403
+ status: string;
404
+ }>>;
405
+ /**
406
+ * Upload app profile information with optional image
407
+ */
408
+ uploadAppProfile(appAddress: Address, name: string, website?: string, description?: string, xURL?: string, imagePath?: string): Promise<{
409
+ name: string;
410
+ website?: string;
411
+ description?: string;
412
+ xURL?: string;
413
+ imageURL?: string;
414
+ }>;
415
+ private makeAuthenticatedRequest;
416
+ /**
417
+ * Generate authentication headers for UserAPI requests
418
+ */
419
+ private generateAuthHeaders;
420
+ }
421
+
422
+ /**
423
+ * Billing utility functions
424
+ */
425
+
426
+ /**
427
+ * Check if subscription status allows deploying apps
428
+ */
429
+ declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
430
+
431
+ /**
432
+ * General utility helpers
433
+ */
434
+
435
+ /**
436
+ * Ensure hex string has 0x prefix
437
+ */
438
+ declare function addHexPrefix(value: string): `0x${string}`;
439
+ /**
440
+ * Remove 0x prefix from hex string if present
441
+ */
442
+ declare function stripHexPrefix(value: string): string;
443
+
173
444
  /**
174
445
  * Contract interactions
175
446
  *
@@ -343,6 +614,23 @@ interface PrepareDeployResult {
343
614
  /** Gas estimate for the batch transaction */
344
615
  gasEstimate: GasEstimate;
345
616
  }
617
+ /**
618
+ * Prepare a deployment from a pre-built image (already layered) without using Docker locally.
619
+ *
620
+ * This is intended for verifiable builds where the build service outputs:
621
+ * - imageRef (tagged image URL)
622
+ * - imageDigest (sha256:... digest)
623
+ *
624
+ * Flow is the same as prepareDeploy, except:
625
+ * - Skips ensureDockerIsRunning()
626
+ * - Skips prepareRelease() image layering and digest extraction
627
+ * - Uses provided imageDigest + derived registry name to construct the Release struct
628
+ */
629
+ declare function prepareDeployFromVerifiableBuild(options: Omit<SDKDeployOptions, "gas" | "dockerfilePath" | "imageRef"> & {
630
+ imageRef: string;
631
+ imageDigest: string;
632
+ skipTelemetry?: boolean;
633
+ }, logger?: Logger): Promise<PrepareDeployResult>;
346
634
  /**
347
635
  * Prepare deployment - does all work up to the transaction
348
636
  *
@@ -449,6 +737,19 @@ interface PrepareUpgradeResult {
449
737
  /** Gas estimate for the batch transaction */
450
738
  gasEstimate: GasEstimate;
451
739
  }
740
+ /**
741
+ * Prepare an upgrade from a pre-built image (already layered) without using Docker locally.
742
+ *
743
+ * Intended for verifiable builds: build service provides imageRef + imageDigest (sha256:...).
744
+ * This skips:
745
+ * - ensureDockerIsRunning()
746
+ * - prepareRelease() layering/digest extraction
747
+ */
748
+ declare function prepareUpgradeFromVerifiableBuild(options: Omit<SDKUpgradeOptions, "gas" | "dockerfilePath" | "imageRef"> & {
749
+ imageRef: string;
750
+ imageDigest: string;
751
+ skipTelemetry?: boolean;
752
+ }, logger?: Logger): Promise<PrepareUpgradeResult>;
452
753
  /**
453
754
  * Prepare upgrade - does all work up to the transaction
454
755
  *
@@ -503,15 +804,6 @@ declare function isEnvironmentAvailable(environment: string): boolean;
503
804
  */
504
805
  declare function isMainnet(environmentConfig: EnvironmentConfig): boolean;
505
806
 
506
- /**
507
- * Billing utility functions
508
- */
509
-
510
- /**
511
- * Check if subscription status allows deploying apps
512
- */
513
- declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
514
-
515
807
  /**
516
808
  * OS Keyring Integration
517
809
  *
@@ -936,81 +1228,6 @@ interface PreflightContext {
936
1228
  */
937
1229
  declare function getCurrentInstanceType(preflightCtx: PreflightContext, appID: Address, logger: Logger, clientId?: string): Promise<string>;
938
1230
 
939
- /**
940
- * UserAPI Client to manage interactions with the coordinator
941
- */
942
-
943
- interface AppProfileInfo {
944
- name: string;
945
- website?: string;
946
- description?: string;
947
- xURL?: string;
948
- imageURL?: string;
949
- }
950
- interface AppMetrics {
951
- cpu_utilization_percent?: number;
952
- memory_utilization_percent?: number;
953
- memory_used_bytes?: number;
954
- memory_total_bytes?: number;
955
- }
956
- interface DerivedAddress {
957
- address: string;
958
- derivationPath: string;
959
- }
960
- interface AppInfo {
961
- address: Address;
962
- status: string;
963
- ip: string;
964
- machineType: string;
965
- profile?: AppProfileInfo;
966
- metrics?: AppMetrics;
967
- evmAddresses: DerivedAddress[];
968
- solanaAddresses: DerivedAddress[];
969
- }
970
- declare class UserApiClient {
971
- private readonly config;
972
- private readonly account?;
973
- private readonly rpcUrl?;
974
- private readonly clientId;
975
- constructor(config: EnvironmentConfig, privateKey?: string | Hex, rpcUrl?: string, clientId?: string);
976
- getInfos(appIDs: Address[], addressCount?: number): Promise<AppInfo[]>;
977
- /**
978
- * Get available SKUs (instance types) from UserAPI
979
- */
980
- getSKUs(): Promise<{
981
- skus: Array<{
982
- sku: string;
983
- description: string;
984
- }>;
985
- }>;
986
- /**
987
- * Get logs for an app
988
- */
989
- getLogs(appID: Address): Promise<string>;
990
- /**
991
- * Get statuses for apps
992
- */
993
- getStatuses(appIDs: Address[]): Promise<Array<{
994
- address: Address;
995
- status: string;
996
- }>>;
997
- /**
998
- * Upload app profile information with optional image
999
- */
1000
- uploadAppProfile(appAddress: Address, name: string, website?: string, description?: string, xURL?: string, imagePath?: string): Promise<{
1001
- name: string;
1002
- website?: string;
1003
- description?: string;
1004
- xURL?: string;
1005
- imageURL?: string;
1006
- }>;
1007
- private makeAuthenticatedRequest;
1008
- /**
1009
- * Generate authentication headers for UserAPI requests
1010
- */
1011
- private generateAuthHeaders;
1012
- }
1013
-
1014
1231
  /**
1015
1232
  * Main SDK Client entry point
1016
1233
  */
@@ -1028,4 +1245,4 @@ interface ECloudClient {
1028
1245
  }
1029
1246
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1030
1247
 
1031
- export { type AppEnvironment, type AppInfo, type AppMetrics, type AppProfileInfo, BillingModule, type ClientConfig, ComputeModule, type CreateAppParams, type DeployParams, DeployResult, type ECloudClient, type Environment, EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type LegacyKey, type LogVisibility, Logger, type LogsParams, type Metric, type MetricsContext, NoopClient, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, SubscriptionStatus, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, type UpgradeParams, UserApiClient, addMetric, addMetricWithDimensions, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, checkERC7702Delegation, createAppEnvironment, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isNoopClient, isSubscriptionActive, keyExists, listStoredKeys, prepareDeploy, prepareUpgrade, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade, withSDKTelemetry };
1248
+ export { type AppEnvironment, type AppInfo, type AppMetrics, type AppProfileInfo, type AppRelease, type AppReleaseBuild, type AppResponse, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, type CreateAppParams, type DeployParams, DeployResult, type ECloudClient, type Environment, EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, ForbiddenError, type GasEstimate, type GeneratedKey, type LegacyKey, type LogChunk, type LogVisibility, Logger, type LogsParams, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, SubscriptionStatus, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, type UpgradeParams, UserApiClient, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addHexPrefix, addMetric, addMetricWithDimensions, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, checkERC7702Delegation, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isNoopClient, isSubscriptionActive, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, stripHexPrefix, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade, withSDKTelemetry };