@layr-labs/ecloud-sdk 0.1.0-dev.1 → 0.1.0-dev.3

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,391 +1,11 @@
1
+ import { C as ComputeModule } from './compute-B_ibIORD.cjs';
2
+ export { e as ComputeModuleConfig, a as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, b as SDKLogsOptions, c as createApp, d as createComputeModule, f as encodeStartAppData, h as encodeStopAppData, i as encodeTerminateAppData, g as getAvailableTemplates, l as logs } from './compute-B_ibIORD.cjs';
3
+ import { BillingModule } from './billing.cjs';
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';
1
7
  import { Address, Hex, WalletClient, PublicClient, PrivateKeyAccount } from 'viem';
2
8
 
3
- /**
4
- * Core types for ECloud SDK
5
- */
6
-
7
- type AppId = Address;
8
- type logVisibility = "public" | "private" | "off";
9
- interface DeployAppOpts {
10
- /** App name - required */
11
- name: string;
12
- /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
13
- dockerfile?: string;
14
- /** Path to .env file - optional */
15
- envFile?: string;
16
- /** Image reference (registry/path:tag) - either this or dockerfile is required */
17
- imageRef?: string;
18
- /** Instance type SKU - required */
19
- instanceType: string;
20
- /** Log visibility setting - required */
21
- logVisibility: logVisibility;
22
- /** Optional gas params from estimation */
23
- gas?: {
24
- maxFeePerGas?: bigint;
25
- maxPriorityFeePerGas?: bigint;
26
- };
27
- }
28
- interface UpgradeAppOpts {
29
- /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
30
- dockerfile?: string;
31
- /** Image reference (registry/path:tag) - either this or dockerfile is required */
32
- imageRef?: string;
33
- /** Path to .env file - optional */
34
- envFile?: string;
35
- /** Instance type SKU - required */
36
- instanceType: string;
37
- /** Log visibility setting - required */
38
- logVisibility: logVisibility;
39
- gas?: {
40
- maxFeePerGas?: bigint;
41
- maxPriorityFeePerGas?: bigint;
42
- };
43
- }
44
- interface LifecycleOpts {
45
- gas?: {
46
- maxFeePerGas?: bigint;
47
- maxPriorityFeePerGas?: bigint;
48
- };
49
- }
50
- interface AppRecord {
51
- id: AppId;
52
- owner: `0x${string}`;
53
- image: string;
54
- status: "starting" | "running" | "stopped" | "terminated";
55
- createdAt: number;
56
- lastUpdatedAt: number;
57
- }
58
- interface DeployOptions {
59
- /** Private key for signing transactions (hex string with or without 0x prefix) - optional, will prompt if not provided */
60
- privateKey?: string;
61
- /** RPC URL for blockchain connection - optional, uses environment default if not provided */
62
- rpcUrl?: string;
63
- /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - optional, defaults to 'sepolia' */
64
- environment?: string;
65
- /** Path to Dockerfile (if building from Dockerfile) */
66
- dockerfilePath?: string;
67
- /** Image reference (registry/path:tag) - optional, will prompt if not provided */
68
- imageRef?: string;
69
- /** Path to .env file - optional, will use .env if exists or prompt */
70
- envFilePath?: string;
71
- /** App name - optional, will prompt if not provided */
72
- appName?: string;
73
- /** Instance type - optional, will prompt if not provided */
74
- instanceType?: string;
75
- /** Log visibility setting - optional, will prompt if not provided */
76
- logVisibility?: logVisibility;
77
- }
78
- interface DeployResult {
79
- /** App ID (contract address) */
80
- appId: string;
81
- /** App name */
82
- appName: string;
83
- /** Final image reference */
84
- imageRef: string;
85
- /** IP address (if available) */
86
- ipAddress?: string;
87
- /** Transaction hash */
88
- txHash: `0x${string}`;
89
- }
90
- interface EnvironmentConfig {
91
- name: string;
92
- build: "dev" | "prod";
93
- chainID: bigint;
94
- appControllerAddress: string;
95
- permissionControllerAddress: string;
96
- erc7702DelegatorAddress: string;
97
- kmsServerURL: string;
98
- userApiServerURL: string;
99
- defaultRPCURL: string;
100
- }
101
- interface Release {
102
- rmsRelease: {
103
- artifacts: Array<{
104
- digest: Uint8Array;
105
- registry: string;
106
- }>;
107
- upgradeByTime: number;
108
- };
109
- publicEnv: Uint8Array;
110
- encryptedEnv: Uint8Array;
111
- }
112
- interface ParsedEnvironment {
113
- public: Record<string, string>;
114
- private: Record<string, string>;
115
- }
116
- interface ImageDigestResult {
117
- digest: Uint8Array;
118
- registry: string;
119
- platform: string;
120
- }
121
- interface DockerImageConfig {
122
- cmd: string[];
123
- entrypoint: string[];
124
- user: string;
125
- labels: Record<string, string>;
126
- }
127
- interface Logger {
128
- debug(message: string, ...args: any[]): void;
129
- info(message: string, ...args: any[]): void;
130
- warn(message: string, ...args: any[]): void;
131
- error(message: string, ...args: any[]): void;
132
- }
133
- /**
134
- * Profile information for an app
135
- */
136
- interface AppProfile {
137
- /** App name (required) */
138
- name: string;
139
- /** Website URL (optional) */
140
- website?: string;
141
- /** Description (optional) */
142
- description?: string;
143
- /** X (Twitter) URL (optional) */
144
- xURL?: string;
145
- /** Path to image file (optional) */
146
- imagePath?: string;
147
- }
148
- /**
149
- * Profile response from API
150
- */
151
- interface AppProfileResponse {
152
- name: string;
153
- website?: string;
154
- description?: string;
155
- xURL?: string;
156
- imageURL?: string;
157
- }
158
- type ProductID = "compute";
159
- type ChainID = "ethereum-mainnet" | "ethereum-sepolia";
160
- type SubscriptionStatus = "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused" | "inactive";
161
- interface SubscriptionLineItem {
162
- description: string;
163
- price: number;
164
- quantity: number;
165
- currency: string;
166
- subtotal: number;
167
- }
168
- interface CreateSubscriptionResponse {
169
- checkoutUrl: string;
170
- }
171
- interface CheckoutCreatedResponse {
172
- type: "checkout_created";
173
- checkoutUrl: string;
174
- }
175
- interface AlreadyActiveResponse {
176
- type: "already_active";
177
- status: SubscriptionStatus;
178
- }
179
- interface PaymentIssueResponse {
180
- type: "payment_issue";
181
- status: SubscriptionStatus;
182
- portalUrl?: string;
183
- }
184
- type SubscribeResponse = CheckoutCreatedResponse | AlreadyActiveResponse | PaymentIssueResponse;
185
- interface CancelSuccessResponse {
186
- type: "canceled";
187
- }
188
- interface NoActiveSubscriptionResponse {
189
- type: "no_active_subscription";
190
- status: SubscriptionStatus;
191
- }
192
- type CancelResponse = CancelSuccessResponse | NoActiveSubscriptionResponse;
193
- interface ProductSubscriptionResponse {
194
- productId: ProductID;
195
- subscriptionStatus: SubscriptionStatus;
196
- currentPeriodStart?: string;
197
- currentPeriodEnd?: string;
198
- lineItems?: SubscriptionLineItem[];
199
- upcomingInvoiceSubtotal?: number;
200
- upcomingInvoiceTotal?: number;
201
- creditsApplied?: number;
202
- remainingCredits?: number;
203
- nextCreditExpiry?: number;
204
- cancelAtPeriodEnd?: boolean;
205
- canceledAt?: string;
206
- portalUrl?: string;
207
- }
208
- interface SubscriptionOpts {
209
- productId?: ProductID;
210
- }
211
- interface BillingEnvironmentConfig {
212
- billingApiServerURL: string;
213
- }
214
- interface BillingEnvironmentConfig {
215
- billingApiServerURL: string;
216
- }
217
-
218
- /**
219
- * Create command
220
- *
221
- * Creates a new app project from a template
222
- *
223
- * NOTE: This SDK function is non-interactive. All required parameters must be
224
- * provided explicitly. Use the CLI for interactive parameter collection.
225
- */
226
-
227
- /**
228
- * Required create app options for SDK (non-interactive)
229
- */
230
- interface SDKCreateAppOpts {
231
- /** Project name - required */
232
- name: string;
233
- /** Programming language - required (typescript, golang, rust, python) */
234
- language: string;
235
- /** Template name/category (e.g., "minimal") or custom template URL - optional, defaults to first available */
236
- template?: string;
237
- /** Template version/ref - optional */
238
- templateVersion?: string;
239
- /** Verbose output - optional */
240
- verbose?: boolean;
241
- }
242
- /**
243
- * Legacy interface for backward compatibility
244
- * @deprecated Use SDKCreateAppOpts instead
245
- */
246
- interface CreateAppOpts {
247
- name?: string;
248
- language?: string;
249
- template?: string;
250
- templateVersion?: string;
251
- verbose?: boolean;
252
- }
253
- declare const PRIMARY_LANGUAGES: string[];
254
- /**
255
- * Get available template categories for a language
256
- */
257
- declare function getAvailableTemplates(language: string): Promise<Array<{
258
- name: string;
259
- description: string;
260
- }>>;
261
- /**
262
- * Create a new app project from template
263
- *
264
- * This function is non-interactive and requires all parameters to be provided explicitly.
265
- *
266
- * @param options - Required options including name and language
267
- * @param logger - Optional logger instance
268
- * @throws Error if required parameters are missing or invalid
269
- */
270
- declare function createApp(options: SDKCreateAppOpts | CreateAppOpts, logger?: Logger): Promise<void>;
271
-
272
- /**
273
- * Logs command
274
- *
275
- * View app logs with optional watch mode
276
- *
277
- * NOTE: This SDK function is non-interactive. All required parameters must be
278
- * provided explicitly. Use the CLI for interactive parameter collection.
279
- */
280
-
281
- /**
282
- * Required logs options for SDK (non-interactive)
283
- */
284
- interface SDKLogsOptions {
285
- /** App ID (address) or app name - required */
286
- appID: string | Address;
287
- /** Watch logs continuously - optional */
288
- watch?: boolean;
289
- /** Environment name - optional, defaults to 'sepolia' */
290
- environment?: string;
291
- /** Private key for authenticated requests - optional */
292
- privateKey?: string;
293
- /** RPC URL - optional, uses environment default */
294
- rpcUrl?: string;
295
- /** Client ID for API requests - optional */
296
- clientId?: string;
297
- }
298
- /**
299
- * Legacy interface for backward compatibility
300
- * @deprecated Use SDKLogsOptions instead
301
- */
302
- interface LogsOptions {
303
- appID?: string | Address;
304
- watch?: boolean;
305
- environment?: string;
306
- privateKey?: string;
307
- rpcUrl?: string;
308
- clientId?: string;
309
- }
310
- /**
311
- * View app logs
312
- *
313
- * This function is non-interactive and requires appID to be provided explicitly.
314
- *
315
- * @param options - Required options including appID
316
- * @param logger - Optional logger instance
317
- * @throws Error if appID is missing or invalid
318
- */
319
- declare function logs(options: SDKLogsOptions | LogsOptions, logger?: Logger): Promise<void>;
320
-
321
- /**
322
- * Main App namespace entry point
323
- */
324
-
325
- /**
326
- * Encode start app call data for gas estimation
327
- */
328
- declare function encodeStartAppData(appId: AppId): `0x${string}`;
329
- /**
330
- * Encode stop app call data for gas estimation
331
- */
332
- declare function encodeStopAppData(appId: AppId): `0x${string}`;
333
- /**
334
- * Encode terminate app call data for gas estimation
335
- */
336
- declare function encodeTerminateAppData(appId: AppId): `0x${string}`;
337
- interface AppModule {
338
- create: (opts: CreateAppOpts) => Promise<void>;
339
- deploy: (opts: DeployAppOpts) => Promise<{
340
- appId: AppId;
341
- tx: `0x${string}`;
342
- appName: string;
343
- imageRef: string;
344
- ipAddress?: string;
345
- }>;
346
- upgrade: (appId: AppId, opts: UpgradeAppOpts) => Promise<{
347
- tx: `0x${string}`;
348
- appId: string;
349
- imageRef: string;
350
- }>;
351
- logs: (opts: LogsOptions) => Promise<void>;
352
- start: (appId: AppId, opts?: LifecycleOpts) => Promise<{
353
- tx: `0x${string}` | false;
354
- }>;
355
- stop: (appId: AppId, opts?: LifecycleOpts) => Promise<{
356
- tx: `0x${string}` | false;
357
- }>;
358
- terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
359
- tx: `0x${string}` | false;
360
- }>;
361
- undelegate: () => Promise<{
362
- tx: `0x${string}` | false;
363
- }>;
364
- }
365
- interface AppModuleConfig {
366
- verbose?: boolean;
367
- privateKey: `0x${string}`;
368
- rpcUrl: string;
369
- environment: string;
370
- clientId?: string;
371
- }
372
- declare function createAppModule(ctx: AppModuleConfig): AppModule;
373
-
374
- /**
375
- * Main Billing namespace entry point
376
- */
377
-
378
- interface BillingModule {
379
- subscribe: (opts?: SubscriptionOpts) => Promise<SubscribeResponse>;
380
- getStatus: (opts?: SubscriptionOpts) => Promise<ProductSubscriptionResponse>;
381
- cancel: (opts?: SubscriptionOpts) => Promise<CancelResponse>;
382
- }
383
- interface BillingModuleConfig {
384
- verbose?: boolean;
385
- privateKey: Hex;
386
- }
387
- declare function createBillingModule(config: BillingModuleConfig): BillingModule;
388
-
389
9
  /**
390
10
  * Non-interactive validation utilities for SDK
391
11
  *
@@ -694,6 +314,8 @@ interface SDKDeployOptions {
694
314
  maxFeePerGas?: bigint;
695
315
  maxPriorityFeePerGas?: bigint;
696
316
  };
317
+ /** Skip telemetry (used when called from CLI) - optional */
318
+ skipTelemetry?: boolean;
697
319
  }
