@layr-labs/ecloud-sdk 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/dist/index.d.cts CHANGED
@@ -1,142 +1,10 @@
1
- import { G as GasEstimate, C as ComputeModule } from './compute-CbmjA8kJ.cjs';
2
- export { e as ComputeModuleConfig, a as CreateAppOpts, E as EstimateGasOptions, 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, n as estimateTransactionGas, o as formatETH, j as getAllAppsByDeveloper, k as getAppLatestReleaseBlockNumbers, g as getAvailableTemplates, m as getBlockTimestamps, l as logs } from './compute-CbmjA8kJ.cjs';
1
+ import { C as ComputeModule } from './compute-B_ibIORD.cjs';
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';
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';
5
7
  import { Address, Hex, WalletClient, PublicClient, PrivateKeyAccount } from 'viem';
6
- import { E as EnvironmentConfig, S as SubscriptionStatus, L as Logger, P as PreparedDeploy, D as DeployResult, a as PreparedUpgrade, A as AppId } from './index-D2QufVB9.cjs';
7
- export { w as AlreadyActiveResponse, q as AppProfile, r as AppProfileResponse, m as AppRecord, B as BillingEnvironmentConfig, F as CancelResponse, z as CancelSuccessResponse, C as ChainID, v as CheckoutCreatedResponse, u as CreateSubscriptionResponse, b as DeployAppOpts, n as DeployOptions, p as DockerImageConfig, g as ExecuteDeployResult, h as ExecuteUpgradeResult, G as GasOpts, I as ImageDigestResult, k as LifecycleOpts, N as NoActiveSubscriptionResponse, o as ParsedEnvironment, x as PaymentIssueResponse, e as PrepareDeployFromVerifiableBuildOpts, c as PrepareDeployOpts, f as PrepareUpgradeFromVerifiableBuildOpts, d as PrepareUpgradeOpts, i as PreparedDeployData, j as PreparedUpgradeData, s as ProductID, H as ProductSubscriptionResponse, R as Release, y as SubscribeResponse, t as SubscriptionLineItem, J as SubscriptionOpts, U as UpgradeAppOpts, l as logVisibility } from './index-D2QufVB9.cjs';
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
8
 
141
9
  /**
142
10
  * Non-interactive validation utilities for SDK
@@ -303,143 +171,109 @@ interface LogsParams {
303
171
  declare function validateLogsParams(params: Partial<LogsParams>): void;
304
172
 
305
173
  /**
306
- * UserAPI Client to manage interactions with the coordinator
174
+ * Contract interactions
175
+ *
176
+ * This module handles on-chain contract interactions using viem
307
177
  */
308
178
 
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;
179
+ /**
180
+ * Gas estimation result
181
+ */
182
+ interface GasEstimate {
183
+ /** Estimated gas limit for the transaction */
184
+ gasLimit: bigint;
185
+ /** Max fee per gas (EIP-1559) */
186
+ maxFeePerGas: bigint;
187
+ /** Max priority fee per gas (EIP-1559) */
188
+ maxPriorityFeePerGas: bigint;
189
+ /** Maximum cost in wei (gasLimit * maxFeePerGas) */
190
+ maxCostWei: bigint;
191
+ /** Maximum cost formatted as ETH string */
192
+ maxCostEth: string;
365
193
  }
