@layr-labs/ecloud-sdk 0.2.0 → 0.2.1-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.ts CHANGED
@@ -1,10 +1,12 @@
1
- import { G as GasEstimate, C as ComputeModule } from './compute-CF2HOXed.js';
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-CF2HOXed.js';
1
+ import { C as ComputeModule } from './compute-B85ikS78.js';
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-B85ikS78.js';
3
3
  import { BillingModule } from './billing.js';
4
4
  export { BillingModuleConfig, createBillingModule } from './billing.js';
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.js';
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.js';
5
+ import { WalletClient, Hex, Chain, PublicClient, Address } from 'viem';
6
+ import { B as BillingEnvironmentConfig, H as ProductID, M as CreateSubscriptionResponse, Y as ProductSubscriptionResponse, G as GasEstimate, z as Logger, r as PreparedDeploy, w as EnvironmentConfig, v as DeployResult, s as PreparedUpgrade, A as AppId } from './index-D5oW73Dx.js';
7
+ export { O as AlreadyActiveResponse, C as AppProfile, F as AppProfileResponse, t as AppRecord, X as CancelResponse, V as CancelSuccessResponse, J as ChainID, N as CheckoutCreatedResponse, D as DeployAppOpts, u as DeployOptions, y as DockerImageConfig, E as EstimateGasOptions, n as ExecuteDeployResult, o as ExecuteUpgradeResult, m as GasOpts, I as ImageDigestResult, L as LifecycleOpts, W as NoActiveSubscriptionResponse, x as ParsedEnvironment, Q as PaymentIssueResponse, j as PrepareDeployFromVerifiableBuildOpts, P as PrepareDeployOpts, k as PrepareUpgradeFromVerifiableBuildOpts, i as PrepareUpgradeOpts, p as PreparedDeployData, q as PreparedUpgradeData, R as Release, T as SubscribeResponse, K as SubscriptionLineItem, Z as SubscriptionOpts, S as SubscriptionStatus, U as UpgradeAppOpts, e as estimateTransactionGas, f as formatETH, g as getAllAppsByDeveloper, _ as getAppLatestReleaseBlockNumbers, $ as getBlockTimestamps, l as logVisibility } from './index-D5oW73Dx.js';
8
+ import { L as LogVisibility, R as ResourceUsageMonitoring } from './eip7702-CXCYfOnk.js';
9
+ export { A as AppInfo, B as AppMetrics, z as AppProfileInfo, J as AppRelease, K as AppReleaseBuild, M as AppResponse, C as CreateAppParams, S as DeployParams, F as EstimateBatchGasOptions, G as GeneratedKey, w as LogsParams, V as UpgradeParams, U as UserApiClient, O as assertValidFilePath, e as assertValidImageReference, k as assertValidPrivateKey, I as checkERC7702Delegation, E as estimateBatchGas, f as extractAppNameFromImage, y as generateNewPrivateKey, a as getAvailableEnvironments, H as getBillingEnvironmentConfig, b as getBuildType, g as getEnvironmentConfig, i as isEnvironmentAvailable, c as isMainnet, x as isSubscriptionActive, s as sanitizeString, q as sanitizeURL, r as sanitizeXURL, o as validateAppID, v as validateAppName, t as validateCreateAppParams, T as validateDeployParams, n as validateDescription, N as validateFilePath, P as validateImagePath, d as validateImageReference, h as validateInstanceTypeSKU, p as validateLogVisibility, u as validateLogsParams, j as validatePrivateKeyFormat, Q as validateResourceUsageMonitoring, l as validateURL, W as validateUpgradeParams, m as validateXURL } from './eip7702-CXCYfOnk.js';
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;
@@ -139,308 +145,85 @@ interface BuildModule {
139
145
  declare function createBuildModule(config: BuildModuleConfig): BuildModule;
140
146
 
141
147
  /**
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.
148
+ * General utility helpers
146
149
  */
147
150
 
148
151
  /**
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
152
+ * Get a viem Chain object from a chain ID.
153
+ * Supports mainnet (1) and sepolia (11155111), defaults to the fallback chain for unknown chains.
198
154
  */
199
- declare function validateURL(rawURL: string): string | undefined;
155
+ declare function getChainFromID(chainID: bigint, fallback?: Chain): Chain;
200
156
  /**
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
157
+ * Create viem clients from a private key
220
158
  *
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
159
+ * This is a convenience helper for CLI and server applications that have direct
160
+ * access to a private key. For browser applications using external wallets (MetaMask, etc.),
161
+ * create the WalletClient directly using viem's createWalletClient with a custom transport.
162
+ *
163
+ * @example
164
+ * // CLI usage with private key
165
+ * const { walletClient, publicClient } = createClients({
166
+ * privateKey: '0x...',
167
+ * rpcUrl: 'https://sepolia.infura.io/v3/...',
168
+ * chainId: 11155111n
169
+ * });
170
+ *
171
+ * @example
172
+ * // Browser usage with external wallet (create clients directly)
173
+ * const walletClient = createWalletClient({
174
+ * chain: sepolia,
175
+ * transport: custom(window.ethereum!)
176
+ * });
177
+ * const publicClient = createPublicClient({
178
+ * chain: sepolia,
179
+ * transport: custom(window.ethereum!)
180
+ * });
231
181
  */
232
- declare function validateLogVisibility(logVisibility: LogVisibility): {
233
- logRedirect: string;
234
- publicLogs: boolean;
182
+ declare function createClients(options: {
183
+ privateKey: string | Hex;
184
+ rpcUrl: string;
185
+ chainId: bigint;
186
+ }): {
187
+ walletClient: WalletClient;
188
+ publicClient: PublicClient;
235
189
  };
236
- type ResourceUsageMonitoring = "enable" | "disable";
237
190
  /**
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
191
+ * Ensure hex string has 0x prefix
282
192
  */
283
- declare function validateUpgradeParams(params: Partial<UpgradeParams>): void;
284
- interface CreateAppParams {
285
- name: string;
286
- language: string;
287
- template?: string;
288
- templateVersion?: string;
289
- }
193
+ declare function addHexPrefix(value: string): Hex;
290
194
  /**
291
- * Validate create app parameters
292
- * @throws Error if required parameters are missing or invalid
195
+ * Remove 0x prefix from hex string if present
293
196
  */
294
- declare function validateCreateAppParams(params: Partial<CreateAppParams>): void;
295
- interface LogsParams {
296
- appID: string | Address;
297
- watch?: boolean;
298
- }
197
+ declare function stripHexPrefix(value: string): string;
198
+
299
199
  /**
300
- * Validate logs parameters
301
- * @throws Error if required parameters are missing or invalid
200
+ * BillingAPI Client to manage product subscriptions
201
+ * Standalone client - does not depend on chain infrastructure
202
+ *
203
+ * Accepts viem's WalletClient which abstracts over both local accounts
204
+ * (privateKeyToAccount) and external signers (MetaMask, etc.).
302
205
  */
303
- declare function validateLogsParams(params: Partial<LogsParams>): void;
304
206
 
305
207
  /**
306
- * UserAPI Client to manage interactions with the coordinator
208
+ * BillingAPI Client for managing product subscriptions.
307
209
  */
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 {
210
+ declare class BillingApiClient {
373
211
  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[]>;
212
+ private readonly walletClient;
213
+ constructor(config: BillingEnvironmentConfig, walletClient: WalletClient);
379
214
  /**
380
- * Get app details from UserAPI (includes releases and build/provenance info when available).
381
- *
382
- * Endpoint: GET /apps/:appAddress
215
+ * Get the address of the connected wallet
383
216
  */
384
- getApp(appAddress: Address): Promise<AppResponse>;
217
+ get address(): Address;
218
+ createSubscription(productId?: ProductID): Promise<CreateSubscriptionResponse>;
219
+ getSubscription(productId?: ProductID): Promise<ProductSubscriptionResponse>;
220
+ cancelSubscription(productId?: ProductID): Promise<void>;
385
221
  /**
386
- * Get available SKUs (instance types) from UserAPI
222
+ * Make an authenticated request to the billing API
387
223
  */
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
224
  private makeAuthenticatedRequest;
416
- /**
417
- * Generate authentication headers for UserAPI requests
418
- */
419
- private generateAuthHeaders;
420
225
  }
421
226
 
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
227
  /**
445
228
  * Main deploy function
446
229
  *
@@ -453,12 +236,15 @@ declare function stripHexPrefix(value: string): string;
453
236
 
454
237
  /**
455
238
  * Required deploy options for SDK (non-interactive)
239
+ *
240
+ * Accepts viem's WalletClient and PublicClient for transaction signing.
241
+ * The caller is responsible for creating these clients (e.g., from a private key).
456
242
  */
457
243
  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;
244
+ /** Wallet client for signing transactions */
245
+ walletClient: WalletClient;
246
+ /** Public client for reading blockchain state */
247
+ publicClient: PublicClient;
462
248
  /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
463
249
  environment?: string;
464
250
  /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
@@ -475,11 +261,8 @@ interface SDKDeployOptions {
475
261
  logVisibility: LogVisibility;
476
262
  /** Resource usage monitoring setting - optional, defaults to 'enable' */
477
263
  resourceUsageMonitoring?: ResourceUsageMonitoring;
478
- /** Optional gas params from estimation */
479
- gas?: {
480
- maxFeePerGas?: bigint;
481
- maxPriorityFeePerGas?: bigint;
482
- };
264
+ /** Optional gas params from estimation (use result from prepareDeploy) */
265
+ gas?: GasEstimate;
483
266
  /** Skip telemetry (used when called from CLI) - optional */
484
267
  skipTelemetry?: boolean;
485
268
  }
@@ -500,13 +283,40 @@ interface ExecuteDeployOptions {
500
283
  publicClient: PublicClient;
501
284
  environmentConfig: EnvironmentConfig;
502
285
  };
503
- gas?: {
504
- maxFeePerGas?: bigint;
505
- maxPriorityFeePerGas?: bigint;
506
- };
286
+ gas?: GasEstimate;
507
287
  logger?: Logger;
508
288
  skipTelemetry?: boolean;
509
289
  }
290
+ /**
291
+ * Options for verifiable build deployment
292
+ *
293
+ * Similar to SDKDeployOptions but uses a pre-built image with known digest
294
+ * instead of building from Dockerfile.
295
+ */
296
+ interface VerifiableBuildOptions {
297
+ /** Wallet client for signing transactions */
298
+ walletClient: WalletClient;
299
+ /** Public client for reading blockchain state */
300
+ publicClient: PublicClient;
301
+ /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
302
+ environment?: string;
303
+ /** Image reference (registry/path:tag) - required */
304
+ imageRef: string;
305
+ /** Image digest (sha256:...) - required */
306
+ imageDigest: string;
307
+ /** Path to .env file - optional */
308
+ envFilePath?: string;
309
+ /** App name - required */
310
+ appName: string;
311
+ /** Instance type SKU - required */
312
+ instanceType: string;
313
+ /** Log visibility setting - required */
314
+ logVisibility: LogVisibility;
315
+ /** Resource usage monitoring setting - optional, defaults to 'enable' */
316
+ resourceUsageMonitoring?: ResourceUsageMonitoring;
317
+ /** Skip telemetry (used when called from CLI) - optional */
318
+ skipTelemetry?: boolean;
319
+ }
510
320
  /**
511
321
  * Prepare a deployment from a pre-built image (already layered) without using Docker locally.
512
322
  *
@@ -519,11 +329,7 @@ interface ExecuteDeployOptions {
519
329
  * - Skips prepareRelease() image layering and digest extraction
520
330
  * - Uses provided imageDigest + derived registry name to construct the Release struct
521
331
  */
522
- declare function prepareDeployFromVerifiableBuild(options: Omit<SDKDeployOptions, "gas" | "dockerfilePath" | "imageRef"> & {
523
- imageRef: string;
524
- imageDigest: string;
525
- skipTelemetry?: boolean;
526
- }, logger?: Logger): Promise<PrepareDeployResult>;
332
+ declare function prepareDeployFromVerifiableBuild(options: VerifiableBuildOptions, logger?: Logger): Promise<PrepareDeployResult>;
527
333
  /**
528
334
  * Prepare deployment - does all work up to the transaction
529
335
  *
@@ -549,7 +355,7 @@ declare function executeDeploy(options: ExecuteDeployOptions): Promise<DeployRes
549
355
  * Call this after executeDeploy to wait for the app to be provisioned.
550
356
  * Can be called separately to allow for intermediate operations (e.g., profile upload).
551
357
  */
552
- declare function watchDeployment(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string, skipTelemetry?: boolean): Promise<string | undefined>;
358
+ declare function watchDeployment(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<string | undefined>;
553
359
 
554
360
  /**
555
361
  * Main upgrade function
@@ -567,10 +373,10 @@ declare function watchDeployment(appId: string, privateKey: string, rpcUrl: stri
567
373
  interface SDKUpgradeOptions {
568
374
  /** App ID to upgrade - required */
569
375
  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;
376
+ /** Wallet client for signing transactions */
377
+ walletClient: WalletClient;
378
+ /** Public client for reading blockchain state */
379
+ publicClient: PublicClient;
574
380
  /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - defaults to 'sepolia' */
575
381
  environment?: string;
576
382
  /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
@@ -585,11 +391,8 @@ interface SDKUpgradeOptions {
585
391
  logVisibility: LogVisibility;
586
392
  /** Resource usage monitoring setting - optional, defaults to 'enable' */
587
393
  resourceUsageMonitoring?: ResourceUsageMonitoring;
588
- /** Optional gas params from estimation */
589
- gas?: {
590
- maxFeePerGas?: bigint;
591
- maxPriorityFeePerGas?: bigint;
592
- };
394
+ /** Optional gas params from estimation (use result from prepareUpgrade) */
395
+ gas?: GasEstimate;
593
396
  /** Skip telemetry (used when called from CLI) - optional */
594
397
  skipTelemetry?: boolean;
595
398
  }
@@ -618,10 +421,7 @@ interface ExecuteUpgradeOptions {
618
421
  publicClient: PublicClient;
619
422
  environmentConfig: EnvironmentConfig;
620
423
  };
621
- gas?: {
622
- maxFeePerGas?: bigint;
623
- maxPriorityFeePerGas?: bigint;
624
- };
424
+ gas?: GasEstimate;
625
425
  logger?: Logger;
626
426
  skipTelemetry?: boolean;
627
427
  }
@@ -663,31 +463,7 @@ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<Upgrade
663
463
  * Call this after executeUpgrade to wait for the upgrade to finish.
664
464
  * Can be called separately to allow for intermediate operations.
665
465
  */
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;
466
+ declare function watchUpgrade(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
691
467
 
692
468
  /**
693
469
  * OS Keyring Integration
@@ -798,20 +574,6 @@ declare function requirePrivateKey(options: {
798
574
  privateKey?: string;
799
575
  }): Promise<PrivateKeySource>;
800
576
 
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
577
  /**
816
578
  * Telemetry types
817
579
  */
@@ -1061,45 +823,18 @@ declare function getTemplate(catalog: TemplateCatalog, category: string, languag
1061
823
  */
1062
824
  declare function getCategoryDescriptions(catalog: TemplateCatalog, language: string): Record<string, string>;
1063
825
 
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
826
  /**
1095
827
  * Preflight checks
828
+ *
829
+ * Performs early validation of authentication and network connectivity.
830
+ * Accepts viem's WalletClient and PublicClient - the caller is responsible
831
+ * for creating these from a private key if needed.
1096
832
  */
1097
833
 
1098
834
  interface PreflightContext {
1099
- privateKey: string;
1100
- rpcUrl: string;
835
+ walletClient: WalletClient;
836
+ publicClient: PublicClient;
1101
837
  environmentConfig: EnvironmentConfig;
1102
- account: PrivateKeyAccount;
1103
838
  selfAddress: Address;
1104
839
  }
1105
840
 
@@ -1131,4 +866,4 @@ interface ECloudClient {
1131
866
  }
1132
867
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1133
868
 
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 };
869
+ export { type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingApiClient, BillingEnvironmentConfig, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, CreateSubscriptionResponse, 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, ProductID, ProductSubscriptionResponse, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addHexPrefix, addMetric, addMetricWithDimensions, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, createClients as createViemClients, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getChainFromID, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, stripHexPrefix, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };