@layr-labs/ecloud-sdk 0.2.1-dev → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layr-labs/ecloud-sdk",
3
- "version": "0.2.1-dev",
3
+ "version": "0.2.2-dev",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -54,12 +54,22 @@
54
54
  "js-yaml": "^4.1.1",
55
55
  "node-forge": "^1.3.2",
56
56
  "posthog-node": "^5.17.2",
57
+ "siwe": "^2.3.2",
57
58
  "viem": "^2.38.6"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@types/dockerode": "^3.3.45",
61
62
  "@types/form-data": "^2.5.2",
62
63
  "@types/js-yaml": "^4.0.9",
63
- "@types/node-forge": "^1.3.14"
64
+ "@types/node-forge": "^1.3.14",
65
+ "@types/react": "^18.0.0"
66
+ },
67
+ "peerDependencies": {
68
+ "react": "^18.0.0 || ^19.0.0"
69
+ },
70
+ "peerDependenciesMeta": {
71
+ "react": {
72
+ "optional": true
73
+ }
64
74
  }
65
75
  }
@@ -1,400 +0,0 @@
1
- import { w as EnvironmentConfig, S as SubscriptionStatus, G as GasEstimate } from './index-D5oW73Dx.js';
2
- import { Address, WalletClient, PublicClient, Hex } from 'viem';
3
-
4
- /**
5
- * Environment configuration for different networks
6
- */
7
-
8
- /**
9
- * Get environment configuration
10
- */
11
- declare function getEnvironmentConfig(environment: string, chainID?: bigint): EnvironmentConfig;
12
- /**
13
- * Get billing environment configuration
14
- * @param build - The build type ("dev" or "prod")
15
- */
16
- declare function getBillingEnvironmentConfig(build: "dev" | "prod"): {
17
- billingApiServerURL: string;
18
- };
19
- declare function getBuildType(): "dev" | "prod";
20
- /**
21
- * Get available environments based on build type
22
- * - dev: only "sepolia-dev"
23
- * - prod: "sepolia" and "mainnet-alpha"
24
- */
25
- declare function getAvailableEnvironments(): string[];
26
- /**
27
- * Check if an environment is available in the current build
28
- */
29
- declare function isEnvironmentAvailable(environment: string): boolean;
30
- /**
31
- * Check if environment is mainnet (chain ID 1)
32
- */
33
- declare function isMainnet(environmentConfig: EnvironmentConfig): boolean;
34
-
35
- /**
36
- * Non-interactive validation utilities for SDK
37
- *
38
- * These functions validate parameters without any interactive prompts.
39
- * They either return the validated value or throw an error.
40
- */
41
-
42
- /**
43
- * Validate app name format
44
- * @throws Error if name is invalid
45
- */
46
- declare function validateAppName(name: string): void;
47
- /**
48
- * Validate Docker image reference format
49
- * @returns true if valid, error message string if invalid
50
- */
51
- declare function validateImageReference(value: string): true | string;
52
- /**
53
- * Validate image reference and throw if invalid
54
- * @throws Error if image reference is invalid
55
- */
56
- declare function assertValidImageReference(value: string): void;
57
- /**
58
- * Extract app name from image reference
59
- */
60
- declare function extractAppNameFromImage(imageRef: string): string;
61
- /**
62
- * Validate that a file path exists
63
- * @returns true if valid, error message string if invalid
64
- */
65
- declare function validateFilePath(value: string): true | string;
66
- /**
67
- * Validate file path and throw if invalid
68
- * @throws Error if file path is invalid or doesn't exist
69
- */
70
- declare function assertValidFilePath(value: string): void;
71
- /**
72
- * Validate instance type SKU against available types
73
- * @returns the validated SKU
74
- * @throws Error if SKU is not in the available types list
75
- */
76
- declare function validateInstanceTypeSKU(sku: string, availableTypes: Array<{
77
- sku: string;
78
- }>): string;
79
- /**
80
- * Validate private key format
81
- * Matches Go's common.ValidatePrivateKey() function
82
- */
83
- declare function validatePrivateKeyFormat(key: string): boolean;
84
- /**
85
- * Validate private key and throw if invalid
86
- * @throws Error if private key format is invalid
87
- */
88
- declare function assertValidPrivateKey(key: string): void;
89
- /**
90
- * Validate URL format
91
- * @returns undefined if valid, error message string if invalid
92
- */
93
- declare function validateURL(rawURL: string): string | undefined;
94
- /**
95
- * Validate X/Twitter URL format
96
- * @returns undefined if valid, error message string if invalid
97
- */
98
- declare function validateXURL(rawURL: string): string | undefined;
99
- /**
100
- * Validate description length
101
- * @returns undefined if valid, error message string if invalid
102
- */
103
- declare function validateDescription(description: string): string | undefined;
104
- /**
105
- * Validate image file path
106
- * @returns undefined if valid, error message string if invalid
107
- */
108
- declare function validateImagePath(filePath: string): string | undefined;
109
- /**
110
- * Validate and normalize app ID address
111
- * @param appID - App ID (must be a valid address)
112
- * @returns Normalized app address
113
- * @throws Error if app ID is not a valid address
114
- *
115
- * Note: Name resolution should be handled by CLI before calling SDK functions.
116
- * The SDK only accepts resolved addresses.
117
- */
118
- declare function validateAppID(appID: string | Address): Address;
119
- type LogVisibility = "public" | "private" | "off";
120
- /**
121
- * Validate and convert log visibility setting to internal format
122
- * @param logVisibility - Log visibility setting
123
- * @returns Object with logRedirect and publicLogs settings
124
- * @throws Error if log visibility value is invalid
125
- */
126
- declare function validateLogVisibility(logVisibility: LogVisibility): {
127
- logRedirect: string;
128
- publicLogs: boolean;
129
- };
130
- type ResourceUsageMonitoring = "enable" | "disable";
131
- /**
132
- * Validate and convert resource usage monitoring setting to internal format
133
- * @param resourceUsageMonitoring - Resource usage monitoring setting
134
- * @returns The resourceUsageAllow value for the Dockerfile label ("always" or "never")
135
- * @throws Error if resource usage monitoring value is invalid
136
- */
137
- declare function validateResourceUsageMonitoring(resourceUsageMonitoring: ResourceUsageMonitoring | undefined): string;
138
- /**
139
- * Sanitize string (HTML escape and trim)
140
- */
141
- declare function sanitizeString(s: string): string;
142
- /**
143
- * Sanitize URL (add https:// if missing, validate)
144
- * @throws Error if URL is invalid after sanitization
145
- */
146
- declare function sanitizeURL(rawURL: string): string;
147
- /**
148
- * Sanitize X/Twitter URL (handle username-only input, normalize)
149
- * @throws Error if URL is invalid after sanitization
150
- */
151
- declare function sanitizeXURL(rawURL: string): string;
152
- interface DeployParams {
153
- dockerfilePath?: string;
154
- imageRef?: string;
155
- appName: string;
156
- envFilePath?: string;
157
- instanceType: string;
158
- logVisibility: LogVisibility;
159
- }
160
- /**
161
- * Validate deploy parameters
162
- * @throws Error if required parameters are missing or invalid
163
- */
164
- declare function validateDeployParams(params: Partial<DeployParams>): void;
165
- interface UpgradeParams {
166
- appID: string | Address;
167
- dockerfilePath?: string;
168
- imageRef?: string;
169
- envFilePath?: string;
170
- instanceType: string;
171
- logVisibility: LogVisibility;
172
- }
173
- /**
174
- * Validate upgrade parameters
175
- * @throws Error if required parameters are missing or invalid
176
- */
177
- declare function validateUpgradeParams(params: Partial<UpgradeParams>): void;
178
- interface CreateAppParams {
179
- name: string;
180
- language: string;
181
- template?: string;
182
- templateVersion?: string;
183
- }
184
- /**
185
- * Validate create app parameters
186
- * @throws Error if required parameters are missing or invalid
187
- */
188
- declare function validateCreateAppParams(params: Partial<CreateAppParams>): void;
189
- interface LogsParams {
190
- appID: string | Address;
191
- watch?: boolean;
192
- }
193
- /**
194
- * Validate logs parameters
195
- * @throws Error if required parameters are missing or invalid
196
- */
197
- declare function validateLogsParams(params: Partial<LogsParams>): void;
198
-
199
- /**
200
- * Billing utility functions
201
- */
202
-
203
- /**
204
- * Check if subscription status allows deploying apps
205
- */
206
- declare function isSubscriptionActive(status: SubscriptionStatus): boolean;
207
-
208
- /**
209
- * Private Key Generation
210
- *
211
- * Generate new secp256k1 private keys for Ethereum
212
- */
213
- interface GeneratedKey {
214
- privateKey: string;
215
- address: string;
216
- }
217
- /**
218
- * Generate a new secp256k1 private key
219
- */
220
- declare function generateNewPrivateKey(): GeneratedKey;
221
-
222
- interface AppProfileInfo {
223
- name: string;
224
- website?: string;
225
- description?: string;
226
- xURL?: string;
227
- imageURL?: string;
228
- }
229
- interface AppMetrics {
230
- cpu_utilization_percent?: number;
231
- memory_utilization_percent?: number;
232
- memory_used_bytes?: number;
233
- memory_total_bytes?: number;
234
- }
235
- interface DerivedAddress {
236
- address: string;
237
- derivationPath: string;
238
- }
239
- interface AppInfo {
240
- address: Address;
241
- status: string;
242
- ip: string;
243
- machineType: string;
244
- profile?: AppProfileInfo;
245
- metrics?: AppMetrics;
246
- evmAddresses: DerivedAddress[];
247
- solanaAddresses: DerivedAddress[];
248
- }
249
- interface AppInfoResponse {
250
- apps: Array<{
251
- addresses: {
252
- data: {
253
- evmAddresses: DerivedAddress[];
254
- solanaAddresses: DerivedAddress[];
255
- };
256
- signature: string;
257
- };
258
- app_status: string;
259
- ip: string;
260
- machine_type: string;
261
- profile?: AppProfileInfo;
262
- metrics?: AppMetrics;
263
- }>;
264
- }
265
- type AppContractStatus = "STARTED" | "STOPPED" | "TERMINATED" | "SUSPENDED" | string;
266
- interface AppReleaseBuild {
267
- buildId?: string;
268
- billingAddress?: string;
269
- repoUrl?: string;
270
- gitRef?: string;
271
- status?: string;
272
- buildType?: string;
273
- imageName?: string;
274
- imageDigest?: string;
275
- imageUrl?: string;
276
- provenanceJson?: unknown;
277
- provenanceSignature?: string;
278
- createdAt?: string;
279
- updatedAt?: string;
280
- errorMessage?: string;
281
- dependencies?: Record<string, AppReleaseBuild>;
282
- }
283
- interface AppRelease {
284
- appId?: string;
285
- rmsReleaseId?: string;
286
- imageDigest?: string;
287
- registryUrl?: string;
288
- publicEnv?: string;
289
- encryptedEnv?: string;
290
- upgradeByTime?: number;
291
- createdAt?: string;
292
- createdAtBlock?: string;
293
- build?: AppReleaseBuild;
294
- }
295
- interface AppResponse {
296
- id: string;
297
- creator?: string;
298
- contractStatus?: AppContractStatus;
299
- releases: AppRelease[];
300
- }
301
- /**
302
- * UserAPI Client for interacting with the EigenCloud UserAPI service.
303
- */
304
- declare class UserApiClient {
305
- private readonly config;
306
- private readonly walletClient;
307
- private readonly publicClient;
308
- private readonly clientId;
309
- constructor(config: EnvironmentConfig, walletClient: WalletClient, publicClient: PublicClient, clientId?: string);
310
- /**
311
- * Get the address of the connected wallet
312
- */
313
- get address(): Address;
314
- getInfos(appIDs: Address[], addressCount?: number): Promise<AppInfo[]>;
315
- /**
316
- * Get app details from UserAPI (includes releases and build/provenance info when available).
317
- *
318
- * Endpoint: GET /apps/:appAddress
319
- */
320
- getApp(appAddress: Address): Promise<AppResponse>;
321
- /**
322
- * Get available SKUs (instance types) from UserAPI
323
- */
324
- getSKUs(): Promise<{
325
- skus: Array<{
326
- sku: string;
327
- description: string;
328
- }>;
329
- }>;
330
- /**
331
- * Get logs for an app
332
- */
333
- getLogs(appID: Address): Promise<string>;
334
- /**
335
- * Get statuses for apps
336
- */
337
- getStatuses(appIDs: Address[]): Promise<Array<{
338
- address: Address;
339
- status: string;
340
- }>>;
341
- /**
342
- * Upload app profile information with optional image
343
- *
344
- * @param appAddress - The app's contract address
345
- * @param name - Display name for the app
346
- * @param options - Optional fields including website, description, xURL, and image
347
- * @param options.image - Image file as Blob or File (browser: from input element, Node.js: new Blob([buffer]))
348
- * @param options.imageName - Filename for the image (required if image is provided)
349
- */
350
- uploadAppProfile(appAddress: Address, name: string, options?: {
351
- website?: string;
352
- description?: string;
353
- xURL?: string;
354
- image?: Blob | File;
355
- imageName?: string;
356
- }): Promise<{
357
- name: string;
358
- website?: string;
359
- description?: string;
360
- xURL?: string;
361
- imageURL?: string;
362
- }>;
363
- private makeAuthenticatedRequest;
364
- /**
365
- * Generate authentication headers for UserAPI requests
366
- */
367
- private generateAuthHeaders;
368
- }
369
-
370
- /**
371
- * EIP-7702 transaction handling
372
- *
373
- * This module handles EIP-7702 delegation and batch execution.
374
- */
375
-
376
- type Execution = {
377
- target: Address;
378
- value: bigint;
379
- callData: Hex;
380
- };
381
- /**
382
- * Options for estimating batch gas
383
- */
384
- interface EstimateBatchGasOptions {
385
- publicClient: PublicClient;
386
- account: Address;
387
- executions: Execution[];
388
- }
389
- /**
390
- * Estimate gas cost for a batch transaction
391
- *
392
- * Use this to get cost estimate before prompting user for confirmation.
393
- */
394
- declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
395
- /**
396
- * Check if account is delegated to ERC-7702 delegator
397
- */
398
- declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
399
-
400
- export { type AppInfo as A, type AppMetrics as B, type CreateAppParams as C, type AppInfoResponse as D, estimateBatchGas as E, type EstimateBatchGasOptions as F, type GeneratedKey as G, getBillingEnvironmentConfig as H, checkERC7702Delegation as I, type AppRelease as J, type AppReleaseBuild as K, type LogVisibility as L, type AppResponse as M, validateFilePath as N, assertValidFilePath as O, validateImagePath as P, validateResourceUsageMonitoring as Q, type ResourceUsageMonitoring as R, type DeployParams as S, validateDeployParams as T, UserApiClient as U, type UpgradeParams as V, validateUpgradeParams as W, getAvailableEnvironments as a, getBuildType as b, isMainnet as c, validateImageReference as d, assertValidImageReference as e, extractAppNameFromImage as f, getEnvironmentConfig as g, validateInstanceTypeSKU as h, isEnvironmentAvailable as i, validatePrivateKeyFormat as j, assertValidPrivateKey as k, validateURL as l, validateXURL as m, validateDescription as n, validateAppID as o, validateLogVisibility as p, sanitizeURL as q, sanitizeXURL as r, sanitizeString as s, validateCreateAppParams as t, validateLogsParams as u, validateAppName as v, type LogsParams as w, isSubscriptionActive as x, generateNewPrivateKey as y, type AppProfileInfo as z };