@layr-labs/ecloud-sdk 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 (40) hide show
  1. package/VERSION +2 -2
  2. package/dist/billing.cjs +48 -43
  3. package/dist/billing.cjs.map +1 -1
  4. package/dist/billing.d.cts +6 -3
  5. package/dist/billing.d.ts +6 -3
  6. package/dist/billing.js +519 -4
  7. package/dist/billing.js.map +1 -1
  8. package/dist/browser.cjs +5034 -0
  9. package/dist/browser.cjs.map +1 -0
  10. package/dist/browser.d.cts +239 -0
  11. package/dist/browser.d.ts +239 -0
  12. package/dist/browser.js +4924 -0
  13. package/dist/browser.js.map +1 -0
  14. package/dist/{compute-CF2HOXed.d.ts → compute-BYhSs8en.d.ts} +15 -96
  15. package/dist/{compute-CbmjA8kJ.d.cts → compute-Bpjb3hYD.d.cts} +15 -96
  16. package/dist/compute.cjs +875 -846
  17. package/dist/compute.cjs.map +1 -1
  18. package/dist/compute.d.cts +2 -2
  19. package/dist/compute.d.ts +2 -2
  20. package/dist/compute.js +7009 -8
  21. package/dist/compute.js.map +1 -1
  22. package/dist/helpers-CEvhJz7f.d.cts +742 -0
  23. package/dist/helpers-CQuBwQnu.d.ts +742 -0
  24. package/dist/index-DeQzn_yM.d.cts +739 -0
  25. package/dist/index-DeQzn_yM.d.ts +739 -0
  26. package/dist/index.cjs +1958 -1758
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +69 -414
  29. package/dist/index.d.ts +69 -414
  30. package/dist/index.js +7977 -134
  31. package/dist/index.js.map +1 -1
  32. package/package.json +17 -2
  33. package/dist/chunk-CA5Y4OVI.js +0 -744
  34. package/dist/chunk-CA5Y4OVI.js.map +0 -1
  35. package/dist/chunk-ZDXN2WKP.js +0 -434
  36. package/dist/chunk-ZDXN2WKP.js.map +0 -1
  37. package/dist/chunk-ZTLKZMSW.js +0 -6719
  38. package/dist/chunk-ZTLKZMSW.js.map +0 -1
  39. package/dist/index-D2QufVB9.d.cts +0 -342
  40. package/dist/index-D2QufVB9.d.ts +0 -342
package/dist/index.d.cts CHANGED
@@ -1,10 +1,12 @@
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-Bpjb3hYD.cjs';
2
+ export { d as ComputeModuleConfig, a as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData, g as getAvailableTemplates, l as logs } from './compute-Bpjb3hYD.cjs';
3
3
  import { BillingModule } from './billing.cjs';
4
4
  export { BillingModuleConfig, createBillingModule } from './billing.cjs';
