@layr-labs/ecloud-sdk 0.2.0 → 0.2.2-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/VERSION +2 -2
  2. package/dist/billing.cjs +48 -43
  3. package/dist/billing.cjs.map +1 -1
  4. package/dist/billing.d.cts +6 -3
  5. package/dist/billing.d.ts +6 -3
  6. package/dist/billing.js +519 -4
  7. package/dist/billing.js.map +1 -1
  8. package/dist/browser.cjs +5034 -0
  9. package/dist/browser.cjs.map +1 -0
  10. package/dist/browser.d.cts +239 -0
  11. package/dist/browser.d.ts +239 -0
  12. package/dist/browser.js +4924 -0
  13. package/dist/browser.js.map +1 -0
  14. package/dist/{compute-CF2HOXed.d.ts → compute-BYhSs8en.d.ts} +15 -96
  15. package/dist/{compute-CbmjA8kJ.d.cts → compute-Bpjb3hYD.d.cts} +15 -96
  16. package/dist/compute.cjs +875 -846
  17. package/dist/compute.cjs.map +1 -1
  18. package/dist/compute.d.cts +2 -2
  19. package/dist/compute.d.ts +2 -2
  20. package/dist/compute.js +7009 -8
  21. package/dist/compute.js.map +1 -1
  22. package/dist/helpers-CEvhJz7f.d.cts +742 -0
  23. package/dist/helpers-CQuBwQnu.d.ts +742 -0
  24. package/dist/index-DeQzn_yM.d.cts +739 -0
  25. package/dist/index-DeQzn_yM.d.ts +739 -0
  26. package/dist/index.cjs +1958 -1758
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +69 -414
  29. package/dist/index.d.ts +69 -414
  30. package/dist/index.js +7977 -134
  31. package/dist/index.js.map +1 -1
  32. package/package.json +17 -2
  33. package/dist/chunk-CA5Y4OVI.js +0 -744
  34. package/dist/chunk-CA5Y4OVI.js.map +0 -1
  35. package/dist/chunk-ZDXN2WKP.js +0 -434
  36. package/dist/chunk-ZDXN2WKP.js.map +0 -1
  37. package/dist/chunk-ZTLKZMSW.js +0 -6719
  38. package/dist/chunk-ZTLKZMSW.js.map +0 -1
  39. package/dist/index-D2QufVB9.d.cts +0 -342
  40. package/dist/index-D2QufVB9.d.ts +0 -342