698
320
  /**
699
321
  * Prepared deployment ready for gas estimation and execution
@@ -729,7 +351,9 @@ interface PrepareDeployResult {
729
351
  * 2. Prompt user to confirm the cost
730
352
  * 3. Call executeDeploy with confirmed gas params
731
353
  */
732
- declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas">, logger?: Logger): Promise<PrepareDeployResult>;
354
+ declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas"> & {
355
+ skipTelemetry?: boolean;
356
+ }, logger?: Logger): Promise<PrepareDeployResult>;
733
357
  /**
734
358
  * Execute a prepared deployment
735
359
  *
@@ -740,14 +364,14 @@ declare function prepareDeploy(options: Omit<SDKDeployOptions, "gas">, logger?:
740
364
  declare function executeDeploy(prepared: PreparedDeploy, gas: {
741
365
  maxFeePerGas?: bigint;
742
366
  maxPriorityFeePerGas?: bigint;
743
- } | undefined, logger?: Logger): Promise<DeployResult>;
367
+ } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<DeployResult>;
744
368
  /**
745
369
  * Watch a deployment until the app is running
746
370
  *
747
371
  * Call this after executeDeploy to wait for the app to be provisioned.
748
372
  * Can be called separately to allow for intermediate operations (e.g., profile upload).
749
373
  */
