@layr-labs/ecloud-sdk 0.1.1 → 0.1.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.
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
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';
1
+ import { G as GasEstimate, C as ComputeModule } from './compute-BlUpqWKo.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-BlUpqWKo.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';
7
- import { Address, Hex, WalletClient, PublicClient, PrivateKeyAccount } from 'viem';
5
+ import { Address, WalletClient, PublicClient, Hex, PrivateKeyAccount } from 'viem';
6
+ import { L as Logger, P as PreparedDeploy, E as EnvironmentConfig, D as DeployResult, a as PreparedUpgrade, A as AppId, S as SubscriptionStatus } from './index-Fb_S-Cqk.cjs';
7
+ export { u as AlreadyActiveResponse, o as AppProfile, p as AppProfileResponse, j as AppRecord, B as BillingEnvironmentConfig, y as CancelResponse, x as CancelSuccessResponse, C as ChainID, t as CheckoutCreatedResponse, s as CreateSubscriptionResponse, b as DeployAppOpts, k as DeployOptions, n as DockerImageConfig, e as ExecuteDeployResult, f as ExecuteUpgradeResult, G as GasOpts, I as ImageDigestResult, i as LifecycleOpts, N as NoActiveSubscriptionResponse, m as ParsedEnvironment, v as PaymentIssueResponse, c as PrepareDeployOpts, d as PrepareUpgradeOpts, g as PreparedDeployData, h as PreparedUpgradeData, q as ProductID, z as ProductSubscriptionResponse, R as Release, w as SubscribeResponse, r as SubscriptionLineItem, F as SubscriptionOpts, U as UpgradeAppOpts, l as logVisibility } from './index-Fb_S-Cqk.cjs';
8
8
 
9
9
  /**
10
10
  * Non-interactive validation utilities for SDK
@@ -170,111 +170,6 @@ interface LogsParams {
170
170
  */
171
171
  declare function validateLogsParams(params: Partial<LogsParams>): void;
172
172
 
173
- /**
174
- * Contract interactions
175
- *
176
- * This module handles on-chain contract interactions using viem
177
- */
178
-
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;
193
- }
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;
204
- }
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;
228
- }>;
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;
235
- }
236
- /**
237
- * Prepared upgrade batch ready for gas estimation and execution
238
- */
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
- }
255
- /**
256
- * Get apps by creator (paginated)
257
- */
258
- interface AppConfig {
259
- release: any;
260
- status: number;
261
- }
262
- /**
263
- * Fetch all apps by a developer by auto-pagination
264
- */
265
- declare function getAllAppsByDeveloper(rpcUrl: string, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
266
- apps: Address[];
267
- appConfigs: AppConfig[];
268
- }>;
269
- /**
270
- * Get latest release block numbers for multiple apps
271
- */
272
- declare function getAppLatestReleaseBlockNumbers(rpcUrl: string, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
273
- /**
274
- * Get block timestamps for multiple block numbers
275
- */
276
- declare function getBlockTimestamps(rpcUrl: string, environmentConfig: EnvironmentConfig, blockNumbers: number[]): Promise<Map<number, number>>;
277
-
278
173
  /**
279
174
  * Main deploy function
280
175
  *
@@ -317,23 +212,6 @@ interface SDKDeployOptions {
317
212
  /** Skip telemetry (used when called from CLI) - optional */
318
213
  skipTelemetry?: boolean;
319
214
  }
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
- }
337
215
  /**
338
216
  * Result from prepareDeploy - includes prepared batch and gas estimate
339
217
  */
@@ -343,6 +221,21 @@ interface PrepareDeployResult {
343
221
  /** Gas estimate for the batch transaction */
344
222
  gasEstimate: GasEstimate;
345
223
  }
224
+ /** Options for executing a prepared deployment */
225
+ interface ExecuteDeployOptions {
226
+ prepared: PreparedDeploy;
227
+ context: {
228
+ walletClient: WalletClient;
229
+ publicClient: PublicClient;
230
+ environmentConfig: EnvironmentConfig;
231
+ };
232
+ gas?: {
233
+ maxFeePerGas?: bigint;
234
+ maxPriorityFeePerGas?: bigint;
235
+ };
236
+ logger?: Logger;
237
+ skipTelemetry?: boolean;
238
+ }
346
239
  /**
347
240
  * Prepare deployment - does all work up to the transaction
348
241
  *
@@ -361,10 +254,7 @@ declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas"> & {
361
254
  * Note: This only submits the on-chain transaction. Call watchDeployment separately
362
255
  * to wait for the app to be running.
363
256
  */
364
- declare function executeDeploy(prepared: PreparedDeploy, gas: {
365
- maxFeePerGas?: bigint;
366
- maxPriorityFeePerGas?: bigint;
367
- } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<DeployResult>;
257
+ declare function executeDeploy(options: ExecuteDeployOptions): Promise<DeployResult>;
368
258
  /**
369
259
  * Watch a deployment until the app is running
370
260
  *
@@ -417,28 +307,11 @@ interface SDKUpgradeOptions {
417
307
  }
418
308
  interface UpgradeResult {
419
309
  /** App ID (contract address) */
420
- appId: string;
310
+ appId: AppId;
421
311
  /** Final image reference */
422
312
  imageRef: string;
423
313
  /** Transaction hash */
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
- };
314
+ txHash: Hex;
442
315
  }
443
316
  /**
444
317
  * Result from prepareUpgrade - includes prepared batch and gas estimate
@@ -449,6 +322,21 @@ interface PrepareUpgradeResult {
449
322
  /** Gas estimate for the batch transaction */
450
323
  gasEstimate: GasEstimate;
451
324
  }
325
+ /** Options for executing a prepared upgrade */
326
+ interface ExecuteUpgradeOptions {
327
+ prepared: PreparedUpgrade;
328
+ context: {
329
+ walletClient: WalletClient;
330
+ publicClient: PublicClient;
331
+ environmentConfig: EnvironmentConfig;
332
+ };
333
+ gas?: {
334
+ maxFeePerGas?: bigint;
335
+ maxPriorityFeePerGas?: bigint;
336
+ };
337
+ logger?: Logger;
338
+ skipTelemetry?: boolean;
339
+ }
452
340
  /**
453
341
  * Prepare upgrade - does all work up to the transaction
454
342
  *
@@ -467,10 +355,7 @@ declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas"> & {
467
355
  * Note: This only submits the on-chain transaction. Call watchUpgrade separately
468
356
  * to wait for the upgrade to complete.
469
357
  */
