@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/VERSION +2 -2
- package/dist/billing.cjs +13 -5
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/billing.js +13 -5
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +2106 -62
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +202 -5
- package/dist/browser.d.ts +202 -5
- package/dist/browser.js +2069 -67
- package/dist/browser.js.map +1 -1
- package/dist/{compute-B85ikS78.d.ts → compute-BYhSs8en.d.ts} +1 -1
- package/dist/{compute-CC0R7HEu.d.cts → compute-Bpjb3hYD.d.cts} +1 -1
- package/dist/compute.cjs +237 -22
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.d.cts +2 -2
- package/dist/compute.d.ts +2 -2
- package/dist/compute.js +238 -27
- package/dist/compute.js.map +1 -1
- package/dist/helpers-CEvhJz7f.d.cts +742 -0
- package/dist/helpers-CQuBwQnu.d.ts +742 -0
- package/dist/{index-D5oW73Dx.d.cts → index-DeQzn_yM.d.cts} +309 -2
- package/dist/{index-D5oW73Dx.d.ts → index-DeQzn_yM.d.ts} +309 -2
- package/dist/index.cjs +394 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -88
- package/dist/index.d.ts +8 -88
- package/dist/index.js +384 -49
- package/dist/index.js.map +1 -1
- package/package.json +12 -2
- package/dist/eip7702-CXCYfOnk.d.ts +0 -400
- package/dist/eip7702-DeqoCP5b.d.cts +0 -400
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
import { a6 as EnvironmentConfig, ag as SubscriptionStatus, a5 as BillingEnvironmentConfig, ae as ProductID, ai as CreateSubscriptionOptions, aj as CreateSubscriptionResponse, ar as ProductSubscriptionResponse, G as GasEstimate, ab as Logger } from './index-DeQzn_yM.cjs';
|
|
2
|
+
import { Address, Hex, WalletClient, PublicClient, Chain } 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
|
+
/**
|
|
223
|
+
* Compute API Session Management
|
|
224
|
+
*
|
|
225
|
+
* This module provides utilities for managing authentication sessions with the compute API
|
|
226
|
+
* using SIWE (Sign-In with Ethereum).
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
interface ComputeApiConfig {
|
|
230
|
+
/** Base URL of the compute API (e.g., "https://api.eigencloud.xyz") */
|
|
231
|
+
baseUrl: string;
|
|
232
|
+
}
|
|
233
|
+
interface SessionInfo {
|
|
234
|
+
/** Whether the session is authenticated */
|
|
235
|
+
authenticated: boolean;
|
|
236
|
+
/** Authenticated wallet address (if authenticated) */
|
|
237
|
+
address?: Address;
|
|
238
|
+
/** Chain ID used for authentication (if authenticated) */
|
|
239
|
+
chainId?: number;
|
|
240
|
+
}
|
|
241
|
+
interface LoginResult {
|
|
242
|
+
/** Whether login was successful */
|
|
243
|
+
success: boolean;
|
|
244
|
+
/** Authenticated wallet address */
|
|
245
|
+
address: Address;
|
|
246
|
+
}
|
|
247
|
+
interface LoginRequest {
|
|
248
|
+
/** SIWE message string */
|
|
249
|
+
message: string;
|
|
250
|
+
/** Hex-encoded signature (with or without 0x prefix) */
|
|
251
|
+
signature: Hex | string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Error thrown when session operations fail
|
|
255
|
+
*/
|
|
256
|
+
declare class SessionError extends Error {
|
|
257
|
+
readonly code: "NETWORK_ERROR" | "INVALID_SIGNATURE" | "INVALID_MESSAGE" | "SESSION_EXPIRED" | "UNAUTHORIZED" | "UNKNOWN";
|
|
258
|
+
readonly statusCode?: number | undefined;
|
|
259
|
+
constructor(message: string, code: "NETWORK_ERROR" | "INVALID_SIGNATURE" | "INVALID_MESSAGE" | "SESSION_EXPIRED" | "UNAUTHORIZED" | "UNKNOWN", statusCode?: number | undefined);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Login to the compute API using SIWE
|
|
263
|
+
*
|
|
264
|
+
* This establishes a session with the compute API by verifying the SIWE message
|
|
265
|
+
* and signature. On success, a session cookie is set in the browser.
|
|
266
|
+
*
|
|
267
|
+
* @param config - Compute API configuration
|
|
268
|
+
* @param request - Login request containing SIWE message and signature
|
|
269
|
+
* @returns Login result with the authenticated address
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* import { createSiweMessage, loginToComputeApi } from "@layr-labs/ecloud-sdk/browser";
|
|
274
|
+
*
|
|
275
|
+
* const { message } = createSiweMessage({
|
|
276
|
+
* address: userAddress,
|
|
277
|
+
* chainId: 11155111,
|
|
278
|
+
* domain: window.location.host,
|
|
279
|
+
* uri: window.location.origin,
|
|
280
|
+
* });
|
|
281
|
+
*
|
|
282
|
+
* const signature = await signMessageAsync({ message });
|
|
283
|
+
* const result = await loginToComputeApi(
|
|
284
|
+
* { baseUrl: "https://api.eigencloud.xyz" },
|
|
285
|
+
* { message, signature }
|
|
286
|
+
* );
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
declare function loginToComputeApi(config: ComputeApiConfig, request: LoginRequest): Promise<LoginResult>;
|
|
290
|
+
/**
|
|
291
|
+
* Get the current session status from the compute API
|
|
292
|
+
*
|
|
293
|
+
* @param config - Compute API configuration
|
|
294
|
+
* @returns Session information including authentication status and address
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* const session = await getComputeApiSession({ baseUrl: "https://api.eigencloud.xyz" });
|
|
299
|
+
* if (session.authenticated) {
|
|
300
|
+
* console.log(`Logged in as ${session.address}`);
|
|
301
|
+
* }
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
declare function getComputeApiSession(config: ComputeApiConfig): Promise<SessionInfo>;
|
|
305
|
+
/**
|
|
306
|
+
* Logout from the compute API
|
|
307
|
+
*
|
|
308
|
+
* This destroys the current session and clears the session cookie.
|
|
309
|
+
*
|
|
310
|
+
* @param config - Compute API configuration
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* await logoutFromComputeApi({ baseUrl: "https://api.eigencloud.xyz" });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare function logoutFromComputeApi(config: ComputeApiConfig): Promise<void>;
|
|
318
|
+
/**
|
|
319
|
+
* Check if a session is still valid (not expired)
|
|
320
|
+
*
|
|
321
|
+
* This is a convenience function that checks the session status
|
|
322
|
+
* and returns a boolean.
|
|
323
|
+
*
|
|
324
|
+
* @param config - Compute API configuration
|
|
325
|
+
* @returns True if session is authenticated, false otherwise
|
|
326
|
+
*/
|
|
327
|
+
declare function isSessionValid(config: ComputeApiConfig): Promise<boolean>;
|
|
328
|
+
|
|
329
|
+
interface AppProfileInfo {
|
|
330
|
+
name: string;
|
|
331
|
+
website?: string;
|
|
332
|
+
description?: string;
|
|
333
|
+
xURL?: string;
|
|
334
|
+
imageURL?: string;
|
|
335
|
+
}
|
|
336
|
+
interface AppMetrics {
|
|
337
|
+
cpu_utilization_percent?: number;
|
|
338
|
+
memory_utilization_percent?: number;
|
|
339
|
+
memory_used_bytes?: number;
|
|
340
|
+
memory_total_bytes?: number;
|
|
341
|
+
}
|
|
342
|
+
interface DerivedAddress {
|
|
343
|
+
address: string;
|
|
344
|
+
derivationPath: string;
|
|
345
|
+
}
|
|
346
|
+
interface AppInfo {
|
|
347
|
+
address: Address;
|
|
348
|
+
status: string;
|
|
349
|
+
ip: string;
|
|
350
|
+
machineType: string;
|
|
351
|
+
profile?: AppProfileInfo;
|
|
352
|
+
metrics?: AppMetrics;
|
|
353
|
+
evmAddresses: DerivedAddress[];
|
|
354
|
+
solanaAddresses: DerivedAddress[];
|
|
355
|
+
}
|
|
356
|
+
interface AppInfoResponse {
|
|
357
|
+
apps: Array<{
|
|
358
|
+
addresses: {
|
|
359
|
+
data: {
|
|
360
|
+
evmAddresses: DerivedAddress[];
|
|
361
|
+
solanaAddresses: DerivedAddress[];
|
|
362
|
+
};
|
|
363
|
+
signature: string;
|
|
364
|
+
};
|
|
365
|
+
app_status: string;
|
|
366
|
+
ip: string;
|
|
367
|
+
machine_type: string;
|
|
368
|
+
profile?: AppProfileInfo;
|
|
369
|
+
metrics?: AppMetrics;
|
|
370
|
+
}>;
|
|
371
|
+
}
|
|
372
|
+
type AppContractStatus = "STARTED" | "STOPPED" | "TERMINATED" | "SUSPENDED" | string;
|
|
373
|
+
interface AppReleaseBuild {
|
|
374
|
+
buildId?: string;
|
|
375
|
+
billingAddress?: string;
|
|
376
|
+
repoUrl?: string;
|
|
377
|
+
gitRef?: string;
|
|
378
|
+
status?: string;
|
|
379
|
+
buildType?: string;
|
|
380
|
+
imageName?: string;
|
|
381
|
+
imageDigest?: string;
|
|
382
|
+
imageUrl?: string;
|
|
383
|
+
provenanceJson?: unknown;
|
|
384
|
+
provenanceSignature?: string;
|
|
385
|
+
createdAt?: string;
|
|
386
|
+
updatedAt?: string;
|
|
387
|
+
errorMessage?: string;
|
|
388
|
+
dependencies?: Record<string, AppReleaseBuild>;
|
|
389
|
+
}
|
|
390
|
+
interface AppRelease {
|
|
391
|
+
appId?: string;
|
|
392
|
+
rmsReleaseId?: string;
|
|
393
|
+
imageDigest?: string;
|
|
394
|
+
registryUrl?: string;
|
|
395
|
+
publicEnv?: string;
|
|
396
|
+
encryptedEnv?: string;
|
|
397
|
+
upgradeByTime?: number;
|
|
398
|
+
createdAt?: string;
|
|
399
|
+
createdAtBlock?: string;
|
|
400
|
+
build?: AppReleaseBuild;
|
|
401
|
+
}
|
|
402
|
+
interface AppResponse {
|
|
403
|
+
id: string;
|
|
404
|
+
creator?: string;
|
|
405
|
+
contractStatus?: AppContractStatus;
|
|
406
|
+
releases: AppRelease[];
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Options for UserApiClient
|
|
410
|
+
*/
|
|
411
|
+
interface UserApiClientOptions {
|
|
412
|
+
/** Custom client ID for request tracking */
|
|
413
|
+
clientId?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Use SIWE session authentication instead of per-request signatures.
|
|
416
|
+
* When true, requests rely on session cookies set by loginToComputeApi().
|
|
417
|
+
* When false (default), each request is signed individually.
|
|
418
|
+
*/
|
|
419
|
+
useSession?: boolean;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* UserAPI Client for interacting with the EigenCloud UserAPI service.
|
|
423
|
+
*/
|
|
424
|
+
declare class UserApiClient {
|
|
425
|
+
private readonly config;
|
|
426
|
+
private readonly walletClient;
|
|
427
|
+
private readonly publicClient;
|
|
428
|
+
private readonly clientId;
|
|
429
|
+
private readonly useSession;
|
|
430
|
+
constructor(config: EnvironmentConfig, walletClient: WalletClient, publicClient: PublicClient, options?: UserApiClientOptions);
|
|
431
|
+
/**
|
|
432
|
+
* Get the address of the connected wallet
|
|
433
|
+
*/
|
|
434
|
+
get address(): Address;
|
|
435
|
+
getInfos(appIDs: Address[], addressCount?: number): Promise<AppInfo[]>;
|
|
436
|
+
/**
|
|
437
|
+
* Get app details from UserAPI (includes releases and build/provenance info when available).
|
|
438
|
+
*
|
|
439
|
+
* Endpoint: GET /apps/:appAddress
|
|
440
|
+
*/
|
|
441
|
+
getApp(appAddress: Address): Promise<AppResponse>;
|
|
442
|
+
/**
|
|
443
|
+
* Get available SKUs (instance types) from UserAPI
|
|
444
|
+
*/
|
|
445
|
+
getSKUs(): Promise<{
|
|
446
|
+
skus: Array<{
|
|
447
|
+
sku: string;
|
|
448
|
+
description: string;
|
|
449
|
+
}>;
|
|
450
|
+
}>;
|
|
451
|
+
/**
|
|
452
|
+
* Get logs for an app
|
|
453
|
+
*/
|
|
454
|
+
getLogs(appID: Address): Promise<string>;
|
|
455
|
+
/**
|
|
456
|
+
* Get statuses for apps
|
|
457
|
+
*/
|
|
458
|
+
getStatuses(appIDs: Address[]): Promise<Array<{
|
|
459
|
+
address: Address;
|
|
460
|
+
status: string;
|
|
461
|
+
}>>;
|
|
462
|
+
/**
|
|
463
|
+
* Upload app profile information with optional image
|
|
464
|
+
*
|
|
465
|
+
* @param appAddress - The app's contract address
|
|
466
|
+
* @param name - Display name for the app
|
|
467
|
+
* @param options - Optional fields including website, description, xURL, and image
|
|
468
|
+
* @param options.image - Image file as Blob or File (browser: from input element, Node.js: new Blob([buffer]))
|
|
469
|
+
* @param options.imageName - Filename for the image (required if image is provided)
|
|
470
|
+
*/
|
|
471
|
+
uploadAppProfile(appAddress: Address, name: string, options?: {
|
|
472
|
+
website?: string;
|
|
473
|
+
description?: string;
|
|
474
|
+
xURL?: string;
|
|
475
|
+
image?: Blob | File;
|
|
476
|
+
imageName?: string;
|
|
477
|
+
}): Promise<{
|
|
478
|
+
name: string;
|
|
479
|
+
website?: string;
|
|
480
|
+
description?: string;
|
|
481
|
+
xURL?: string;
|
|
482
|
+
imageURL?: string;
|
|
483
|
+
}>;
|
|
484
|
+
private makeAuthenticatedRequest;
|
|
485
|
+
/**
|
|
486
|
+
* Generate authentication headers for UserAPI requests
|
|
487
|
+
*/
|
|
488
|
+
private generateAuthHeaders;
|
|
489
|
+
/**
|
|
490
|
+
* Login to the compute API using SIWE (Sign-In with Ethereum)
|
|
491
|
+
*
|
|
492
|
+
* This establishes a session with the compute API by verifying the SIWE message
|
|
493
|
+
* and signature. On success, a session cookie is set in the browser.
|
|
494
|
+
*
|
|
495
|
+
* @param request - Login request containing SIWE message and signature
|
|
496
|
+
* @returns Login result with the authenticated address
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* import { createSiweMessage } from "@layr-labs/ecloud-sdk/browser";
|
|
501
|
+
*
|
|
502
|
+
* const { message } = createSiweMessage({
|
|
503
|
+
* address: userAddress,
|
|
504
|
+
* chainId: 11155111,
|
|
505
|
+
* domain: window.location.host,
|
|
506
|
+
* uri: window.location.origin,
|
|
507
|
+
* });
|
|
508
|
+
*
|
|
509
|
+
* const signature = await signMessageAsync({ message });
|
|
510
|
+
* const result = await client.siweLogin({ message, signature });
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
siweLogin(request: LoginRequest): Promise<LoginResult>;
|
|
514
|
+
/**
|
|
515
|
+
* Logout from the compute API
|
|
516
|
+
*
|
|
517
|
+
* This destroys the current session and clears the session cookie.
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* ```typescript
|
|
521
|
+
* await client.siweLogout();
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
siweLogout(): Promise<void>;
|
|
525
|
+
/**
|
|
526
|
+
* Get the current SIWE session status from the compute API
|
|
527
|
+
*
|
|
528
|
+
* @returns Session information including authentication status and address
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* const session = await client.getSiweSession();
|
|
533
|
+
* if (session.authenticated) {
|
|
534
|
+
* console.log(`Logged in as ${session.address}`);
|
|
535
|
+
* }
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
getSiweSession(): Promise<SessionInfo>;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* BillingAPI Client to manage product subscriptions
|
|
543
|
+
* Standalone client - does not depend on chain infrastructure
|
|
544
|
+
*
|
|
545
|
+
* Accepts viem's WalletClient which abstracts over both local accounts
|
|
546
|
+
* (privateKeyToAccount) and external signers (MetaMask, etc.).
|
|
547
|
+
*/
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* BillingAPI Client for managing product subscriptions.
|
|
551
|
+
*/
|
|
552
|
+
declare class BillingApiClient {
|
|
553
|
+
private readonly config;
|
|
554
|
+
private readonly walletClient;
|
|
555
|
+
constructor(config: BillingEnvironmentConfig, walletClient: WalletClient);
|
|
556
|
+
/**
|
|
557
|
+
* Get the address of the connected wallet
|
|
558
|
+
*/
|
|
559
|
+
get address(): Address;
|
|
560
|
+
createSubscription(productId?: ProductID, options?: CreateSubscriptionOptions): Promise<CreateSubscriptionResponse>;
|
|
561
|
+
getSubscription(productId?: ProductID): Promise<ProductSubscriptionResponse>;
|
|
562
|
+
cancelSubscription(productId?: ProductID): Promise<void>;
|
|
563
|
+
/**
|
|
564
|
+
* Make an authenticated request to the billing API
|
|
565
|
+
*/
|
|
566
|
+
private makeAuthenticatedRequest;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* EIP-7702 transaction handling
|
|
571
|
+
*
|
|
572
|
+
* This module handles EIP-7702 delegation and batch execution.
|
|
573
|
+
*/
|
|
574
|
+
|
|
575
|
+
type Execution = {
|
|
576
|
+
target: Address;
|
|
577
|
+
value: bigint;
|
|
578
|
+
callData: Hex;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* Options for estimating batch gas
|
|
582
|
+
*/
|
|
583
|
+
interface EstimateBatchGasOptions {
|
|
584
|
+
publicClient: PublicClient;
|
|
585
|
+
account: Address;
|
|
586
|
+
executions: Execution[];
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Estimate gas cost for a batch transaction
|
|
590
|
+
*
|
|
591
|
+
* Use this to get cost estimate before prompting user for confirmation.
|
|
592
|
+
*/
|
|
593
|
+
declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
|
|
594
|
+
interface ExecuteBatchOptions {
|
|
595
|
+
walletClient: WalletClient;
|
|
596
|
+
publicClient: PublicClient;
|
|
597
|
+
environmentConfig: EnvironmentConfig;
|
|
598
|
+
executions: Execution[];
|
|
599
|
+
pendingMessage: string;
|
|
600
|
+
/** Optional gas params from estimation */
|
|
601
|
+
gas?: GasEstimate;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Check if account is delegated to ERC-7702 delegator
|
|
605
|
+
*/
|
|
606
|
+
declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
|
|
607
|
+
/**
|
|
608
|
+
* Execute batch of operations via EIP-7702 delegator
|
|
609
|
+
*/
|
|
610
|
+
declare function executeBatch(options: ExecuteBatchOptions, logger?: Logger): Promise<Hex>;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* SIWE (Sign-In with Ethereum) utilities for compute API authentication
|
|
614
|
+
*
|
|
615
|
+
* This module provides browser-safe utilities for creating and parsing SIWE messages
|
|
616
|
+
* compatible with the compute-tee API. Uses the official `siwe` package (EIP-4361).
|
|
617
|
+
*/
|
|
618
|
+
|
|
619
|
+
interface SiweMessageParams {
|
|
620
|
+
/** Ethereum address (checksummed or lowercase) */
|
|
621
|
+
address: Address;
|
|
622
|
+
/** Chain ID (e.g., 1 for mainnet, 11155111 for sepolia) */
|
|
623
|
+
chainId: number;
|
|
624
|
+
/** Domain requesting the signature (e.g., "api.eigencloud.xyz") */
|
|
625
|
+
domain: string;
|
|
626
|
+
/** Full URI of the signing request (e.g., "https://api.eigencloud.xyz") */
|
|
627
|
+
uri: string;
|
|
628
|
+
/** Optional nonce for replay protection (generated if not provided) */
|
|
629
|
+
nonce?: string;
|
|
630
|
+
/** Optional human-readable statement */
|
|
631
|
+
statement?: string;
|
|
632
|
+
/** Optional expiration time (defaults to 24 hours from now) */
|
|
633
|
+
expirationTime?: Date;
|
|
634
|
+
/** Optional issued at time (defaults to now) */
|
|
635
|
+
issuedAt?: Date;
|
|
636
|
+
/** Optional not-before time */
|
|
637
|
+
notBefore?: Date;
|
|
638
|
+
/** Optional request ID */
|
|
639
|
+
requestId?: string;
|
|
640
|
+
/** Optional resources array */
|
|
641
|
+
resources?: string[];
|
|
642
|
+
}
|
|
643
|
+
interface SiweMessageResult {
|
|
644
|
+
/** Raw SIWE message string for signing */
|
|
645
|
+
message: string;
|
|
646
|
+
/** Parsed parameters */
|
|
647
|
+
params: Required<Pick<SiweMessageParams, "address" | "chainId" | "domain" | "uri" | "nonce" | "issuedAt">> & Omit<SiweMessageParams, "address" | "chainId" | "domain" | "uri" | "nonce" | "issuedAt">;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Re-export generateNonce from siwe package
|
|
651
|
+
*/
|
|
652
|
+
declare const generateNonce: () => string;
|
|
653
|
+
/**
|
|
654
|
+
* Create a SIWE message for compute API authentication
|
|
655
|
+
*
|
|
656
|
+
* @param params - Parameters for the SIWE message
|
|
657
|
+
* @returns The SIWE message object with the raw message string
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```typescript
|
|
661
|
+
* const { message } = createSiweMessage({
|
|
662
|
+
* address: "0x1234...",
|
|
663
|
+
* chainId: 11155111,
|
|
664
|
+
* domain: "api.eigencloud.xyz",
|
|
665
|
+
* uri: "https://api.eigencloud.xyz",
|
|
666
|
+
* statement: "Sign in to EigenCloud",
|
|
667
|
+
* });
|
|
668
|
+
*
|
|
669
|
+
* // Sign with wagmi
|
|
670
|
+
* const signature = await signMessageAsync({ message });
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
declare function createSiweMessage(params: SiweMessageParams): SiweMessageResult;
|
|
674
|
+
/**
|
|
675
|
+
* Parse a SIWE message string back to structured parameters
|
|
676
|
+
*
|
|
677
|
+
* @param message - Raw SIWE message string
|
|
678
|
+
* @returns Parsed parameters or null if invalid
|
|
679
|
+
*/
|
|
680
|
+
declare function parseSiweMessage(message: string): SiweMessageParams | null;
|
|
681
|
+
/**
|
|
682
|
+
* Check if a SIWE message has expired
|
|
683
|
+
*/
|
|
684
|
+
declare function isSiweMessageExpired(params: SiweMessageParams): boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Check if a SIWE message is not yet valid (notBefore)
|
|
687
|
+
*/
|
|
688
|
+
declare function isSiweMessageNotYetValid(params: SiweMessageParams): boolean;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* General utility helpers
|
|
692
|
+
*/
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Get a viem Chain object from a chain ID.
|
|
696
|
+
* Supports mainnet (1) and sepolia (11155111), defaults to the fallback chain for unknown chains.
|
|
697
|
+
*/
|
|
698
|
+
declare function getChainFromID(chainID: bigint, fallback?: Chain): Chain;
|
|
699
|
+
/**
|
|
700
|
+
* Create viem clients from a private key
|
|
701
|
+
*
|
|
702
|
+
* This is a convenience helper for CLI and server applications that have direct
|
|
703
|
+
* access to a private key. For browser applications using external wallets (MetaMask, etc.),
|
|
704
|
+
* create the WalletClient directly using viem's createWalletClient with a custom transport.
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* // CLI usage with private key
|
|
708
|
+
* const { walletClient, publicClient } = createClients({
|
|
709
|
+
* privateKey: '0x...',
|
|
710
|
+
* rpcUrl: 'https://sepolia.infura.io/v3/...',
|
|
711
|
+
* chainId: 11155111n
|
|
712
|
+
* });
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* // Browser usage with external wallet (create clients directly)
|
|
716
|
+
* const walletClient = createWalletClient({
|
|
717
|
+
* chain: sepolia,
|
|
718
|
+
* transport: custom(window.ethereum!)
|
|
719
|
+
* });
|
|
720
|
+
* const publicClient = createPublicClient({
|
|
721
|
+
* chain: sepolia,
|
|
722
|
+
* transport: custom(window.ethereum!)
|
|
723
|
+
* });
|
|
724
|
+
*/
|
|
725
|
+
declare function createClients(options: {
|
|
726
|
+
privateKey: string | Hex;
|
|
727
|
+
rpcUrl: string;
|
|
728
|
+
chainId: bigint;
|
|
729
|
+
}): {
|
|
730
|
+
walletClient: WalletClient;
|
|
731
|
+
publicClient: PublicClient;
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Ensure hex string has 0x prefix
|
|
735
|
+
*/
|
|
736
|
+
declare function addHexPrefix(value: string): Hex;
|
|
737
|
+
/**
|
|
738
|
+
* Remove 0x prefix from hex string if present
|
|
739
|
+
*/
|
|
740
|
+
declare function stripHexPrefix(value: string): string;
|
|
741
|
+
|
|
742
|
+
export { logoutFromComputeApi as $, type LogsParams as A, isSubscriptionActive as B, type ComputeApiConfig as C, generateNewPrivateKey as D, type UserApiClientOptions as E, type AppInfo as F, type GeneratedKey as G, type AppProfileInfo as H, type AppMetrics as I, type AppInfoResponse as J, BillingApiClient as K, type LogVisibility as L, estimateBatchGas as M, executeBatch as N, checkERC7702Delegation as O, type EstimateBatchGasOptions as P, type ExecuteBatchOptions as Q, type Execution as R, type SessionInfo as S, createSiweMessage as T, UserApiClient as U, parseSiweMessage as V, generateNonce as W, isSiweMessageExpired as X, isSiweMessageNotYetValid as Y, type SiweMessageResult as Z, loginToComputeApi as _, SessionError as a, getComputeApiSession as a0, isSessionValid as a1, type LoginResult as a2, type LoginRequest as a3, getChainFromID as a4, addHexPrefix as a5, stripHexPrefix as a6, type ResourceUsageMonitoring as a7, createClients as a8, type AppRelease as a9, type AppReleaseBuild as aa, type AppResponse as ab, validateFilePath as ac, assertValidFilePath as ad, validateImagePath as ae, validateResourceUsageMonitoring as af, type DeployParams as ag, validateDeployParams as ah, type UpgradeParams as ai, validateUpgradeParams as aj, type SiweMessageParams as b, getBillingEnvironmentConfig as c, getAvailableEnvironments as d, getBuildType as e, isMainnet as f, getEnvironmentConfig as g, validateImageReference as h, isEnvironmentAvailable as i, assertValidImageReference as j, extractAppNameFromImage as k, validateInstanceTypeSKU as l, validatePrivateKeyFormat as m, assertValidPrivateKey as n, validateURL as o, validateXURL as p, validateDescription as q, validateAppID as r, validateLogVisibility as s, sanitizeString as t, sanitizeURL as u, validateAppName as v, sanitizeXURL as w, validateCreateAppParams as x, validateLogsParams as y, type CreateAppParams as z };
|