750
- declare function watchDeployment(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string): Promise<string | undefined>;
374
+ declare function watchDeployment(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string, skipTelemetry?: boolean): Promise<string | undefined>;
751
375
 
752
376
  /**
753
377
  * Main upgrade function
@@ -788,6 +412,8 @@ interface SDKUpgradeOptions {
788
412
  maxFeePerGas?: bigint;
789
413
  maxPriorityFeePerGas?: bigint;
790
414
  };
415
+ /** Skip telemetry (used when called from CLI) - optional */
416
+ skipTelemetry?: boolean;
791
417
  }
792
418
  interface UpgradeResult {
793
419
  /** App ID (contract address) */
@@ -831,7 +457,9 @@ interface PrepareUpgradeResult {
831
457
  * 2. Prompt user to confirm the cost
832
458
  * 3. Call executeUpgrade with confirmed gas params
833
459
  */
834
- declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas">, logger?: Logger): Promise<PrepareUpgradeResult>;
460
+ declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas"> & {
461
+ skipTelemetry?: boolean;
462
+ }, logger?: Logger): Promise<PrepareUpgradeResult>;
835
463
  /**
836
464
  * Execute a prepared upgrade
837
465
  *
@@ -842,14 +470,14 @@ declare function prepareUpgrade(options: Omit<SDKUpgradeOptions, "gas">, logger?
842
470
  declare function executeUpgrade(prepared: PreparedUpgrade, gas: {
843
471
  maxFeePerGas?: bigint;
844
472
  maxPriorityFeePerGas?: bigint;
845
- } | undefined, logger?: Logger): Promise<UpgradeResult>;
473
+ } | undefined, logger?: Logger, skipTelemetry?: boolean): Promise<UpgradeResult>;
846
474
  /**
847
475
  * Watch an upgrade until it completes
848
476
  *
849
477
  * Call this after executeUpgrade to wait for the upgrade to finish.
850
478
  * Can be called separately to allow for intermediate operations.
851
479
  */
852
- declare function watchUpgrade(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string): Promise<void>;
480
+ declare function watchUpgrade(appId: string, privateKey: string, rpcUrl: string, environment: string, logger?: Logger, clientId?: string, skipTelemetry?: boolean): Promise<void>;
853
481
 
854
482
  /**
855
483
  * Environment configuration for different networks
@@ -1005,6 +633,222 @@ interface GeneratedKey {
1005
633
  */
1006
634
  declare function generateNewPrivateKey(): GeneratedKey;
1007
635
 
636
+ /**
637
+ * Telemetry types
638
+ */
639
+ /**
640
+ * Metric represents a single metric with its value and dimensions
641
+ */
642
+ interface Metric {
643
+ value: number;
644
+ name: string;
645
+ dimensions: Record<string, string>;
646
+ }
647
+ /**
648
+ * MetricsContext holds all metrics collected during command execution
649
+ */
650
+ interface MetricsContext {
651
+ startTime: Date;
652
+ metrics: Metric[];
653
+ properties: Record<string, string>;
654
+ }
655
+ /**
656
+ * AppEnvironment contains information about the application environment
657
+ */
658
+ interface AppEnvironment {
659
+ userUUID: string;
660
+ cliVersion?: string;
661
+ os?: string;
662
+ arch?: string;
663
+ }
664
+ /**
665
+ * TelemetryClient defines the interface for telemetry operations
666
+ */
667
+ interface TelemetryClient {
668
+ /**
669
+ * AddMetric emits a single metric
670
+ */
671
+ addMetric(metric: Metric): Promise<void>;
672
+ /**
673
+ * Close cleans up any resources
674
+ */
675
+ close(): Promise<void>;
676
+ }
677
+
678
+ /**
679
+ * MetricsContext management
680
+ */
681
+
682
+ /**
683
+ * Create a new metrics context
684
+ */
685
+ declare function createMetricsContext(): MetricsContext;
686
+ /**
687
+ * Add a metric to the context without dimensions
688
+ */
689
+ declare function addMetric(context: MetricsContext, name: string, value: number): void;
690
+ /**
691
+ * Add a metric to the context with dimensions
692
+ */
693
+ declare function addMetricWithDimensions(context: MetricsContext, name: string, value: number, dimensions: Record<string, string>): void;
694
+
695
+ /**
696
+ * No-op telemetry client implementation
697
+ */
698
+
699
+ /**
700
+ * NoopClient implements the TelemetryClient interface with no-op methods
701
+ */
702
+ declare class NoopClient implements TelemetryClient {
703
+ /**
704
+ * AddMetric implements the TelemetryClient interface
705
+ */
706
+ addMetric(_metric: Metric): Promise<void>;
707
+ /**
708
+ * Close implements the TelemetryClient interface
709
+ */
710
+ close(): Promise<void>;
711
+ }
712
+ /**
713
+ * Check if a client is a NoopClient
714
+ */
715
+ declare function isNoopClient(client: TelemetryClient): boolean;
716
+
717
+ /**
718
+ * PostHog telemetry client implementation
719
+ *
720
+ * Uses the official posthog-node library
721
+ */
722
+
723
+ /**
724
+ * PostHogClient implements the TelemetryClient interface using posthog-node
725
+ */
726
+ declare class PostHogClient implements TelemetryClient {
727
+ private readonly client;
728
+ private readonly namespace;
729
+ private readonly appEnvironment;
730
+ constructor(environment: AppEnvironment, namespace: string, apiKey: string, endpoint?: string);
731
+ /**
732
+ * AddMetric implements the TelemetryClient interface
733
+ */
734
+ addMetric(metric: Metric): Promise<void>;
735
+ /**
736
+ * Close implements the TelemetryClient interface
737
+ */
738
+ close(): Promise<void>;
739
+ }
740
+ /**
741
+ * Get PostHog API key from environment variable or build-time constant
742
+ */
743
+ declare function getPostHogAPIKey(): string | undefined;
744
+ /**
745
+ * Get PostHog endpoint from environment variable or default
746
+ */
747
+ declare function getPostHogEndpoint(): string;
748
+
749
+ /**
750
+ * Telemetry wrapper utilities for SDK functions
751
+ *
752
+ * Provides helpers to wrap SDK function execution with telemetry tracking
753
+ */
754
+ /**
755
+ * Options for telemetry wrapper
756
+ */
757
+ interface TelemetryWrapperOptions {
758
+ /**
759
+ * Function name for telemetry (e.g., "deploy", "upgrade", "createApp")
760
+ */
761
+ functionName: string;
762
+ /**
763
+ * Skip telemetry if true (used when called from CLI)
764
+ */
765
+ skipTelemetry?: boolean;
766
+ /**
767
+ * Additional properties to include in telemetry
768
+ */
769
+ properties?: Record<string, string>;
770
+ /**
771
+ * User UUID for identification (required if skipTelemetry is false)
772
+ * If not provided and telemetry is enabled, will generate a random UUID for this session
773
+ */
774
+ userUUID?: string;
775
+ /**
776
+ * Whether telemetry is enabled (defaults to true if not provided)
777
+ */
778
+ telemetryEnabled?: boolean;
779
+ /**
780
+ * PostHog API key (optional, will check environment variables if not provided)
781
+ */
782
+ apiKey?: string;
783
+ /**
784
+ * PostHog endpoint (optional, will use default if not provided)
785
+ */
786
+ endpoint?: string;
787
+ }
788
+ /**
789
+ * Wrap a function execution with telemetry
790
+ *
791
+ * @param options - Telemetry wrapper options
792
+ * @param action - The function to execute
793
+ * @returns The result of the action
794
+ */
795
+ declare function withSDKTelemetry<T>(options: TelemetryWrapperOptions, action: () => Promise<T>): Promise<T>;
796
+
797
+ /**
798
+ * Telemetry module for ECloud SDK and CLI
799
+ *
800
+ * Provides telemetry functionality matching the Go implementation.
801
+ * Supports both "ecloud-cli" and "ecloud-sdk" namespaces.
802
+ */
803
+
804
+ /**
805
+ * Options for creating a telemetry client
806
+ */
807
+ interface TelemetryClientOptions {
808
+ /**
809
+ * Whether telemetry is enabled (only enabled if explicitly set to true, defaults to disabled)
810
+ */
811
+ telemetryEnabled?: boolean;
812
+ /**
813
+ * PostHog API key (if not provided, will check environment variables)
814
+ */
815
+ apiKey?: string;
816
+ /**
817
+ * PostHog endpoint (if not provided, will use default)
818
+ */
819
+ endpoint?: string;
820
+ }
821
+ /**
822
+ * Create a telemetry client
823
+ *
824
+ * @param environment - Application environment information (must include userUUID)
825
+ * @param namespace - Namespace for telemetry events ("ecloud-cli" or "ecloud-sdk")
826
+ * @param options - Optional telemetry client options
827
+ * @returns TelemetryClient instance (NoopClient if telemetry is disabled or no API key)
828
+ */
829
+ declare function createTelemetryClient(environment: AppEnvironment, namespace: "ecloud-cli" | "ecloud-sdk", options?: TelemetryClientOptions): TelemetryClient;
830
+ /**
831
+ * Create an AppEnvironment from current system information
832
+ *
833
+ * @param userUUID - User UUID for identification (required - no I/O in SDK)
834
+ * @param cliVersion - Optional CLI version (for CLI usage)
835
+ * @param osOverride - Optional OS override (defaults to current platform)
836
+ * @param archOverride - Optional architecture override (defaults to current architecture)
837
+ * @returns AppEnvironment with user UUID, OS, and architecture
838
+ */
839
+ declare function createAppEnvironment(userUUID: string, cliVersion?: string, osOverride?: string, archOverride?: string): AppEnvironment;
840
+ /**
841
+ * Emit metrics from a metrics context
842
+ *
843
+ * @param client - Telemetry client to use
844
+ * @param context - Metrics context containing metrics to emit
845
+ * @returns Promise that resolves when all metrics are emitted
846
+ */
847
+ declare function emitMetrics(client: TelemetryClient, context: {
848
+ metrics: Metric[];
849
+ properties: Record<string, string>;
850
+ }): Promise<void>;
851
+
1008
852
  /**
1009
853
  * TemplateEntry represents a single template in the catalog
1010
854
  */