470
- declare function executeUpgrade(prepared: PreparedUpgrade, gas: {
471
- maxFeePerGas?: bigint;
472
- maxPriorityFeePerGas?: bigint;
473
- } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<UpgradeResult>;
358
+ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<UpgradeResult>;
474
359
  /**
475
360
  * Watch an upgrade until it completes
476
361
  *
@@ -522,6 +407,7 @@ declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
522
407
  *
523
408
  * Uses a single key for all environments.
524
409
  */
410
+
525
411
  interface StoredKey {
526
412
  address: string;
527
413
  }
@@ -543,7 +429,7 @@ declare function storePrivateKey(privateKey: string): Promise<void>;
543
429
  * Note: Returns the single stored key for all environments.
544
430
  * The environment parameter is kept for API compatibility but is ignored.
545
431
  */
546
- declare function getPrivateKey(): Promise<`0x${string}` | null>;
432
+ declare function getPrivateKey(): Promise<Hex | null>;
547
433
  /**
548
434
  * Delete a private key from OS keyring
549
435
  * Returns true if deletion was successful, false otherwise
@@ -595,8 +481,9 @@ declare function getAddressFromPrivateKey(privateKey: string): string;
595
481
  * 2. Environment variable (ECLOUD_PRIVATE_KEY)
596
482
  * 3. OS keyring (stored via `ecloud auth login`)
597
483
  */
484
+
598
485
  interface PrivateKeySource {
599
- key: `0x${string}`;
486
+ key: Hex;
600
487
  source: string;
601
488
  }
602
489
  /**
@@ -1018,7 +905,7 @@ declare class UserApiClient {
1018
905
  type Environment = "sepolia" | "sepolia-dev" | "mainnet-alpha";
1019
906
  interface ClientConfig {
1020
907
  verbose: boolean;
1021
- privateKey: `0x${string}`;
908
+ privateKey: Hex;
1022
909
  environment: Environment | string;
1023
910
  rpcUrl?: string;
1024
911
  }
@@ -1028,4 +915,4 @@ interface ECloudClient {
1028
915
  }
1029
916
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1030
917
 
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 };
918
+ export { type AppEnvironment, AppId, type AppInfo, type AppMetrics, type AppProfileInfo, BillingModule, type ClientConfig, ComputeModule, type CreateAppParams, type DeployParams, DeployResult, type ECloudClient, type Environment, EnvironmentConfig, type EstimateBatchGasOptions, GasEstimate, type GeneratedKey, type LegacyKey, type LogVisibility, Logger, type LogsParams, type Metric, type MetricsContext, NoopClient, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, 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, 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, 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 };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { C as ComputeModule } from './compute-gpepEsn3.js';
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-gpepEsn3.js';
1
+ import { G as GasEstimate, C as ComputeModule } from './compute-CottWiST.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-CottWiST.js';
3
3
  import { BillingModule } from './billing.js';
4
4
  export { BillingModuleConfig, createBillingModule } from './billing.js';
5
- import { E as EnvironmentConfig, L as Logger, D as DeployResult, S as SubscriptionStatus } from './index-D-SUX3IG.js';
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.js';
7
- import { Address, Hex, WalletClient, PublicClient, PrivateKeyAccount } from 'viem';
5
+ import { Address, WalletClient, PublicClient, Hex, PrivateKeyAccount } from 'viem';
6
+ import { L as Logger, P as PreparedDeploy, E as EnvironmentConfig, D as DeployResult, a as PreparedUpgrade, A as AppId, S as SubscriptionStatus } from './index-Fb_S-Cqk.js';
7
+ export { u as AlreadyActiveResponse, o as AppProfile, p as AppProfileResponse, j as AppRecord, B as BillingEnvironmentConfig, y as CancelResponse, x as CancelSuccessResponse, C as ChainID, t as CheckoutCreatedResponse, s as CreateSubscriptionResponse, b as DeployAppOpts, k as DeployOptions, n as DockerImageConfig, e as ExecuteDeployResult, f as ExecuteUpgradeResult, G as GasOpts, I as ImageDigestResult, i as LifecycleOpts, N as NoActiveSubscriptionResponse, m as ParsedEnvironment, v as PaymentIssueResponse, c as PrepareDeployOpts, d as PrepareUpgradeOpts, g as PreparedDeployData, h as PreparedUpgradeData, q as ProductID, z as ProductSubscriptionResponse, R as Release, w as SubscribeResponse, r as SubscriptionLineItem, F as SubscriptionOpts, U as UpgradeAppOpts, l as logVisibility } from './index-Fb_S-Cqk.js';
8
8
 
9
9
  /**
10
10
  * Non-interactive validation utilities for SDK
@@ -170,111 +170,6 @@ interface LogsParams {
170
170
  */
171
171
  declare function validateLogsParams(params: Partial<LogsParams>): void;
172
172
 
173
- /**
174
- * Contract interactions
175
- *
176
- * This module handles on-chain contract interactions using viem
177
- */
178
-
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;
193
- }
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;
204
- }
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;
228
- }>;
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;
235
- }
236
- /**
237
- * Prepared upgrade batch ready for gas estimation and execution
238
- */
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
- }
255
- /**
256
- * Get apps by creator (paginated)
257
- */
258
- interface AppConfig {
259
- release: any;
260
- status: number;
261
- }
262
- /**
263
- * Fetch all apps by a developer by auto-pagination
264
- */
265
- declare function getAllAppsByDeveloper(rpcUrl: string, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
266
- apps: Address[];
267
- appConfigs: AppConfig[];
268
- }>;
269
- /**
270
- * Get latest release block numbers for multiple apps
271
- */
272
- declare function getAppLatestReleaseBlockNumbers(rpcUrl: string, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
273
- /**
274
- * Get block timestamps for multiple block numbers
275
- */
276
- declare function getBlockTimestamps(rpcUrl: string, environmentConfig: EnvironmentConfig, blockNumbers: number[]): Promise<Map<number, number>>;
277
-
278
173
  /**
279
174
  * Main deploy function
280
175
  *
@@ -317,23 +212,6 @@ interface SDKDeployOptions {
317
212
  /** Skip telemetry (used when called from CLI) - optional */
318
213
  skipTelemetry?: boolean;
319
214
  }
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
- }
337
215
  /**
338
216
  * Result from prepareDeploy - includes prepared batch and gas estimate
339
217
  */
@@ -343,6 +221,21 @@ interface PrepareDeployResult {
343
221
  /** Gas estimate for the batch transaction */
344
222
  gasEstimate: GasEstimate;
345
223
  }
224
+ /** Options for executing a prepared deployment */
225
+ interface ExecuteDeployOptions {
226
+ prepared: PreparedDeploy;
227
+ context: {
228
+ walletClient: WalletClient;
229
+ publicClient: PublicClient;
230
+ environmentConfig: EnvironmentConfig;
231
+ };
232
+ gas?: {
233
+ maxFeePerGas?: bigint;
234
+ maxPriorityFeePerGas?: bigint;
235
+ };
236
+ logger?: Logger;
237
+ skipTelemetry?: boolean;
238
+ }
346
239
  /**
347
240
  * Prepare deployment - does all work up to the transaction
348
241
  *
@@ -361,10 +254,7 @@ declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas"> & {
361
254
  * Note: This only submits the on-chain transaction. Call watchDeployment separately
362
255
  * to wait for the app to be running.
363
256
  */
364
- declare function executeDeploy(prepared: PreparedDeploy, gas: {
365
- maxFeePerGas?: bigint;
366
- maxPriorityFeePerGas?: bigint;
367
- } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<DeployResult>;
257
+ declare function executeDeploy(options: ExecuteDeployOptions): Promise<DeployResult>;
368
258
  /**
369
259
  * Watch a deployment until the app is running
370
260
  *
@@ -417,28 +307,11 @@ interface SDKUpgradeOptions {
417
307
  }
418
308
  interface UpgradeResult {
419
309
  /** App ID (contract address) */
420
- appId: string;
310
+ appId: AppId;
421
311
  /** Final image reference */
422
312
  imageRef: string;
423
313
  /** Transaction hash */
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
- };
314
+ txHash: Hex;
442
315
  }
443
316
  /**
444
317
  * Result from prepareUpgrade - includes prepared batch and gas estimate
@@ -449,6 +322,21 @@ interface PrepareUpgradeResult {
449
322
  /** Gas estimate for the batch transaction */
450
323
  gasEstimate: GasEstimate;
451
324
  }
325
+ /** Options for executing a prepared upgrade */
326
+ interface ExecuteUpgradeOptions {
327
+ prepared: PreparedUpgrade;
328
+ context: {
329
+ walletClient: WalletClient;
330
+ publicClient: PublicClient;
331
+ environmentConfig: EnvironmentConfig;
332
+ };
333
+ gas?: {
334
+ maxFeePerGas?: bigint;
335
+ maxPriorityFeePerGas?: bigint;
336
+ };
337
+ logger?: Logger;
338
+ skipTelemetry?: boolean;
339
+ }
452
340
  /**
453
341
  * Prepare upgrade - does all work up to the transaction
454
342
  *
@@ -467,10 +355,7 @@ declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas"> & {
467
355
  * Note: This only submits the on-chain transaction. Call watchUpgrade separately
468
356
  * to wait for the upgrade to complete.
469
357
  */
470
- declare function executeUpgrade(prepared: PreparedUpgrade, gas: {
471
- maxFeePerGas?: bigint;
472
- maxPriorityFeePerGas?: bigint;
473
- } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<UpgradeResult>;
358
+ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<UpgradeResult>;
474
359
  /**
475
360
  * Watch an upgrade until it completes
476
361
  *
@@ -522,6 +407,7 @@ declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
522
407
  *
523
408
  * Uses a single key for all environments.
524
409
  */
410
+
525
411
  interface StoredKey {
526
412
  address: string;
527
413
  }
@@ -543,7 +429,7 @@ declare function storePrivateKey(privateKey: string): Promise<void>;
543
429
  * Note: Returns the single stored key for all environments.
544
430
  * The environment parameter is kept for API compatibility but is ignored.
545
431
  */
546
- declare function getPrivateKey(): Promise<`0x${string}` | null>;
432
+ declare function getPrivateKey(): Promise<Hex | null>;
547
433
  /**
548
434
  * Delete a private key from OS keyring
549
435
  * Returns true if deletion was successful, false otherwise
@@ -595,8 +481,9 @@ declare function getAddressFromPrivateKey(privateKey: string): string;
595
481
  * 2. Environment variable (ECLOUD_PRIVATE_KEY)
596
482
  * 3. OS keyring (stored via `ecloud auth login`)
597
483
  */
484
+
598
485
  interface PrivateKeySource {
599
- key: `0x${string}`;
486
+ key: Hex;
600
487
  source: string;
601
488
  }
602
489
  /**
@@ -1018,7 +905,7 @@ declare class UserApiClient {
1018
905
  type Environment = "sepolia" | "sepolia-dev" | "mainnet-alpha";
1019
906
  interface ClientConfig {
1020
907
  verbose: boolean;
1021
- privateKey: `0x${string}`;
908
+ privateKey: Hex;
1022
909
  environment: Environment | string;
1023
910
  rpcUrl?: string;
1024
911
  }
@@ -1028,4 +915,4 @@ interface ECloudClient {
1028
915
  }
1029
916
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1030
917
 
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 };
918
+ export { type AppEnvironment, AppId, type AppInfo, type AppMetrics, type AppProfileInfo, BillingModule, type ClientConfig, ComputeModule, type CreateAppParams, type DeployParams, DeployResult, type ECloudClient, type Environment, EnvironmentConfig, type EstimateBatchGasOptions, GasEstimate, type GeneratedKey, type LegacyKey, type LogVisibility, Logger, type LogsParams, type Metric, type MetricsContext, NoopClient, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, 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, 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, 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 };
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  requirePrivateKey,
14
14
  storePrivateKey,
15
15
  validatePrivateKey
16
- } from "./chunk-XNWF467Z.js";
16
+ } from "./chunk-JRFZVVUB.js";
17
17
  import {
18
18
  PRIMARY_LANGUAGES,
19
19
  assertValidFilePath,
@@ -62,7 +62,7 @@ import {
62
62
  validateXURL,
63
63
  watchDeployment,
64
64
  watchUpgrade
65
- } from "./chunk-LUFEUEOG.js";
65
+ } from "./chunk-XDS4EF4J.js";
66
66
  import {
67
67
  NoopClient,
68
68
  PostHogClient,
@@ -84,7 +84,7 @@ import {
84
84
  isNoopClient,
85
85
  isSubscriptionActive,
86
86
  withSDKTelemetry
87
- } from "./chunk-73YDSHDG.js";
87
+ } from "./chunk-JLZOAV5R.js";
88
88
 
89
89
  // src/client/common/utils/instance.ts
90
90
  async function getCurrentInstanceType(preflightCtx, appID, logger, clientId) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client/common/utils/instance.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Instance type utilities\n */\n\nimport { Address } from \"viem\";\nimport { PreflightContext } from \"./preflight\";\nimport { Logger } from \"../types\";\nimport { UserApiClient } from \"./userapi\";\n\n/**\n * Get current instance type for an app (best-effort)\n * Returns empty string if unable to fetch (API unavailable, app info not ready, etc.).\n * This is used as a convenience default for the upgrade flow.\n */\nexport async function getCurrentInstanceType(\n preflightCtx: PreflightContext,\n appID: Address,\n logger: Logger,\n clientId?: string,\n): Promise<string> {\n try {\n const userApiClient = new UserApiClient(\n preflightCtx.environmentConfig,\n preflightCtx.privateKey,\n preflightCtx.rpcUrl,\n clientId,\n );\n\n const infos = await userApiClient.getInfos([appID], 1);\n if (infos.length === 0) {\n return \"\"; // No app info available yet\n }\n\n return infos[0].machineType || \"\";\n } catch (err: any) {\n logger.debug(`Failed to get current instance type: ${err.message}`);\n return \"\"; // API call failed, skip default\n }\n}\n","/**\n * Main SDK Client entry point\n */\n\nimport { createComputeModule, type ComputeModule } from \"./modules/compute\";\nimport {\n getEnvironmentConfig,\n isEnvironmentAvailable,\n getAvailableEnvironments,\n} from \"./common/config/environment\";\nimport { createBillingModule, type BillingModule } from \"./modules/billing\";\nimport { addHexPrefix } from \"./common/utils\";\n\n// Export all types\nexport * from \"./common/types\";\n\n// Export validation utilities (non-interactive)\nexport * from \"./common/utils/validation\";\n\n// Special case on createApp - we don't need the client to run it\nexport {\n createApp,\n CreateAppOpts,\n SDKCreateAppOpts,\n PRIMARY_LANGUAGES,\n getAvailableTemplates,\n} from \"./modules/compute/app/create\";\nexport { logs, LogsOptions, SDKLogsOptions } from \"./modules/compute/app/logs\";\nexport {\n SDKDeployOptions,\n prepareDeploy,\n executeDeploy,\n watchDeployment,\n type PreparedDeploy,\n type PrepareDeployResult,\n} from \"./modules/compute/app/deploy\";\nexport {\n SDKUpgradeOptions,\n prepareUpgrade,\n executeUpgrade,\n watchUpgrade,\n type PreparedUpgrade,\n type PrepareUpgradeResult,\n} from \"./modules/compute/app/upgrade\";\n\n// Export compute module for standalone use\nexport {\n createComputeModule,\n type ComputeModule,\n type ComputeModuleConfig,\n encodeStartAppData,\n encodeStopAppData,\n encodeTerminateAppData,\n} from \"./modules/compute\";\nexport {\n createBillingModule,\n type BillingModule,\n type BillingModuleConfig,\n} from \"./modules/billing\";\n\n// Export environment config utilities\nexport {\n getEnvironmentConfig,\n getAvailableEnvironments,\n isEnvironmentAvailable,\n getBuildType,\n isMainnet,\n} from \"./common/config/environment\";\nexport { isSubscriptionActive } from \"./common/utils/billing\";\n\n// Export auth utilities\nexport * from \"./common/auth\";\n\n// Export telemetry\nexport * from \"./common/telemetry\";\n\n// Export template catalog utilities for CLI\nexport {\n fetchTemplateCatalog,\n getTemplate,\n getCategoryDescriptions,\n} from \"./common/templates/catalog\";\n\n// Export contract utilities\nexport {\n getAllAppsByDeveloper,\n getAppLatestReleaseBlockNumbers,\n getBlockTimestamps,\n estimateTransactionGas,\n formatETH,\n type GasEstimate,\n type EstimateGasOptions,\n} from \"./common/contract/caller\";\n\n// Export batch gas estimation and delegation check\nexport {\n estimateBatchGas,\n checkERC7702Delegation,\n type EstimateBatchGasOptions,\n} from \"./common/contract/eip7702\";\n\n// Export instance type utilities\nexport { getCurrentInstanceType } from \"./common/utils/instance\";\n\n// Export user API client\nexport {\n UserApiClient,\n type AppInfo,\n type AppProfileInfo,\n type AppMetrics,\n} from \"./common/utils/userapi\";\n\nexport type Environment = \"sepolia\" | \"sepolia-dev\" | \"mainnet-alpha\";\n\nexport interface ClientConfig {\n verbose: boolean;\n privateKey: `0x${string}`;\n environment: Environment | string;\n rpcUrl?: string;\n}\n\nexport interface ECloudClient {\n compute: ComputeModule;\n billing: BillingModule;\n}\n\nexport function createECloudClient(cfg: ClientConfig): ECloudClient {\n cfg.privateKey = addHexPrefix(cfg.privateKey);\n\n // Validate environment is available in current build\n const environment = cfg.environment || \"sepolia\";\n if (!isEnvironmentAvailable(environment)) {\n throw new Error(\n `Environment \"${environment}\" is not available in this build type. ` +\n `Available environments: ${getAvailableEnvironments().join(\", \")}`,\n );\n }\n\n // Get environment config\n const environmentConfig = getEnvironmentConfig(environment);\n\n // Get rpc url from environment config or use provided rpc url\n let rpcUrl = cfg.rpcUrl;\n if (!rpcUrl) {\n rpcUrl = process.env.RPC_URL ?? environmentConfig.defaultRPCURL;\n }\n if (!rpcUrl) {\n throw new Error(\n `RPC URL is required. Provide via options.rpcUrl, RPC_URL env var, or ensure environment has default RPC URL`,\n );\n }\n\n return {\n compute: createComputeModule({\n rpcUrl,\n verbose: cfg.verbose,\n privateKey: cfg.privateKey,\n environment: cfg.environment,\n }),\n billing: createBillingModule({\n verbose: cfg.verbose,\n privateKey: cfg.privateKey,\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,eAAsB,uBACpB,cACA,OACA,QACA,UACiB;AACjB,MAAI;AACF,UAAM,gBAAgB,IAAI;AAAA,MACxB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,MACb;AAAA,IACF;AAEA,UAAM,QAAQ,MAAM,cAAc,SAAS,CAAC,KAAK,GAAG,CAAC;AACrD,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO;AAAA,IACT;AAEA,WAAO,MAAM,CAAC,EAAE,eAAe;AAAA,EACjC,SAAS,KAAU;AACjB,WAAO,MAAM,wCAAwC,IAAI,OAAO,EAAE;AAClE,WAAO;AAAA,EACT;AACF;;;ACwFO,SAAS,mBAAmB,KAAiC;AAClE,MAAI,aAAa,aAAa,IAAI,UAAU;AAG5C,QAAM,cAAc,IAAI,eAAe;AACvC,MAAI,CAAC,uBAAuB,WAAW,GAAG;AACxC,UAAM,IAAI;AAAA,MACR,gBAAgB,WAAW,kEACE,yBAAyB,EAAE,KAAK,IAAI,CAAC;AAAA,IACpE;AAAA,EACF;AAGA,QAAM,oBAAoB,qBAAqB,WAAW;AAG1D,MAAI,SAAS,IAAI;AACjB,MAAI,CAAC,QAAQ;AACX,aAAS,QAAQ,IAAI,WAAW,kBAAkB;AAAA,EACpD;AACA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS,oBAAoB;AAAA,MAC3B;AAAA,MACA,SAAS,IAAI;AAAA,MACb,YAAY,IAAI;AAAA,MAChB,aAAa,IAAI;AAAA,IACnB,CAAC;AAAA,IACD,SAAS,oBAAoB;AAAA,MAC3B,SAAS,IAAI;AAAA,MACb,YAAY,IAAI;AAAA,IAClB,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/client/common/utils/instance.ts","../src/client/index.ts"],"sourcesContent":["/**\n * Instance type utilities\n */\n\nimport { Address } from \"viem\";\nimport { PreflightContext } from \"./preflight\";\nimport { Logger } from \"../types\";\nimport { UserApiClient } from \"./userapi\";\n\n/**\n * Get current instance type for an app (best-effort)\n * Returns empty string if unable to fetch (API unavailable, app info not ready, etc.).\n * This is used as a convenience default for the upgrade flow.\n */\nexport async function getCurrentInstanceType(\n preflightCtx: PreflightContext,\n appID: Address,\n logger: Logger,\n clientId?: string,\n): Promise<string> {\n try {\n const userApiClient = new UserApiClient(\n preflightCtx.environmentConfig,\n preflightCtx.privateKey,\n preflightCtx.rpcUrl,\n clientId,\n );\n\n const infos = await userApiClient.getInfos([appID], 1);\n if (infos.length === 0) {\n return \"\"; // No app info available yet\n }\n\n return infos[0].machineType || \"\";\n } catch (err: any) {\n logger.debug(`Failed to get current instance type: ${err.message}`);\n return \"\"; // API call failed, skip default\n }\n}\n","/**\n * Main SDK Client entry point\n */\n\nimport { createComputeModule, type ComputeModule } from \"./modules/compute\";\nimport {\n getEnvironmentConfig,\n isEnvironmentAvailable,\n getAvailableEnvironments,\n} from \"./common/config/environment\";\nimport { createBillingModule, type BillingModule } from \"./modules/billing\";\nimport { addHexPrefix } from \"./common/utils\";\nimport { Hex } from \"viem\";\n\n// Export all types\nexport * from \"./common/types\";\n\n// Export validation utilities (non-interactive)\nexport * from \"./common/utils/validation\";\n\n// Special case on createApp - we don't need the client to run it\nexport {\n createApp,\n CreateAppOpts,\n SDKCreateAppOpts,\n PRIMARY_LANGUAGES,\n getAvailableTemplates,\n} from \"./modules/compute/app/create\";\nexport { logs, LogsOptions, SDKLogsOptions } from \"./modules/compute/app/logs\";\nexport {\n SDKDeployOptions,\n prepareDeploy,\n executeDeploy,\n watchDeployment,\n type PrepareDeployResult,\n} from \"./modules/compute/app/deploy\";\nexport {\n SDKUpgradeOptions,\n prepareUpgrade,\n executeUpgrade,\n watchUpgrade,\n type PrepareUpgradeResult,\n} from \"./modules/compute/app/upgrade\";\n\n// Export compute module for standalone use\nexport {\n createComputeModule,\n type ComputeModule,\n type ComputeModuleConfig,\n encodeStartAppData,\n encodeStopAppData,\n encodeTerminateAppData,\n} from \"./modules/compute\";\nexport {\n createBillingModule,\n type BillingModule,\n type BillingModuleConfig,\n} from \"./modules/billing\";\n\n// Export environment config utilities\nexport {\n getEnvironmentConfig,\n getAvailableEnvironments,\n isEnvironmentAvailable,\n getBuildType,\n isMainnet,\n} from \"./common/config/environment\";\nexport { isSubscriptionActive } from \"./common/utils/billing\";\n\n// Export auth utilities\nexport * from \"./common/auth\";\n\n// Export telemetry\nexport * from \"./common/telemetry\";\n\n// Export template catalog utilities for CLI\nexport {\n fetchTemplateCatalog,\n getTemplate,\n getCategoryDescriptions,\n} from \"./common/templates/catalog\";\n\n// Export contract utilities\nexport {\n getAllAppsByDeveloper,\n getAppLatestReleaseBlockNumbers,\n getBlockTimestamps,\n estimateTransactionGas,\n formatETH,\n type GasEstimate,\n type EstimateGasOptions,\n} from \"./common/contract/caller\";\n\n// Export batch gas estimation and delegation check\nexport {\n estimateBatchGas,\n checkERC7702Delegation,\n type EstimateBatchGasOptions,\n} from \"./common/contract/eip7702\";\n\n// Export instance type utilities\nexport { getCurrentInstanceType } from \"./common/utils/instance\";\n\n// Export user API client\nexport {\n UserApiClient,\n type AppInfo,\n type AppProfileInfo,\n type AppMetrics,\n} from \"./common/utils/userapi\";\n\nexport type Environment = \"sepolia\" | \"sepolia-dev\" | \"mainnet-alpha\";\n\nexport interface ClientConfig {\n verbose: boolean;\n privateKey: Hex;\n environment: Environment | string;\n rpcUrl?: string;\n}\n\nexport interface ECloudClient {\n compute: ComputeModule;\n billing: BillingModule;\n}\n\nexport function createECloudClient(cfg: ClientConfig): ECloudClient {\n cfg.privateKey = addHexPrefix(cfg.privateKey);\n\n // Validate environment is available in current build\n const environment = cfg.environment || \"sepolia\";\n if (!isEnvironmentAvailable(environment)) {\n throw new Error(\n `Environment \"${environment}\" is not available in this build type. ` +\n `Available environments: ${getAvailableEnvironments().join(\", \")}`,\n );\n }\n\n // Get environment config\n const environmentConfig = getEnvironmentConfig(environment);\n\n // Get rpc url from environment config or use provided rpc url\n let rpcUrl = cfg.rpcUrl;\n if (!rpcUrl) {\n rpcUrl = process.env.RPC_URL ?? environmentConfig.defaultRPCURL;\n }\n if (!rpcUrl) {\n throw new Error(\n `RPC URL is required. Provide via options.rpcUrl, RPC_URL env var, or ensure environment has default RPC URL`,\n );\n }\n\n return {\n compute: createComputeModule({\n rpcUrl,\n verbose: cfg.verbose,\n privateKey: cfg.privateKey,\n environment: cfg.environment,\n }),\n billing: createBillingModule({\n verbose: cfg.verbose,\n privateKey: cfg.privateKey,\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,eAAsB,uBACpB,cACA,OACA,QACA,UACiB;AACjB,MAAI;AACF,UAAM,gBAAgB,IAAI;AAAA,MACxB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,MACb;AAAA,IACF;AAEA,UAAM,QAAQ,MAAM,cAAc,SAAS,CAAC,KAAK,GAAG,CAAC;AACrD,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO;AAAA,IACT;AAEA,WAAO,MAAM,CAAC,EAAE,eAAe;AAAA,EACjC,SAAS,KAAU;AACjB,WAAO,MAAM,wCAAwC,IAAI,OAAO,EAAE;AAClE,WAAO;AAAA,EACT;AACF;;;ACuFO,SAAS,mBAAmB,KAAiC;AAClE,MAAI,aAAa,aAAa,IAAI,UAAU;AAG5C,QAAM,cAAc,IAAI,eAAe;AACvC,MAAI,CAAC,uBAAuB,WAAW,GAAG;AACxC,UAAM,IAAI;AAAA,MACR,gBAAgB,WAAW,kEACE,yBAAyB,EAAE,KAAK,IAAI,CAAC;AAAA,IACpE;AAAA,EACF;AAGA,QAAM,oBAAoB,qBAAqB,WAAW;AAG1D,MAAI,SAAS,IAAI;AACjB,MAAI,CAAC,QAAQ;AACX,aAAS,QAAQ,IAAI,WAAW,kBAAkB;AAAA,EACpD;AACA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS,oBAAoB;AAAA,MAC3B;AAAA,MACA,SAAS,IAAI;AAAA,MACb,YAAY,IAAI;AAAA,MAChB,aAAa,IAAI;AAAA,IACnB,CAAC;AAAA,IACD,SAAS,oBAAoB;AAAA,MAC3B,SAAS,IAAI;AAAA,MACb,YAAY,IAAI;AAAA,IAClB,CAAC;AAAA,EACH;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layr-labs/ecloud-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-dev",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup",
33
+ "build:dev": "BUILD_TYPE=dev tsup",
33
34
  "prepublishOnly": "cp ../../README.md .",
34
35
  "lint": "eslint .",
35
36
  "format": "prettier --check .",