366
- interface AppResponse {
367
- id: string;
368
- creator?: string;
369
- contractStatus?: AppContractStatus;
370
- releases: AppRelease[];
194
+ /**
195
+ * Options for estimating transaction gas
196
+ */
197
+ interface EstimateGasOptions {
198
+ privateKey: string;
199
+ rpcUrl: string;
200
+ environmentConfig: EnvironmentConfig;
201
+ to: Address;
202
+ data: Hex;
203
+ value?: bigint;
371
204
  }
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;
205
+ /**
206
+ * Format Wei to ETH string
207
+ */
208
+ declare function formatETH(wei: bigint): string;
209
+ /**
210
+ * Estimate gas cost for a transaction
211
+ *
212
+ * Use this to get cost estimate before prompting user for confirmation.
213
+ */
214
+ declare function estimateTransactionGas(options: EstimateGasOptions): Promise<GasEstimate>;
215
+ /**
216
+ * Prepared deploy batch ready for gas estimation and execution
217
+ */
218
+ interface PreparedDeployBatch {
219
+ /** The app ID that will be deployed */
220
+ appId: Address;
221
+ /** The salt used for deployment */
222
+ salt: Uint8Array;
223
+ /** Batch executions to be sent */
224
+ executions: Array<{
225
+ target: Address;
226
+ value: bigint;
227
+ callData: Hex;
414
228
  }>;
415
- private makeAuthenticatedRequest;
416
- /**
417
- * Generate authentication headers for UserAPI requests
418
- */
419
- private generateAuthHeaders;
229
+ /** Wallet client for sending transaction */
230
+ walletClient: WalletClient;
231
+ /** Public client for reading chain state */
232
+ publicClient: PublicClient;
233
+ /** Environment configuration */
234
+ environmentConfig: EnvironmentConfig;
420
235
  }
421
-
422
236
  /**
423
- * Billing utility functions
237
+ * Prepared upgrade batch ready for gas estimation and execution
424
238
  */
425
-
239
+ interface PreparedUpgradeBatch {
240
+ /** The app ID being upgraded */
241
+ appId: Address;
242
+ /** Batch executions to be sent */
243
+ executions: Array<{
244
+ target: Address;
245
+ value: bigint;
246
+ callData: Hex;
247
+ }>;
248
+ /** Wallet client for sending transaction */
249
+ walletClient: WalletClient;
250
+ /** Public client for reading chain state */
251
+ publicClient: PublicClient;
252
+ /** Environment configuration */
253
+ environmentConfig: EnvironmentConfig;
254
+ }
426
255
  /**
427
- * Check if subscription status allows deploying apps
256
+ * Get apps by creator (paginated)
428
257
  */
429
- declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
430
-
258
+ interface AppConfig {
259
+ release: any;
260
+ status: number;
261
+ }
431
262
  /**
432
- * General utility helpers
263
+ * Fetch all apps by a developer by auto-pagination
433
264
  */
434
-
265
+ declare function getAllAppsByDeveloper(rpcUrl: string, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
266
+ apps: Address[];
267
+ appConfigs: AppConfig[];
268
+ }>;
435
269
  /**
436
- * Ensure hex string has 0x prefix
270
+ * Get latest release block numbers for multiple apps
437
271
  */
438
- declare function addHexPrefix(value: string): Hex;
272
+ declare function getAppLatestReleaseBlockNumbers(rpcUrl: string, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
439
273
  /**
440
- * Remove 0x prefix from hex string if present
274
+ * Get block timestamps for multiple block numbers
441
275
  */
442
- declare function stripHexPrefix(value: string): string;
276
+ declare function getBlockTimestamps(rpcUrl: string, environmentConfig: EnvironmentConfig, blockNumbers: number[]): Promise<Map<number, number>>;
443
277
 
444
278
  /**
445
279
  * Main deploy function
@@ -483,6 +317,23 @@ interface SDKDeployOptions {
483
317
  /** Skip telemetry (used when called from CLI) - optional */
484
318
  skipTelemetry?: boolean;
485
319
  }
320
+ /**
321
+ * Prepared deployment ready for gas estimation and execution
322
+ */
323
+ interface PreparedDeploy {
324
+ /** The prepared batch (executions, clients, etc.) */
325
+ batch: PreparedDeployBatch;
326
+ /** App name */
327
+ appName: string;
328
+ /** Final image reference */
329
+ imageRef: string;
330
+ /** Preflight context for post-deploy operations */
331
+ preflightCtx: {
332
+ privateKey: string;
333
+ rpcUrl: string;
334
+ environmentConfig: EnvironmentConfig;
335
+ };
336
+ }
486
337
  /**
487
338
  * Result from prepareDeploy - includes prepared batch and gas estimate
488
339
  */
@@ -492,38 +343,6 @@ interface PrepareDeployResult {
492
343
  /** Gas estimate for the batch transaction */
493
344
  gasEstimate: GasEstimate;
494
345
  }
495
- /** Options for executing a prepared deployment */
496
- interface ExecuteDeployOptions {
497
- prepared: PreparedDeploy;
498
- context: {
499
- walletClient: WalletClient;
500
- publicClient: PublicClient;
501
- environmentConfig: EnvironmentConfig;
502
- };
503
- gas?: {
504
- maxFeePerGas?: bigint;
505
- maxPriorityFeePerGas?: bigint;
506
- };
507
- logger?: Logger;
508
- skipTelemetry?: boolean;
509
- }
510
- /**
511
- * Prepare a deployment from a pre-built image (already layered) without using Docker locally.
512
- *
513
- * This is intended for verifiable builds where the build service outputs:
514
- * - imageRef (tagged image URL)
515
- * - imageDigest (sha256:... digest)
516
- *
517
- * Flow is the same as prepareDeploy, except:
518
- * - Skips ensureDockerIsRunning()
519
- * - Skips prepareRelease() image layering and digest extraction
520
- * - Uses provided imageDigest + derived registry name to construct the Release struct
521
- */
522
- declare function prepareDeployFromVerifiableBuild(options: Omit<SDKDeployOptions, "gas" | "dockerfilePath" | "imageRef"> & {
523
- imageRef: string;
524
- imageDigest: string;
525
- skipTelemetry?: boolean;
526
- }, logger?: Logger): Promise<PrepareDeployResult>;
527
346
  /**
528
347
  * Prepare deployment - does all work up to the transaction
529
348
  *
@@ -542,7 +361,10 @@ declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas"> & {
542
361
  * Note: This only submits the on-chain transaction. Call watchDeployment separately
543
362
  * to wait for the app to be running.
544
363
  */
545
- declare function executeDeploy(options: ExecuteDeployOptions): Promise<DeployResult>;
364
+ declare function executeDeploy(prepared: PreparedDeploy, gas: {
365
+ maxFeePerGas?: bigint;
366
+ maxPriorityFeePerGas?: bigint;
367
+ } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<DeployResult>;
546
368
  /**
547
369
  * Watch a deployment until the app is running
548
370
  *
@@ -595,11 +417,28 @@ interface SDKUpgradeOptions {
595
417
  }
596
418
  interface UpgradeResult {
597
419
  /** App ID (contract address) */
598
- appId: AppId;
420
+ appId: string;
599
421
  /** Final image reference */
600
422
  imageRef: string;
601
423
  /** Transaction hash */
602
- txHash: Hex;
424
+ txHash: `0x${string}`;
425
+ }
426
+ /**
427
+ * Prepared upgrade ready for gas estimation and execution
428
+ */
429
+ interface PreparedUpgrade {
430
+ /** The prepared batch (executions, clients, etc.) */
431
+ batch: PreparedUpgradeBatch;
432
+ /** App ID being upgraded */
433
+ appId: string;
434
+ /** Final image reference */
435
+ imageRef: string;
436
+ /** Preflight context for post-upgrade operations */
437
+ preflightCtx: {
438
+ privateKey: string;
439
+ rpcUrl: string;
440
+ environmentConfig: EnvironmentConfig;
441
+ };
603
442
  }
604
443
  /**
605
444
  * Result from prepareUpgrade - includes prepared batch and gas estimate
@@ -610,34 +449,6 @@ interface PrepareUpgradeResult {
610
449
  /** Gas estimate for the batch transaction */
611
450
  gasEstimate: GasEstimate;
612
451
  }
613
- /** Options for executing a prepared upgrade */
614
- interface ExecuteUpgradeOptions {
615
- prepared: PreparedUpgrade;
616
- context: {
617
- walletClient: WalletClient;
618
- publicClient: PublicClient;
619
- environmentConfig: EnvironmentConfig;
620
- };
621
- gas?: {
622
- maxFeePerGas?: bigint;
623
- maxPriorityFeePerGas?: bigint;
624
- };
625
- logger?: Logger;
626
- skipTelemetry?: boolean;
627
- }
628
- /**
629
- * Prepare an upgrade from a pre-built image (already layered) without using Docker locally.
630
- *
631
- * Intended for verifiable builds: build service provides imageRef + imageDigest (sha256:...).
632
- * This skips:
633
- * - ensureDockerIsRunning()
634
- * - prepareRelease() layering/digest extraction
635
- */
636
- declare function prepareUpgradeFromVerifiableBuild(options: Omit<SDKUpgradeOptions, "gas" | "dockerfilePath" | "imageRef"> & {
637
- imageRef: string;
638
- imageDigest: string;
639
- skipTelemetry?: boolean;
640
- }, logger?: Logger): Promise<PrepareUpgradeResult>;
641
452
  /**
642
453
  * Prepare upgrade - does all work up to the transaction
643
454
  *
@@ -656,7 +467,10 @@ declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas"> & {
656
467
  * Note: This only submits the on-chain transaction. Call watchUpgrade separately
657
468
  * to wait for the upgrade to complete.
658
469
  */