@@ -1064,6 +908,10 @@ interface EstimateBatchGasOptions {
1064
908
  * through EIP-7702 can have variable costs.
1065
909
  */
1066
910
  declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
911
+ /**
912
+ * Check if account is delegated to ERC-7702 delegator
913
+ */
914
+ declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
1067
915
 
1068
916
  /**
1069
917
  * Preflight checks
@@ -1175,9 +1023,9 @@ interface ClientConfig {
1175
1023
  rpcUrl?: string;
1176
1024
  }
1177
1025
  interface ECloudClient {
1178
- app: AppModule;
1026
+ compute: ComputeModule;
1179
1027
  billing: BillingModule;
1180
1028
  }
1181
1029
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
1182
1030
 
1183
- export { type AlreadyActiveResponse, type AppId, type AppInfo, type AppMetrics, type AppModuleConfig, type AppProfile, type AppProfileInfo, type AppProfileResponse, type AppRecord, type BillingEnvironmentConfig, type BillingModuleConfig, type CancelResponse, type CancelSuccessResponse, type ChainID, type CheckoutCreatedResponse, type ClientConfig, type CreateAppOpts, type CreateAppParams, type CreateSubscriptionResponse, type DeployAppOpts, type DeployOptions, type DeployParams, type DeployResult, type DockerImageConfig, type ECloudClient, type Environment, type EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type ImageDigestResult, type LegacyKey, type LifecycleOpts, type LogVisibility, type Logger, type LogsOptions, type LogsParams, type NoActiveSubscriptionResponse, PRIMARY_LANGUAGES, type ParsedEnvironment, type PaymentIssueResponse, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ProductID, type ProductSubscriptionResponse, type Release, type ResourceUsageMonitoring, type SDKCreateAppOpts, type SDKDeployOptions, type SDKLogsOptions, type SDKUpgradeOptions, type StoredKey, type SubscribeResponse, type SubscriptionLineItem, type SubscriptionOpts, type SubscriptionStatus, type UpgradeAppOpts, type UpgradeParams, UserApiClient, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, createApp, createAppModule, createBillingModule, createECloudClient, deleteLegacyPrivateKey, deletePrivateKey, encodeStartAppData, encodeStopAppData, encodeTerminateAppData, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getAvailableTemplates, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isSubscriptionActive, keyExists, listStoredKeys, type logVisibility, logs, 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 };
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 };