5
- 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';
5
+ import { WalletClient, PublicClient, Address, Hex } from 'viem';
6
+ import { L as LogVisibility, a7 as ResourceUsageMonitoring } from './helpers-CEvhJz7f.cjs';
7
+ export { F as AppInfo, I as AppMetrics, H as AppProfileInfo, a9 as AppRelease, aa as AppReleaseBuild, ab as AppResponse, K as BillingApiClient, C as ComputeApiConfig, z as CreateAppParams, ag as DeployParams, P as EstimateBatchGasOptions, G as GeneratedKey, a3 as LoginRequest, a2 as LoginResult, A as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, Z as SiweMessageResult, ai as UpgradeParams, U as UserApiClient, a5 as addHexPrefix, ad as assertValidFilePath, j as assertValidImageReference, n as assertValidPrivateKey, O as checkERC7702Delegation, T as createSiweMessage, a8 as createViemClients, M as estimateBatchGas, k as extractAppNameFromImage, D as generateNewPrivateKey, W as generateNonce, d as getAvailableEnvironments, c as getBillingEnvironmentConfig, e as getBuildType, a4 as getChainFromID, a0 as getComputeApiSession, g as getEnvironmentConfig, i as isEnvironmentAvailable, f as isMainnet, a1 as isSessionValid, X as isSiweMessageExpired, Y as isSiweMessageNotYetValid, B as isSubscriptionActive, _ as loginToComputeApi, $ as logoutFromComputeApi, V as parseSiweMessage, t as sanitizeString, u as sanitizeURL, w as sanitizeXURL, a6 as stripHexPrefix, r as validateAppID, v as validateAppName, x as validateCreateAppParams, ah as validateDeployParams, q as validateDescription, ac as validateFilePath, ae as validateImagePath, h as validateImageReference, l as validateInstanceTypeSKU, s as validateLogVisibility, y as validateLogsParams, m as validatePrivateKeyFormat, af as validateResourceUsageMonitoring, o as validateURL, aj as validateUpgradeParams, p as validateXURL } from './helpers-CEvhJz7f.cjs';
8
+ import { G as GasEstimate, ab as Logger, $ as PreparedDeploy, a6 as EnvironmentConfig, a4 as DeployResult, a0 as PreparedUpgrade, A as AppId } from './index-DeQzn_yM.cjs';
9
+ export { al as AlreadyActiveResponse, ac as AppProfile, ad as AppProfileResponse, a2 as AppRecord, a5 as BillingEnvironmentConfig, aq as CancelResponse, ao as CancelSuccessResponse, af as ChainID, ak as CheckoutCreatedResponse, ai as CreateSubscriptionOptions, aj as CreateSubscriptionResponse, N as DeployAppOpts, a3 as DeployOptions, at as DeployProgressCallback, au as DeployStep, aa as DockerImageConfig, E as EstimateGasOptions, X as ExecuteDeployResult, Y as ExecuteUpgradeResult, W as GasOpts, a9 as ImageDigestResult, a1 as LifecycleOpts, ap as NoActiveSubscriptionResponse, a8 as ParsedEnvironment, am as PaymentIssueResponse, T as PrepareDeployFromVerifiableBuildOpts, Q as PrepareDeployOpts, V as PrepareUpgradeFromVerifiableBuildOpts, R as PrepareUpgradeOpts, Z as PreparedDeployData, _ as PreparedUpgradeData, ae as ProductID, ar as ProductSubscriptionResponse, a7 as Release, av as SequentialDeployResult, an as SubscribeResponse, ah as SubscriptionLineItem, as as SubscriptionOpts, ag as SubscriptionStatus, O as UpgradeAppOpts, e as estimateTransactionGas, f as formatETH, g as getAllAppsByDeveloper, aw as getAppLatestReleaseBlockNumbers, ax as getBlockTimestamps, M as logVisibility, L as noopLogger } from './index-DeQzn_yM.cjs';
8
10
 