659
- declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<UpgradeResult>;
470
+ declare function executeUpgrade(prepared: PreparedUpgrade, gas: {
471
+ maxFeePerGas?: bigint;
472
+ maxPriorityFeePerGas?: bigint;
473
+ } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<UpgradeResult>;
660
474
  /**
661
475
  * Watch an upgrade until it completes
662
476
  *
@@ -689,6 +503,15 @@ declare function isEnvironmentAvailable(environment: string): boolean;
689
503
  */
690
504
  declare function isMainnet(environmentConfig: EnvironmentConfig): boolean;
691
505
 
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
+
692
515
  /**
693
516
  * OS Keyring Integration
694
517
  *
@@ -699,7 +522,6 @@ declare function isMainnet(environmentConfig: EnvironmentConfig): boolean;
699
522
  *
700
523
  * Uses a single key for all environments.
701
524
  */
702
-
703
525
  interface StoredKey {
704
526
  address: string;
705
527
  }
@@ -721,7 +543,7 @@ declare function storePrivateKey(privateKey: string): Promise<void>;
721
543
  * Note: Returns the single stored key for all environments.
722
544
  * The environment parameter is kept for API compatibility but is ignored.
723
545
  */
724
- declare function getPrivateKey(): Promise<Hex | null>;
546
+ declare function getPrivateKey(): Promise<`0x${string}` | null>;
725
547
  /**
726
548
  * Delete a private key from OS keyring
727
549
  * Returns true if deletion was successful, false otherwise
@@ -773,9 +595,8 @@ declare function getAddressFromPrivateKey(privateKey: string): string;
773
595
  * 2. Environment variable (ECLOUD_PRIVATE_KEY)
774
596
  * 3. OS keyring (stored via `ecloud auth login`)
775
597
  */
776
-
777
598
  interface PrivateKeySource {
778
- key: Hex;
599
+ key: `0x${string}`;
779
600
  source: string;
780
601
  }
781
602
  /**
@@ -1067,23 +888,24 @@ declare function getCategoryDescriptions(catalog: TemplateCatalog, language: str
1067
888
  * This module handles EIP-7702 delegation and batch execution
1068
889
  */
1069
890
 
1070
- type Execution = {
1071
- target: Address;
1072
- value: bigint;
1073
- callData: Hex;
1074
- };
1075
891
  /**
1076
892
  * Options for estimating batch gas
1077
893
  */
1078
894
  interface EstimateBatchGasOptions {
1079
895
  publicClient: PublicClient;
1080
- account: Address;
1081
- executions: Execution[];
896
+ environmentConfig: EnvironmentConfig;
897
+ executions: Array<{
898
+ target: Address;
899
+ value: bigint;
900
+ callData: Hex;
901
+ }>;
1082
902
  }
1083
903
  /**
1084
904
  * Estimate gas cost for a batch transaction
1085
905
  *
1086
906
  * Use this to get cost estimate before prompting user for confirmation.
907
+ * Note: This provides a conservative estimate since batch transactions
908
+ * through EIP-7702 can have variable costs.
1087
909
  */
1088
910
  declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
1089
911
  /**
@@ -1114,6 +936,81 @@ interface PreflightContext {
1114
936
  */
1115
937
  declare function getCurrentInstanceType(preflightCtx: PreflightContext, appID: Address, logger: Logger, clientId?: string): Promise<string>;
1116
938
 
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
+
1117
1014
  /**
1118
1015
  * Main SDK Client entry point
1119
1016
  */
@@ -1121,7 +1018,7 @@ declare function getCurrentInstanceType(preflightCtx: PreflightContext, appID: A
1121
1018
  type Environment = "sepolia" | "sepolia-dev" | "mainnet-alpha";
1122
1019
  interface ClientConfig {
1123
1020
  verbose: boolean;
1124
- privateKey: Hex;
1021
+ privateKey: `0x${string}`;
1125
1022
  environment: Environment | string;
1126
1023
  rpcUrl?: string;
1127
1024
  }
@@ -1131,4 +1028,4 @@ interface ECloudClient {
1131
1028
  }
1132
1029
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1133
1030
 
1134
- export { type AppEnvironment, AppId, 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, ForbiddenError, GasEstimate, type GeneratedKey, type LegacyKey, type LogChunk, type LogVisibility, Logger, type LogsParams, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, 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, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, generateNewPrivateKey, getAddressFromPrivateKey, getAvailableEnvironments, 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 };
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 };