@@ -0,0 +1,739 @@
1
+ import { PublicClient, Address, Hex, WalletClient } from 'viem';
2
+
3
+ /**
4
+ * Contract interactions
5
+ *
6
+ * This module handles on-chain contract interactions using viem.
7
+ *
8
+ * Accepts viem's WalletClient and PublicClient directly, which abstract over both
9
+ * local accounts (privateKeyToAccount) and external signers (MetaMask, etc.).
10
+ *
11
+ * @example
12
+ * // CLI usage with private key
13
+ * const { walletClient, publicClient } = createClients({ privateKey, rpcUrl, chainId });
14
+ * await deployApp({ walletClient, publicClient, environmentConfig, ... }, logger);
15
+ *
16
+ * @example
17
+ * // Browser usage with external wallet
18
+ * const walletClient = createWalletClient({ chain, transport: custom(window.ethereum!) });
19
+ * const publicClient = createPublicClient({ chain, transport: custom(window.ethereum!) });
20
+ * await deployApp({ walletClient, publicClient, environmentConfig, ... }, logger);
21
+ */
22
+
23
+ /**
24
+ * Gas estimation result
25
+ */
26
+ interface GasEstimate {
27
+ /** Estimated gas limit for the transaction */
28
+ gasLimit: bigint;
29
+ /** Max fee per gas (EIP-1559) */
30
+ maxFeePerGas: bigint;
31
+ /** Max priority fee per gas (EIP-1559) */
32
+ maxPriorityFeePerGas: bigint;
33
+ /** Maximum cost in wei (gasLimit * maxFeePerGas) */
34
+ maxCostWei: bigint;
35
+ /** Maximum cost formatted as ETH string */
36
+ maxCostEth: string;
37
+ }
38
+ /**
39
+ * Options for estimating transaction gas
40
+ */
41
+ interface EstimateGasOptions {
42
+ publicClient: PublicClient;
43
+ from: Address;
44
+ to: Address;
45
+ data: Hex;
46
+ value?: bigint;
47
+ }
48
+ /**
49
+ * Format Wei to ETH string
50
+ */
51
+ declare function formatETH(wei: bigint): string;
52
+ /**
53
+ * Estimate gas cost for a transaction
54
+ *
55
+ * Use this to get cost estimate before prompting user for confirmation.
56
+ */
57
+ declare function estimateTransactionGas(options: EstimateGasOptions): Promise<GasEstimate>;
58
+ /**
59
+ * Deploy app options
60
+ */
61
+ interface DeployAppOptions {
62
+ walletClient: WalletClient;
63
+ publicClient: PublicClient;
64
+ environmentConfig: EnvironmentConfig;
65
+ salt: Uint8Array;
66
+ release: Release;
67
+ publicLogs: boolean;
68
+ imageRef: string;
69
+ gas?: GasEstimate;
70
+ }
71
+ /**
72
+ * Options for calculateAppID
73
+ */
74
+ interface CalculateAppIDOptions {
75
+ publicClient: PublicClient;
76
+ environmentConfig: EnvironmentConfig;
77
+ ownerAddress: Address;
78
+ salt: Uint8Array;
79
+ }
80
+ /**
81
+ * Prepared deploy batch ready for gas estimation and execution
82
+ */
83
+ interface PreparedDeployBatch {
84
+ /** The app ID that will be deployed */
85
+ appId: Address;
86
+ /** The salt used for deployment */
87
+ salt: Uint8Array;
88
+ /** Batch executions to be sent */
89
+ executions: Array<{
90
+ target: Address;
91
+ value: bigint;
92
+ callData: Hex;
93
+ }>;
94
+ /** Wallet client for sending transaction */
95
+ walletClient: WalletClient;
96
+ /** Public client for reading chain state */
97
+ publicClient: PublicClient;
98
+ /** Environment configuration */
99
+ environmentConfig: EnvironmentConfig;
100
+ }
101
+ /**
102
+ * Prepared upgrade batch ready for gas estimation and execution
103
+ */
104
+ interface PreparedUpgradeBatch {
105
+ /** The app ID being upgraded */
106
+ appId: Address;
107
+ /** Batch executions to be sent */
108
+ executions: Array<{
109
+ target: Address;
110
+ value: bigint;
111
+ callData: Hex;
112
+ }>;
113
+ /** Wallet client for sending transaction */
114
+ walletClient: WalletClient;
115
+ /** Public client for reading chain state */
116
+ publicClient: PublicClient;
117
+ /** Environment configuration */
118
+ environmentConfig: EnvironmentConfig;
119
+ }
120
+ /**
121
+ * Calculate app ID from owner address and salt
122
+ */
123
+ declare function calculateAppID(options: CalculateAppIDOptions): Promise<Address>;
124
+ /**
125
+ * Options for preparing a deploy batch
126
+ */
127
+ interface PrepareDeployBatchOptions {
128
+ walletClient: WalletClient;
129
+ publicClient: PublicClient;
130
+ environmentConfig: EnvironmentConfig;
131
+ salt: Uint8Array;
132
+ release: Release;
133
+ publicLogs: boolean;
134
+ imageRef: string;
135
+ }
136
+ /**
137
+ * Prepare deploy batch - creates executions without sending transaction
138
+ *
139
+ * Use this to get the prepared batch for gas estimation before executing.
140
+ */
141
+ declare function prepareDeployBatch(options: PrepareDeployBatchOptions, logger?: Logger): Promise<PreparedDeployBatch>;
142
+ /**
143
+ * Execute a prepared deploy batch
144
+ */
145
+ declare function executeDeployBatch(data: PreparedDeployData, context: {
146
+ walletClient: WalletClient;
147
+ publicClient: PublicClient;
148
+ environmentConfig: EnvironmentConfig;
149
+ }, gas?: GasEstimate, logger?: Logger): Promise<{
150
+ appId: Address;
151
+ txHash: Hex;
152
+ }>;
153
+ /**
154
+ * Deploy app on-chain (convenience wrapper that prepares and executes)
155
+ */
156
+ declare function deployApp(options: DeployAppOptions, logger?: Logger): Promise<{
157
+ appId: Address;
158
+ txHash: Hex;
159
+ }>;
160
+ /**
161
+ * Check if wallet account supports EIP-7702 signing
162
+ *
163
+ * Local accounts (from privateKeyToAccount) support signAuthorization.
164
+ * JSON-RPC accounts (browser wallets like MetaMask) do not.
165
+ */
166
+ declare function supportsEIP7702(walletClient: WalletClient): boolean;
167
+ /**
168
+ * Options for sequential deployment (non-EIP-7702)
169
+ */
170
+ interface ExecuteDeploySequentialOptions {
171
+ walletClient: WalletClient;
172
+ publicClient: PublicClient;
173
+ environmentConfig: EnvironmentConfig;
174
+ /** Prepared deployment data from prepareDeployBatch */
175
+ data: PreparedDeployData;
176
+ /** Whether to set public logs permission */
177
+ publicLogs: boolean;
178
+ /** Optional callback for progress updates */
179
+ onProgress?: DeployProgressCallback;
180
+ }
181
+ /**
182
+ * Execute deployment as sequential transactions (non-EIP-7702 fallback)
183
+ *
184
+ * Use this for browser wallets (JSON-RPC accounts) that don't support signAuthorization.
185
+ * This requires 2-3 wallet signatures instead of 1, but works with all wallet types.
186
+ *
187
+ * Steps:
188
+ * 1. createApp - Creates the app on-chain
189
+ * 2. acceptAdmin - Accepts admin role for the app
190
+ * 3. setAppointee (optional) - Sets public logs permission
191
+ */
192
+ declare function executeDeploySequential(options: ExecuteDeploySequentialOptions, logger?: Logger): Promise<SequentialDeployResult>;
193
+ /**
194
+ * Result from EIP-5792 batched deployment
195
+ */
196
+ interface BatchedDeployResult {
197
+ appId: Address;
198
+ /** Batch ID from sendCalls (can be used with getCallsStatus) */
199
+ batchId: string;
200
+ /** Transaction receipts from the batch */
201
+ receipts: Array<{
202
+ transactionHash: Hex;
203
+ }>;
204
+ }
205
+ /**
206
+ * Options for EIP-5792 batched deployment
207
+ */
208
+ interface ExecuteDeployBatchedOptions {
209
+ walletClient: WalletClient;
210
+ publicClient: PublicClient;
211
+ environmentConfig: EnvironmentConfig;
212
+ /** Prepared deployment data from prepareDeployBatch */
213
+ data: PreparedDeployData;
214
+ /** Whether to set public logs permission */
215
+ publicLogs: boolean;
216
+ /** Optional callback for progress updates */
217
+ onProgress?: DeployProgressCallback;
218
+ }
219
+ /**
220
+ * Check if wallet supports EIP-5792 (sendCalls/wallet_sendCalls)
221
+ *
222
+ * This checks the wallet's capabilities to see if it supports atomic batch calls.
223
+ * MetaMask and other modern wallets are adding support for this standard.
224
+ */
225
+ declare function supportsEIP5792(walletClient: WalletClient): Promise<boolean>;
226
+ /**
227
+ * Execute deployment using EIP-5792 sendCalls (batched wallet calls)
228
+ *
229
+ * This batches all deployment transactions (createApp, acceptAdmin, setPublicLogs)
230
+ * into a single wallet interaction. Better UX than sequential transactions.
231
+ *
232
+ * Use this for browser wallets that support EIP-5792 but not EIP-7702.
233
+ *
234
+ * @returns BatchedDeployResult with appId and batch receipts
235
+ */
236
+ declare function executeDeployBatched(options: ExecuteDeployBatchedOptions, logger?: Logger): Promise<BatchedDeployResult>;
237
+ /**
238
+ * Upgrade app options
239
+ */
240
+ interface UpgradeAppOptions {
241
+ walletClient: WalletClient;
242
+ publicClient: PublicClient;
243
+ environmentConfig: EnvironmentConfig;
244
+ appID: Address;
245
+ release: Release;
246
+ publicLogs: boolean;
247
+ needsPermissionChange: boolean;
248
+ imageRef: string;
249
+ gas?: GasEstimate;
250
+ }
251
+ /**
252
+ * Options for preparing an upgrade batch
253
+ */
254
+ interface PrepareUpgradeBatchOptions {
255
+ walletClient: WalletClient;
256
+ publicClient: PublicClient;
257
+ environmentConfig: EnvironmentConfig;
258
+ appID: Address;
259
+ release: Release;
260
+ publicLogs: boolean;
261
+ needsPermissionChange: boolean;
262
+ imageRef: string;
263
+ }
264
+ /**
265
+ * Prepare upgrade batch - creates executions without sending transaction
266
+ *
267
+ * Use this to get the prepared batch for gas estimation before executing.
268
+ */
269
+ declare function prepareUpgradeBatch(options: PrepareUpgradeBatchOptions): Promise<PreparedUpgradeBatch>;
270
+ /**
271
+ * Execute a prepared upgrade batch
272
+ */
273
+ declare function executeUpgradeBatch(data: PreparedUpgradeData, context: {
274
+ walletClient: WalletClient;
275
+ publicClient: PublicClient;
276
+ environmentConfig: EnvironmentConfig;
277
+ }, gas?: GasEstimate, logger?: Logger): Promise<Hex>;
278
+ /**
279
+ * Upgrade app on-chain (convenience wrapper that prepares and executes)
280
+ */
281
+ declare function upgradeApp(options: UpgradeAppOptions, logger?: Logger): Promise<Hex>;
282
+ /**
283
+ * Send and wait for transaction with confirmation support
284
+ */
285
+ interface SendTransactionOptions {
286
+ walletClient: WalletClient;
287
+ publicClient: PublicClient;
288
+ environmentConfig: EnvironmentConfig;
289
+ to: Address;
290
+ data: Hex;
291
+ value?: bigint;
292
+ pendingMessage: string;
293
+ txDescription: string;
294
+ gas?: GasEstimate;
295
+ }
296
+ declare function sendAndWaitForTransaction(options: SendTransactionOptions, logger?: Logger): Promise<Hex>;
297
+ /**
298
+ * Get active app count for a user
299
+ */
300
+ declare function getActiveAppCount(publicClient: PublicClient, environmentConfig: EnvironmentConfig, user: Address): Promise<number>;
301
+ /**
302
+ * Get max active apps per user (quota limit)
303
+ */
304
+ declare function getMaxActiveAppsPerUser(publicClient: PublicClient, environmentConfig: EnvironmentConfig, user: Address): Promise<number>;
305
+ /**
306
+ * Get apps by creator (paginated)
307
+ */
308
+ interface AppConfig {
309
+ release: any;
310
+ status: number;
311
+ }
312
+ declare function getAppsByCreator(publicClient: PublicClient, environmentConfig: EnvironmentConfig, creator: Address, offset: bigint, limit: bigint): Promise<{
313
+ apps: Address[];
314
+ appConfigs: AppConfig[];
315
+ }>;
316
+ /**
317
+ * Get apps by developer
318
+ */
319
+ declare function getAppsByDeveloper(publicClient: PublicClient, environmentConfig: EnvironmentConfig, developer: Address, offset: bigint, limit: bigint): Promise<{
320
+ apps: Address[];
321
+ appConfigs: AppConfig[];
322
+ }>;
323
+ /**
324
+ * Fetch all apps by a developer by auto-pagination
325
+ */
326
+ declare function getAllAppsByDeveloper(publicClient: PublicClient, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
327
+ apps: Address[];
328
+ appConfigs: AppConfig[];
329
+ }>;
330
+ /**
331
+ * Get latest release block numbers for multiple apps
332
+ */
333
+ declare function getAppLatestReleaseBlockNumbers(publicClient: PublicClient, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
334
+ /**
335
+ * Get block timestamps for multiple block numbers
336
+ */
337
+ declare function getBlockTimestamps(publicClient: PublicClient, blockNumbers: number[]): Promise<Map<number, number>>;
338
+ /**
339
+ * Suspend options
340
+ */
341
+ interface SuspendOptions {
342
+ walletClient: WalletClient;
343
+ publicClient: PublicClient;
344
+ environmentConfig: EnvironmentConfig;
345
+ account: Address;
346
+ apps: Address[];
347
+ }
348
+ /**
349
+ * Suspend apps for an account
350
+ */
351
+ declare function suspend(options: SuspendOptions, logger?: Logger): Promise<Hex | false>;
352
+ /**
353
+ * Options for checking delegation status
354
+ */
355
+ interface IsDelegatedOptions {
356
+ publicClient: PublicClient;
357
+ environmentConfig: EnvironmentConfig;
358
+ address: Address;
359
+ }
360
+ /**
361
+ * Check if account is delegated to the ERC-7702 delegator
362
+ */
363
+ declare function isDelegated(options: IsDelegatedOptions): Promise<boolean>;
364
+ /**
365
+ * Undelegate options
366
+ */
367
+ interface UndelegateOptions {
368
+ walletClient: WalletClient;
369
+ publicClient: PublicClient;
370
+ environmentConfig: EnvironmentConfig;
371
+ }
372
+ /**
373
+ * Undelegate account (removes EIP-7702 delegation)
374
+ */
375
+ declare function undelegate(options: UndelegateOptions, logger?: Logger): Promise<Hex>;
376
+
377
+ /**
378
+ * Core types for ECloud SDK
379
+ */
380
+
381
+ type AppId = Address;
382
+ type logVisibility = "public" | "private" | "off";
383
+ interface DeployAppOpts {
384
+ /** App name - required */
385
+ name: string;
386
+ /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
387
+ dockerfile?: string;
388
+ /** Path to .env file - optional */
389
+ envFile?: string;
390
+ /** Image reference (registry/path:tag) - either this or dockerfile is required */
391
+ imageRef?: string;
392
+ /** Instance type SKU - required */
393
+ instanceType: string;
394
+ /** Log visibility setting - required */
395
+ logVisibility: logVisibility;
396
+ /** Optional gas params from estimation */
397
+ gas?: GasEstimate;
398
+ }
399
+ interface UpgradeAppOpts {
400
+ /** Path to Dockerfile (if building from Dockerfile) - either this or imageRef is required */
401
+ dockerfile?: string;
402
+ /** Image reference (registry/path:tag) - either this or dockerfile is required */
403
+ imageRef?: string;
404
+ /** Path to .env file - optional */
405
+ envFile?: string;
406
+ /** Instance type SKU - required */
407
+ instanceType: string;
408
+ /** Log visibility setting - required */
409
+ logVisibility: logVisibility;
410
+ gas?: GasEstimate;
411
+ }
412
+ /** Options for prepareDeploy */
413
+ interface PrepareDeployOpts {
414
+ /** App name - required */
415
+ name: string;
416
+ /** Path to Dockerfile (if building from Dockerfile) */
417
+ dockerfile?: string;
418
+ /** Path to .env file - optional */
419
+ envFile?: string;
420
+ /** Image reference (registry/path:tag) */
421
+ imageRef?: string;
422
+ /** Instance type SKU - required */
423
+ instanceType: string;
424
+ /** Log visibility setting - required */
425
+ logVisibility: logVisibility;
426
+ /** Resource usage monitoring setting - optional */
427
+ resourceUsageMonitoring?: "enable" | "disable";
428
+ }
429
+ /** Options for prepareUpgrade */
430
+ interface PrepareUpgradeOpts {
431
+ /** Path to Dockerfile (if building from Dockerfile) */
432
+ dockerfile?: string;
433
+ /** Image reference (registry/path:tag) */
434
+ imageRef?: string;
435
+ /** Path to .env file - optional */
436
+ envFile?: string;
437
+ /** Instance type SKU - required */
438
+ instanceType: string;
439
+ /** Log visibility setting - required */
440
+ logVisibility: logVisibility;
441
+ /** Resource usage monitoring setting - optional */
442
+ resourceUsageMonitoring?: "enable" | "disable";
443
+ }
444
+ /** Options for prepareDeployFromVerifiableBuild */
445
+ interface PrepareDeployFromVerifiableBuildOpts {
446
+ /** App name - required */
447
+ name: string;
448
+ /** Image reference (registry/path:tag) - required */
449
+ imageRef: string;
450
+ /** Image digest (sha256:...) - required */
451
+ imageDigest: string;
452
+ /** Path to .env file - optional */
453
+ envFile?: string;
454
+ /** Instance type SKU - required */
455
+ instanceType: string;
456
+ /** Log visibility setting - required */
457
+ logVisibility: logVisibility;
458
+ /** Resource usage monitoring setting - optional */
459
+ resourceUsageMonitoring?: "enable" | "disable";
460
+ }
461
+ /** Options for prepareUpgradeFromVerifiableBuild */
462
+ interface PrepareUpgradeFromVerifiableBuildOpts {
463
+ /** Image reference (registry/path:tag) - required */
464
+ imageRef: string;
465
+ /** Image digest (sha256:...) - required */
466
+ imageDigest: string;
467
+ /** Path to .env file - optional */
468
+ envFile?: string;
469
+ /** Instance type SKU - required */
470
+ instanceType: string;
471
+ /** Log visibility setting - required */
472
+ logVisibility: logVisibility;
473
+ /** Resource usage monitoring setting - optional */
474
+ resourceUsageMonitoring?: "enable" | "disable";
475
+ }
476
+ /** Gas options for execute functions */
477
+ interface GasOpts {
478
+ maxFeePerGas?: bigint;
479
+ maxPriorityFeePerGas?: bigint;
480
+ }
481
+ /** Result from executeDeploy */
482
+ interface ExecuteDeployResult {
483
+ appId: AppId;
484
+ txHash: Hex;
485
+ appName: string;
486
+ imageRef: string;
487
+ }
488
+ /** Result from executeUpgrade */
489
+ interface ExecuteUpgradeResult {
490
+ appId: AppId;
491
+ txHash: Hex;
492
+ imageRef: string;
493
+ }
494
+ /** Data-only batch for deploy (clients provided by module) */
495
+ interface PreparedDeployData {
496
+ /** The app ID that will be deployed */
497
+ appId: AppId;
498
+ /** The salt used for deployment */
499
+ salt: Uint8Array;
500
+ /** Batch executions to be sent */
501
+ executions: Array<{
502
+ target: Address;
503
+ value: bigint;
504
+ callData: Hex;
505
+ }>;
506
+ }
507
+ /** Data-only batch for upgrade (clients provided by module) */
508
+ interface PreparedUpgradeData {
509
+ /** The app ID being upgraded */
510
+ appId: AppId;
511
+ /** Batch executions to be sent */
512
+ executions: Array<{
513
+ target: Address;
514
+ value: bigint;
515
+ callData: Hex;
516
+ }>;
517
+ }
518
+ /** Prepared deployment ready for execution */
519
+ interface PreparedDeploy {
520
+ /** The prepared data (executions, appId, etc.) */
521
+ data: PreparedDeployData;
522
+ /** App name */
523
+ appName: string;
524
+ /** Final image reference */
525
+ imageRef: string;
526
+ }
527
+ /** Prepared upgrade ready for execution */
528
+ interface PreparedUpgrade {
529
+ /** The prepared data (executions, appId, etc.) */
530
+ data: PreparedUpgradeData;
531
+ /** App ID being upgraded */
532
+ appId: AppId;
533
+ /** Final image reference */
534
+ imageRef: string;
535
+ }
536
+ interface LifecycleOpts {
537
+ gas?: GasEstimate;
538
+ }
539
+ interface AppRecord {
540
+ id: AppId;
541
+ owner: Address;
542
+ image: string;
543
+ status: "starting" | "running" | "stopped" | "terminated";
544
+ createdAt: number;
545
+ lastUpdatedAt: number;
546
+ }
547
+ interface DeployOptions {
548
+ /** Private key for signing transactions (hex string with or without 0x prefix) - optional, will prompt if not provided */
549
+ privateKey?: string;
550
+ /** RPC URL for blockchain connection - optional, uses environment default if not provided */
551
+ rpcUrl?: string;
552
+ /** Environment name (e.g., 'sepolia', 'mainnet-alpha') - optional, defaults to 'sepolia' */
553
+ environment?: string;
554
+ /** Path to Dockerfile (if building from Dockerfile) */
555
+ dockerfilePath?: string;
556
+ /** Image reference (registry/path:tag) - optional, will prompt if not provided */
557
+ imageRef?: string;
558
+ /** Path to .env file - optional, will use .env if exists or prompt */
559
+ envFilePath?: string;
560
+ /** App name - optional, will prompt if not provided */
561
+ appName?: string;
562
+ /** Instance type - optional, will prompt if not provided */
563
+ instanceType?: string;
564
+ /** Log visibility setting - optional, will prompt if not provided */
565
+ logVisibility?: logVisibility;
566
+ }
567
+ interface DeployResult {
568
+ /** App ID (contract address) */
569
+ appId: AppId;
570
+ /** App name */
571
+ appName: string;
572
+ /** Final image reference */
573
+ imageRef: string;
574
+ /** IP address (if available) */
575
+ ipAddress?: string;
576
+ /** Transaction hash */
577
+ txHash: Hex;
578
+ }
579
+ interface EnvironmentConfig {
580
+ name: string;
581
+ build: "dev" | "prod";
582
+ chainID: bigint;
583
+ appControllerAddress: Address;
584
+ permissionControllerAddress: string;
585
+ erc7702DelegatorAddress: string;
586
+ kmsServerURL: string;
587
+ userApiServerURL: string;
588
+ defaultRPCURL: string;
589
+ }
590
+ interface Release {
591
+ rmsRelease: {
592
+ artifacts: Array<{
593
+ digest: Uint8Array;
594
+ registry: string;
595
+ }>;
596
+ upgradeByTime: number;
597
+ };
598
+ publicEnv: Uint8Array;
599
+ encryptedEnv: Uint8Array;
600
+ }
601
+ interface ParsedEnvironment {
602
+ public: Record<string, string>;
603
+ private: Record<string, string>;
604
+ }
605
+ interface ImageDigestResult {
606
+ digest: Uint8Array;
607
+ registry: string;
608
+ platform: string;
609
+ }
610
+ interface DockerImageConfig {
611
+ cmd: string[];
612
+ entrypoint: string[];
613
+ user: string;
614
+ labels: Record<string, string>;
615
+ }
616
+ interface Logger {
617
+ debug(message: string, ...args: any[]): void;
618
+ info(message: string, ...args: any[]): void;
619
+ warn(message: string, ...args: any[]): void;
620
+ error(message: string, ...args: any[]): void;
621
+ }
622
+ /**
623
+ * No-op logger for browser usage when logging is not needed
624
+ */
625
+ declare const noopLogger: Logger;
626
+ /**
627
+ * Profile information for an app
628
+ */
629
+ interface AppProfile {
630
+ /** App name (required) */
631
+ name: string;
632
+ /** Website URL (optional) */
633
+ website?: string;
634
+ /** Description (optional) */
635
+ description?: string;
636
+ /** X (Twitter) URL (optional) */
637
+ xURL?: string;
638
+ /** Path to image file (optional) */
639
+ image?: Blob | File;
640
+ /** Image name (optional) */
641
+ imageName?: string;
642
+ }
643
+ /**
644
+ * Profile response from API
645
+ */
646
+ interface AppProfileResponse {
647
+ name: string;
648
+ website?: string;
649
+ description?: string;
650
+ xURL?: string;
651
+ imageURL?: string;
652
+ }
653
+ type ProductID = "compute";
654
+ type ChainID = "ethereum-mainnet" | "ethereum-sepolia";
655
+ type SubscriptionStatus = "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "canceled" | "unpaid" | "paused" | "inactive";
656
+ interface SubscriptionLineItem {
657
+ description: string;
658
+ price: number;
659
+ quantity: number;
660
+ currency: string;
661
+ subtotal: number;
662
+ }
663
+ interface CreateSubscriptionOptions {
664
+ /** URL to redirect to after successful checkout */
665
+ successUrl?: string;
666
+ /** URL to redirect to if checkout is canceled */
667
+ cancelUrl?: string;
668
+ }
669
+ interface CreateSubscriptionResponse {
670
+ checkoutUrl: string;
671
+ }
672
+ interface CheckoutCreatedResponse {
673
+ type: "checkout_created";
674
+ checkoutUrl: string;
675
+ }
676
+ interface AlreadyActiveResponse {
677
+ type: "already_active";
678
+ status: SubscriptionStatus;
679
+ }
680
+ interface PaymentIssueResponse {
681
+ type: "payment_issue";
682
+ status: SubscriptionStatus;
683
+ portalUrl?: string;
684
+ }
685
+ type SubscribeResponse = CheckoutCreatedResponse | AlreadyActiveResponse | PaymentIssueResponse;
686
+ interface CancelSuccessResponse {
687
+ type: "canceled";
688
+ }
689
+ interface NoActiveSubscriptionResponse {
690
+ type: "no_active_subscription";
691
+ status: SubscriptionStatus;
692
+ }
693
+ type CancelResponse = CancelSuccessResponse | NoActiveSubscriptionResponse;
694
+ interface ProductSubscriptionResponse {
695
+ productId: ProductID;
696
+ subscriptionStatus: SubscriptionStatus;
697
+ currentPeriodStart?: string;
698
+ currentPeriodEnd?: string;
699
+ lineItems?: SubscriptionLineItem[];
700
+ upcomingInvoiceSubtotal?: number;
701
+ upcomingInvoiceTotal?: number;
702
+ creditsApplied?: number;
703
+ remainingCredits?: number;
704
+ nextCreditExpiry?: number;
705
+ cancelAtPeriodEnd?: boolean;
706
+ canceledAt?: string;
707
+ portalUrl?: string;
708
+ }
709
+ interface SubscriptionOpts {
710
+ productId?: ProductID;
711
+ }
712
+ interface BillingEnvironmentConfig {
713
+ billingApiServerURL: string;
714
+ }
715
+ interface BillingEnvironmentConfig {
716
+ billingApiServerURL: string;
717
+ }
718
+ /**
719
+ * Progress callback for sequential deployment
720
+ * Called after each step completes
721
+ */
722
+ type DeployProgressCallback = (step: DeployStep, txHash?: Hex) => void;
723
+ /**
724
+ * Steps in sequential deployment flow
725
+ */
726
+ type DeployStep = "createApp" | "acceptAdmin" | "setPublicLogs" | "complete";
727
+ /**
728
+ * Result from sequential deployment
729
+ */
730
+ interface SequentialDeployResult {
731
+ appId: AppId;
732
+ txHashes: {
733
+ createApp: Hex;
734
+ acceptAdmin: Hex;
735
+ setPublicLogs?: Hex;
736
+ };
737
+ }
738
+
739
+ export { type PreparedDeploy as $, type AppId as A, type SuspendOptions as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EstimateGasOptions as E, type UndelegateOptions as F, type GasEstimate as G, type ExecuteDeploySequentialOptions as H, type IsDelegatedOptions as I, type ExecuteDeployBatchedOptions as J, type BatchedDeployResult as K, noopLogger as L, type logVisibility as M, type DeployAppOpts as N, type UpgradeAppOpts as O, type PrepareDeployBatchOptions as P, type PrepareDeployOpts as Q, type PrepareUpgradeOpts as R, type SendTransactionOptions as S, type PrepareDeployFromVerifiableBuildOpts as T, type UpgradeAppOptions as U, type PrepareUpgradeFromVerifiableBuildOpts as V, type GasOpts as W, type ExecuteDeployResult as X, type ExecuteUpgradeResult as Y, type PreparedDeployData as Z, type PreparedUpgradeData as _, getAppsByCreator as a, type PreparedUpgrade as a0, type LifecycleOpts as a1, type AppRecord as a2, type DeployOptions as a3, type DeployResult as a4, type BillingEnvironmentConfig as a5, type EnvironmentConfig as a6, type Release as a7, type ParsedEnvironment as a8, type ImageDigestResult as a9, type DockerImageConfig as aa, type Logger as ab, type AppProfile as ac, type AppProfileResponse as ad, type ProductID as ae, type ChainID as af, type SubscriptionStatus as ag, type SubscriptionLineItem as ah, type CreateSubscriptionOptions as ai, type CreateSubscriptionResponse as aj, type CheckoutCreatedResponse as ak, type AlreadyActiveResponse as al, type PaymentIssueResponse as am, type SubscribeResponse as an, type CancelSuccessResponse as ao, type NoActiveSubscriptionResponse as ap, type CancelResponse as aq, type ProductSubscriptionResponse as ar, type SubscriptionOpts as as, type DeployProgressCallback as at, type DeployStep as au, type SequentialDeployResult as av, getAppLatestReleaseBlockNumbers as aw, getBlockTimestamps as ax, getAppsByDeveloper as b, getActiveAppCount as c, getMaxActiveAppsPerUser as d, estimateTransactionGas as e, formatETH as f, getAllAppsByDeveloper as g, executeDeployBatch as h, deployApp as i, calculateAppID as j, executeDeploySequential as k, executeDeployBatched as l, supportsEIP5792 as m, prepareUpgradeBatch as n, executeUpgradeBatch as o, prepareDeployBatch as p, sendAndWaitForTransaction as q, isDelegated as r, supportsEIP7702 as s, suspend as t, upgradeApp as u, undelegate as v, type AppConfig as w, type PrepareUpgradeBatchOptions as x, type PreparedDeployBatch as y, type PreparedUpgradeBatch as z };