9
11
  interface SubmitBuildRequest {
10
12
  repoUrl: string;
@@ -102,10 +104,14 @@ declare class BadRequestError extends BuildError {
102
104
 
103
105
  /**
104
106
  * Build module entry point (verifiable builds + provenance)
107
+ *
108
+ * Accepts viem's WalletClient which abstracts over both local accounts
109
+ * (privateKeyToAccount) and external signers (MetaMask, etc.).
105
110
  */
106
111
 
107
112
  interface BuildModuleConfig {
108
- privateKey?: string;
113
+ /** Wallet client for signing requests (optional - only needed for authenticated endpoints) */
114
+ walletClient?: WalletClient;
109
115
  environment?: string;
110
116
  verbose?: boolean;
111
117
  clientId?: string;
@@ -138,309 +144,6 @@ interface BuildModule {
138
144
  }
139
145
  declare function createBuildModule(config: BuildModuleConfig): BuildModule;
140
146
 
141
- /**
142
- * Non-interactive validation utilities for SDK
143
- *
144
- * These functions validate parameters without any interactive prompts.
145
- * They either return the validated value or throw an error.
146
- */
147
-
148
- /**
149
- * Validate app name format
150
- * @throws Error if name is invalid
151
- */
152
- declare function validateAppName(name: string): void;
153
- /**
154
- * Validate Docker image reference format
155
- * @returns true if valid, error message string if invalid
156
- */
157
- declare function validateImageReference(value: string): true | string;
158
- /**
159
- * Validate image reference and throw if invalid
160
- * @throws Error if image reference is invalid
161
- */
162
- declare function assertValidImageReference(value: string): void;
163
- /**
164
- * Extract app name from image reference
165
- */
166
- declare function extractAppNameFromImage(imageRef: string): string;
167
- /**
168
- * Validate that a file path exists
169
- * @returns true if valid, error message string if invalid
170
- */
171
- declare function validateFilePath(value: string): true | string;
172
- /**
173
- * Validate file path and throw if invalid
174
- * @throws Error if file path is invalid or doesn't exist
175
- */
176
- declare function assertValidFilePath(value: string): void;
177
- /**
178
- * Validate instance type SKU against available types
179
- * @returns the validated SKU
180
- * @throws Error if SKU is not in the available types list
181
- */
182
- declare function validateInstanceTypeSKU(sku: string, availableTypes: Array<{
183
- sku: string;
184
- }>): string;
185
- /**
186
- * Validate private key format
187
- * Matches Go's common.ValidatePrivateKey() function
188
- */
189
- declare function validatePrivateKeyFormat(key: string): boolean;
190
- /**
191
- * Validate private key and throw if invalid
192
- * @throws Error if private key format is invalid
193
- */
194
- declare function assertValidPrivateKey(key: string): void;
195
- /**
196
- * Validate URL format
197
- * @returns undefined if valid, error message string if invalid
198
- */
199
- declare function validateURL(rawURL: string): string | undefined;
200
- /**
201
- * Validate X/Twitter URL format
202
- * @returns undefined if valid, error message string if invalid
203
- */
204
- declare function validateXURL(rawURL: string): string | undefined;
205
- /**
206
- * Validate description length
207
- * @returns undefined if valid, error message string if invalid
208
- */
209
- declare function validateDescription(description: string): string | undefined;
210
- /**
211
- * Validate image file path
212
- * @returns undefined if valid, error message string if invalid
213
- */
214
- declare function validateImagePath(filePath: string): string | undefined;
215
- /**
216
- * Validate and normalize app ID address
217
- * @param appID - App ID (must be a valid address)
218
- * @returns Normalized app address
219
- * @throws Error if app ID is not a valid address
220
- *
221
- * Note: Name resolution should be handled by CLI before calling SDK functions.
222
- * The SDK only accepts resolved addresses.
223
- */
224
- declare function validateAppID(appID: string | Address): Address;
225
- type LogVisibility = "public" | "private" | "off";
226
- /**
227
- * Validate and convert log visibility setting to internal format
228
- * @param logVisibility - Log visibility setting
229
- * @returns Object with logRedirect and publicLogs settings
230
- * @throws Error if log visibility value is invalid
231
- */
232
- declare function validateLogVisibility(logVisibility: LogVisibility): {
233
- logRedirect: string;
234
- publicLogs: boolean;
235
- };
236
- type ResourceUsageMonitoring = "enable" | "disable";
237
- /**
238
- * Validate and convert resource usage monitoring setting to internal format
239
- * @param resourceUsageMonitoring - Resource usage monitoring setting
240
- * @returns The resourceUsageAllow value for the Dockerfile label ("always" or "never")
241
- * @throws Error if resource usage monitoring value is invalid
242
- */
243
- declare function validateResourceUsageMonitoring(resourceUsageMonitoring: ResourceUsageMonitoring | undefined): string;
244
- /**
245
- * Sanitize string (HTML escape and trim)
246
- */
247
- declare function sanitizeString(s: string): string;
248
- /**
249
- * Sanitize URL (add https:// if missing, validate)
250
- * @throws Error if URL is invalid after sanitization
251
- */
252
- declare function sanitizeURL(rawURL: string): string;
253
- /**
254
- * Sanitize X/Twitter URL (handle username-only input, normalize)
255
- * @throws Error if URL is invalid after sanitization
256
- */
257
- declare function sanitizeXURL(rawURL: string): string;
258
- interface DeployParams {
259
- dockerfilePath?: string;
260
- imageRef?: string;
261
- appName: string;
262
- envFilePath?: string;
263
- instanceType: string;
264
- logVisibility: LogVisibility;
265
- }
266
- /**
267
- * Validate deploy parameters
268
- * @throws Error if required parameters are missing or invalid
269
- */
270
- declare function validateDeployParams(params: Partial<DeployParams>): void;
271
- interface UpgradeParams {
272
- appID: string | Address;
273
- dockerfilePath?: string;
274
- imageRef?: string;
275
- envFilePath?: string;
276
- instanceType: string;
277
- logVisibility: LogVisibility;
278
- }
279
- /**
280
- * Validate upgrade parameters
281
- * @throws Error if required parameters are missing or invalid
282
- */
283
- declare function validateUpgradeParams(params: Partial<UpgradeParams>): void;
284
- interface CreateAppParams {
285
- name: string;
286
- language: string;
287
- template?: string;
288
- templateVersion?: string;
289
- }
290
- /**
291
- * Validate create app parameters
292
- * @throws Error if required parameters are missing or invalid
293
- */
294
- declare function validateCreateAppParams(params: Partial<CreateAppParams>): void;
295
- interface LogsParams {
296
- appID: string | Address;
297
- watch?: boolean;
298
- }
299
- /**
300
- * Validate logs parameters
301
- * @throws Error if required parameters are missing or invalid
302
- */
303
- declare function validateLogsParams(params: Partial<LogsParams>): void;
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): Hex;
439
- /**
440
- * Remove 0x prefix from hex string if present
441
- */
442
- declare function stripHexPrefix(value: string): string;
443
-
444
147
  /**
445
148
  * Main deploy function
446
149
  *
@@ -453,12 +156,15 @@ declare function stripHexPrefix(value: string): string;
453
156
 
454
157
  /**
455
158
  * Required deploy options for SDK (non-interactive)
159
+ *
160
+ * Accepts viem's WalletClient and PublicClient for transaction signing.
161
+ * The caller is responsible for creating these clients (e.g., from a private key).
456
162
  */
457
163
  interface SDKDeployOptions {
458
- /** Private key for signing transactions (hex string with or without 0x prefix) */
459
- privateKey: string;
460
- /** RPC URL for blockchain connection - optional, uses environment default if not provided */
461
- rpcUrl?: string;
164
+ /** Wallet client for signing transactions */
165
+ walletClient: WalletClient;
166
+ /** Public client for reading blockchain state */
167
+ publicClient: PublicClient;
462
168
  /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
463
169
  environment?: string;
464
170
  /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
@@ -475,11 +181,8 @@ interface SDKDeployOptions {
475
181
  logVisibility: LogVisibility;
476
182
  /** Resource usage monitoring setting - optional, defaults to 'enable' */
477
183
  resourceUsageMonitoring?: ResourceUsageMonitoring;
478
- /** Optional gas params from estimation */
479
- gas?: {
480
- maxFeePerGas?: bigint;
481
- maxPriorityFeePerGas?: bigint;
482
- };
184
+ /** Optional gas params from estimation (use result from prepareDeploy) */
185
+ gas?: GasEstimate;
483
186
  /** Skip telemetry (used when called from CLI) - optional */
484
187
  skipTelemetry?: boolean;
485
188
  }
@@ -500,13 +203,40 @@ interface ExecuteDeployOptions {
500
203
  publicClient: PublicClient;
501
204
  environmentConfig: EnvironmentConfig;
502
205
  };
503
- gas?: {
504
- maxFeePerGas?: bigint;
505
- maxPriorityFeePerGas?: bigint;
506
- };
206
+ gas?: GasEstimate;
507
207
  logger?: Logger;
508
208
  skipTelemetry?: boolean;
509
209
  }
210
+ /**
211
+ * Options for verifiable build deployment
212
+ *
213
+ * Similar to SDKDeployOptions but uses a pre-built image with known digest
214
+ * instead of building from Dockerfile.
215
+ */
216
+ interface VerifiableBuildOptions {
217
+ /** Wallet client for signing transactions */
218
+ walletClient: WalletClient;
219
+ /** Public client for reading blockchain state */
220
+ publicClient: PublicClient;
221
+ /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
222
+ environment?: string;
223
+ /** Image reference (registry/path:tag) - required */
224
+ imageRef: string;
225
+ /** Image digest (sha256:...) - required */
226
+ imageDigest: string;
227
+ /** Path to .env file - optional */
228
+ envFilePath?: string;
229
+ /** App name - required */
230
+ appName: string;
231
+ /** Instance type SKU - required */
232
+ instanceType: string;
233
+ /** Log visibility setting - required */
234
+ logVisibility: LogVisibility;
235
+ /** Resource usage monitoring setting - optional, defaults to 'enable' */
236
+ resourceUsageMonitoring?: ResourceUsageMonitoring;
237
+ /** Skip telemetry (used when called from CLI) - optional */
238
+ skipTelemetry?: boolean;
239
+ }
510
240
  /**
511
241
  * Prepare a deployment from a pre-built image (already layered) without using Docker locally.
512
242
  *
@@ -519,11 +249,7 @@ interface ExecuteDeployOptions {
519
249
  * - Skips prepareRelease() image layering and digest extraction
520
250
  * - Uses provided imageDigest + derived registry name to construct the Release struct
521
251
  */
522
- declare function prepareDeployFromVerifiableBuild(options: Omit<SDKDeployOptions, "gas" | "dockerfilePath" | "imageRef"> & {
523
- imageRef: string;
524
- imageDigest: string;
525
- skipTelemetry?: boolean;
526
- }, logger?: Logger): Promise<PrepareDeployResult>;
252
+ declare function prepareDeployFromVerifiableBuild(options: VerifiableBuildOptions, logger?: Logger): Promise<PrepareDeployResult>;
527
253
  /**
528
254
  * Prepare deployment - does all work up to the transaction
529
255
  *
@@ -549,7 +275,7 @@ declare function executeDeploy(options: ExecuteDeployOptions): Promise<DeployRes
549
275
  * Call this after executeDeploy to wait for the app to be provisioned.
550
276
  * Can be called separately to allow for intermediate operations (e.g., profile upload).
551
277
  */
552
- declare function watchDeployment(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string, skipTelemetry?: boolean): Promise<string | undefined>;
278
+ declare function watchDeployment(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<string | undefined>;
553
279
 
554
280
  /**
555
281
  * Main upgrade function
@@ -567,10 +293,10 @@ declare function watchDeployment(appId: string, privateKey: string, rpcUrl: stri
567
293
  interface SDKUpgradeOptions {
568
294
  /** App ID to upgrade - required */
569
295
  appId: string | Address;
570
- /** Private key for signing transactions (hex string with or without 0x prefix) */
571
- privateKey: string;
572
- /** RPC URL for blockchain connection - optional, uses environment default if not provided */
573
- rpcUrl?: string;
296
+ /** Wallet client for signing transactions */
297
+ walletClient: WalletClient;
298
+ /** Public client for reading blockchain state */
299
+ publicClient: PublicClient;
574
300
  /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
575
301
  environment?: string;
576
302
  /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
@@ -585,11 +311,8 @@ interface SDKUpgradeOptions {
585
311
  logVisibility: LogVisibility;
586
312
  /** Resource usage monitoring setting - optional, defaults to 'enable' */
587
313
  resourceUsageMonitoring?: ResourceUsageMonitoring;
588
- /** Optional gas params from estimation */
589
- gas?: {
590
- maxFeePerGas?: bigint;
591
- maxPriorityFeePerGas?: bigint;
592
- };
314
+ /** Optional gas params from estimation (use result from prepareUpgrade) */
315
+ gas?: GasEstimate;
593
316
  /** Skip telemetry (used when called from CLI) - optional */
594
317
  skipTelemetry?: boolean;
595
318
  }
@@ -618,10 +341,7 @@ interface ExecuteUpgradeOptions {
618
341
  publicClient: PublicClient;
619
342
  environmentConfig: EnvironmentConfig;
620
343
  };
621
- gas?: {
622
- maxFeePerGas?: bigint;
623
- maxPriorityFeePerGas?: bigint;
624
- };
344
+ gas?: GasEstimate;
625
345
  logger?: Logger;
626
346
  skipTelemetry?: boolean;
627
347
  }
@@ -663,31 +383,7 @@ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<Upgrade
663
383
  * Call this after executeUpgrade to wait for the upgrade to finish.
664
384
  * Can be called separately to allow for intermediate operations.
665
385
  */
666
- declare function watchUpgrade(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string, skipTelemetry?: boolean): Promise<void>;
667
-
668
- /**
669
- * Environment configuration for different networks
670
- */
671
-
672
- /**
673
- * Get environment configuration
674
- */
675
- declare function getEnvironmentConfig(environment: string, chainID?: bigint): EnvironmentConfig;
676
- declare function getBuildType(): "dev" | "prod";
677
- /**
678
- * Get available environments based on build type
679
- * - dev: only "sepolia-dev"
680
- * - prod: "sepolia" and "mainnet-alpha"
681
- */
682
- declare function getAvailableEnvironments(): string[];
683
- /**
684
- * Check if an environment is available in the current build
685
- */
686
- declare function isEnvironmentAvailable(environment: string): boolean;
687
- /**
688
- * Check if environment is mainnet (chain ID 1)
689
- */
690
- declare function isMainnet(environmentConfig: EnvironmentConfig): boolean;
386
+ declare function watchUpgrade(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
691
387
 
692
388
  /**
693
389
  * OS Keyring Integration
@@ -798,20 +494,6 @@ declare function requirePrivateKey(options: {
798
494
  privateKey?: string;
799
495
  }): Promise<PrivateKeySource>;
800
496
 
801
- /**
802
- * Private Key Generation
803
- *
804
- * Generate new secp256k1 private keys for Ethereum
805
- */
806
- interface GeneratedKey {
807
- privateKey: string;
808
- address: string;
809
- }
810
- /**
811
- * Generate a new secp256k1 private key
812
- */
813
- declare function generateNewPrivateKey(): GeneratedKey;
814
-
815
497
  /**
816
498
  * Telemetry types
817
499
  */
@@ -1061,45 +743,18 @@ declare function getTemplate(catalog: TemplateCatalog, category: string, languag
1061
743
  */
1062
744
  declare function getCategoryDescriptions(catalog: TemplateCatalog, language: string): Record<string, string>;
1063
745
 
1064
- /**
1065
- * EIP-7702 transaction handling
1066
- *
1067
- * This module handles EIP-7702 delegation and batch execution
1068
- */
1069
-
1070
- type Execution = {
1071
- target: Address;
1072
- value: bigint;
1073
- callData: Hex;
1074
- };
1075
- /**
1076
- * Options for estimating batch gas
1077
- */
1078
- interface EstimateBatchGasOptions {
1079
- publicClient: PublicClient;
1080
- account: Address;
1081
- executions: Execution[];
1082
- }
1083
- /**
1084
- * Estimate gas cost for a batch transaction
1085
- *
1086
- * Use this to get cost estimate before prompting user for confirmation.
1087
- */
1088
- declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
1089
- /**
1090
- * Check if account is delegated to ERC-7702 delegator
1091
- */
1092
- declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
1093
-
1094
746
  /**
1095
747
  * Preflight checks
748
+ *
749
+ * Performs early validation of authentication and network connectivity.
750
+ * Accepts viem's WalletClient and PublicClient - the caller is responsible
751
+ * for creating these from a private key if needed.
1096
752
  */
1097
753
 
1098
754
  interface PreflightContext {
1099
- privateKey: string;
1100
- rpcUrl: string;
755
+ walletClient: WalletClient;
756
+ publicClient: PublicClient;
1101
757
  environmentConfig: EnvironmentConfig;
1102
- account: PrivateKeyAccount;
1103
758
  selfAddress: Address;
1104
759
  }
1105
760
 
@@ -1131,4 +786,4 @@ interface ECloudClient {
1131
786
  }
1132
787
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1133
788
 
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 };
789
+ export { type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, DeployResult, type ECloudClient, type Environment, EnvironmentConfig, ForbiddenError, GasEstimate, type LegacyKey, type LogChunk, LogVisibility, Logger, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, PreparedUpgrade, type PrivateKeySource, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addMetric, addMetricWithDimensions, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };