@phala/cloud 0.0.1

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.
@@ -0,0 +1,2978 @@
1
+ import * as ofetch from 'ofetch';
2
+ import { FetchOptions, FetchRequest, FetchError } from 'ofetch';
3
+ import { z } from 'zod';
4
+ import { Hex, PublicClient, WalletClient, Address, Hash, TransactionReceipt, Chain } from 'viem';
5
+ export { encryptEnvVars } from '@phala/dstack-sdk/encrypt-env-vars';
6
+ export { getComposeHash, verifyEnvEncryptPublicKey } from '@phala/dstack-sdk';
7
+
8
+ /**
9
+ * API Error Response Schema
10
+ */
11
+ declare const ApiErrorSchema: z.ZodObject<{
12
+ detail: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{
13
+ msg: z.ZodString;
14
+ type: z.ZodOptional<z.ZodString>;
15
+ ctx: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ msg: string;
18
+ type?: string | undefined;
19
+ ctx?: Record<string, unknown> | undefined;
20
+ }, {
21
+ msg: string;
22
+ type?: string | undefined;
23
+ ctx?: Record<string, unknown> | undefined;
24
+ }>, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
25
+ type: z.ZodOptional<z.ZodString>;
26
+ code: z.ZodOptional<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ detail: string | Record<string, unknown> | {
29
+ msg: string;
30
+ type?: string | undefined;
31
+ ctx?: Record<string, unknown> | undefined;
32
+ }[];
33
+ code?: string | undefined;
34
+ type?: string | undefined;
35
+ }, {
36
+ detail: string | Record<string, unknown> | {
37
+ msg: string;
38
+ type?: string | undefined;
39
+ ctx?: Record<string, unknown> | undefined;
40
+ }[];
41
+ code?: string | undefined;
42
+ type?: string | undefined;
43
+ }>;
44
+ type ApiError = z.infer<typeof ApiErrorSchema>;
45
+ /**
46
+ * Enhanced error type that includes both HTTP and validation errors
47
+ */
48
+ type SafeError = RequestError | z.ZodError;
49
+ /**
50
+ * Result type for safe operations, similar to zod's SafeParseResult
51
+ * Enhanced to handle both HTTP and validation errors by default
52
+ */
53
+ type SafeResult<T, E = SafeError> = {
54
+ success: true;
55
+ data: T;
56
+ error?: never;
57
+ } | {
58
+ success: false;
59
+ data?: never;
60
+ error: E;
61
+ };
62
+ /**
63
+ * Base error class for HTTP requests
64
+ * Compatible with ApiError interface for Result type compatibility
65
+ */
66
+ declare class RequestError extends Error implements ApiError {
67
+ readonly name = "RequestError";
68
+ readonly isRequestError: true;
69
+ readonly status?: number | undefined;
70
+ readonly statusText?: string | undefined;
71
+ readonly data?: unknown;
72
+ readonly request?: FetchRequest | undefined;
73
+ readonly response?: Response | undefined;
74
+ readonly detail: string | Record<string, unknown> | Array<{
75
+ msg: string;
76
+ type?: string;
77
+ ctx?: Record<string, unknown>;
78
+ }>;
79
+ readonly code?: string | undefined;
80
+ readonly type?: string | undefined;
81
+ constructor(message: string, options?: {
82
+ status?: number | undefined;
83
+ statusText?: string | undefined;
84
+ data?: unknown;
85
+ request?: FetchRequest | undefined;
86
+ response?: Response | undefined;
87
+ cause?: unknown;
88
+ detail?: string | Record<string, unknown> | Array<{
89
+ msg: string;
90
+ type?: string;
91
+ ctx?: Record<string, unknown>;
92
+ }>;
93
+ code?: string | undefined;
94
+ type?: string | undefined;
95
+ });
96
+ /**
97
+ * Create RequestError from FetchError
98
+ */
99
+ static fromFetchError(error: FetchError): RequestError;
100
+ /**
101
+ * Create RequestError from generic Error
102
+ */
103
+ static fromError(error: Error, request?: FetchRequest): RequestError;
104
+ }
105
+ /**
106
+ * Client configuration - extends FetchOptions and adds predefined API-specific options
107
+ *
108
+ * Environment Variables:
109
+ * - PHALA_CLOUD_API_KEY: API key for authentication
110
+ * - PHALA_CLOUD_API_PREFIX: Base URL prefix for the API
111
+ */
112
+ interface ClientConfig extends FetchOptions {
113
+ /**
114
+ * API key for authentication
115
+ * If not provided, will read from PHALA_CLOUD_API_KEY environment variable
116
+ */
117
+ apiKey?: string;
118
+ /**
119
+ * Base URL for the API (overrides FetchOptions baseURL)
120
+ * If not provided, will read from PHALA_CLOUD_API_PREFIX environment variable
121
+ * Defaults to "https://cloud-api.phala.network/v1"
122
+ */
123
+ baseURL?: string;
124
+ /** Default timeout in milliseconds (overrides FetchOptions timeout) */
125
+ timeout?: number;
126
+ }
127
+
128
+ /**
129
+ * HTTP Client class with ofetch compatibility
130
+ */
131
+ declare class Client {
132
+ private fetchInstance;
133
+ readonly config: ClientConfig;
134
+ constructor(config?: ClientConfig);
135
+ /**
136
+ * Get the underlying ofetch instance for advanced usage
137
+ */
138
+ get raw(): ofetch.$Fetch;
139
+ /**
140
+ * Perform GET request (throws on error)
141
+ */
142
+ get<T = unknown>(request: FetchRequest, options?: Omit<FetchOptions, "method">): Promise<T>;
143
+ /**
144
+ * Perform POST request (throws on error)
145
+ */
146
+ post<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<T>;
147
+ /**
148
+ * Perform PUT request (throws on error)
149
+ */
150
+ put<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<T>;
151
+ /**
152
+ * Perform PATCH request (throws on error)
153
+ */
154
+ patch<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<T>;
155
+ /**
156
+ * Perform DELETE request (throws on error)
157
+ */
158
+ delete<T = unknown>(request: FetchRequest, options?: Omit<FetchOptions, "method">): Promise<T>;
159
+ /**
160
+ * Safe wrapper for any request method (zod-style result)
161
+ */
162
+ private safeRequest;
163
+ /**
164
+ * Safe GET request (returns SafeResult)
165
+ */
166
+ safeGet<T = unknown>(request: FetchRequest, options?: Omit<FetchOptions, "method">): Promise<SafeResult<T, RequestError>>;
167
+ /**
168
+ * Safe POST request (returns SafeResult)
169
+ */
170
+ safePost<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<SafeResult<T, RequestError>>;
171
+ /**
172
+ * Safe PUT request (returns SafeResult)
173
+ */
174
+ safePut<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<SafeResult<T, RequestError>>;
175
+ /**
176
+ * Safe PATCH request (returns SafeResult)
177
+ */
178
+ safePatch<T = unknown>(request: FetchRequest, body?: RequestInit["body"] | Record<string, unknown>, options?: Omit<FetchOptions, "method" | "body">): Promise<SafeResult<T, RequestError>>;
179
+ /**
180
+ * Safe DELETE request (returns SafeResult)
181
+ */
182
+ safeDelete<T = unknown>(request: FetchRequest, options?: Omit<FetchOptions, "method">): Promise<SafeResult<T, RequestError>>;
183
+ }
184
+ /**
185
+ * Create a new HTTP client instance
186
+ *
187
+ * Configuration can be provided via parameters or environment variables:
188
+ * - PHALA_CLOUD_API_KEY: API key for authentication
189
+ * - PHALA_CLOUD_API_PREFIX: Base URL prefix for the API
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * // Using explicit configuration
194
+ * const client = createClient({
195
+ * apiKey: 'your-api-key',
196
+ * baseURL: 'https://custom-api.example.com'
197
+ * })
198
+ *
199
+ * // Using environment variables (set PHALA_CLOUD_API_KEY)
200
+ * const client = createClient()
201
+ * ```
202
+ */
203
+ declare function createClient(config?: ClientConfig): Client;
204
+
205
+ /**
206
+ * Common type for action parameters that control behavior (e.g., schema validation)
207
+ */
208
+ type ActionParameters<T = undefined> = T extends z.ZodSchema ? {
209
+ schema: T;
210
+ } : T extends false ? {
211
+ schema: false;
212
+ } : {
213
+ schema?: z.ZodSchema | false;
214
+ };
215
+ /**
216
+ * Common type for action return values with schema validation support
217
+ */
218
+ type ActionReturnType<DefaultType, T = undefined> = T extends z.ZodSchema ? z.infer<T> : T extends false ? unknown : DefaultType;
219
+
220
+ /**
221
+ * Get current user information and validate API token
222
+ *
223
+ * Returns information about the current authenticated user.
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * import { createClient, getCurrentUser } from '@phala/cloud'
228
+ *
229
+ * const client = createClient({ apiKey: 'your-api-key' })
230
+ * const user = await getCurrentUser(client)
231
+ * // Output: { username: 'alice', email: 'alice@example.com', credits: 1000, ... }
232
+ * ```
233
+ *
234
+ * ## Returns
235
+ *
236
+ * `CurrentUser | unknown`
237
+ *
238
+ * Information about the current user. Return type depends on schema parameter.
239
+ *
240
+ * ## Parameters
241
+ *
242
+ * ### parameters (optional)
243
+ * - **Type:** `GetCurrentUserParameters`
244
+ *
245
+ * Optional behavior parameters for schema validation.
246
+ *
247
+ * ```typescript
248
+ * // Use default schema
249
+ * const user = await getCurrentUser(client)
250
+ *
251
+ * // Return raw data without validation
252
+ * const raw = await getCurrentUser(client, { schema: false })
253
+ *
254
+ * // Use custom schema
255
+ * const customSchema = z.object({ id: z.number(), name: z.string() })
256
+ * const custom = await getCurrentUser(client, { schema: customSchema })
257
+ * ```
258
+ *
259
+ * ## Safe Version
260
+ *
261
+ * Use `safeGetCurrentUser` for error handling without exceptions:
262
+ *
263
+ * ```typescript
264
+ * import { safeGetCurrentUser } from '@phala/cloud'
265
+ *
266
+ * const result = await safeGetCurrentUser(client)
267
+ * if (result.success) {
268
+ * console.log(result.data.username)
269
+ * } else {
270
+ * if ("isRequestError" in result.error) {
271
+ * console.error(`HTTP ${result.error.status}: ${result.error.message}`)
272
+ * } else {
273
+ * console.error(`Validation error: ${result.error.issues}`)
274
+ * }
275
+ * }
276
+ * ```
277
+ */
278
+ declare const CurrentUserSchema: z.ZodObject<{
279
+ username: z.ZodString;
280
+ email: z.ZodString;
281
+ credits: z.ZodNumber;
282
+ granted_credits: z.ZodNumber;
283
+ avatar: z.ZodString;
284
+ team_name: z.ZodString;
285
+ team_tier: z.ZodString;
286
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
287
+ username: z.ZodString;
288
+ email: z.ZodString;
289
+ credits: z.ZodNumber;
290
+ granted_credits: z.ZodNumber;
291
+ avatar: z.ZodString;
292
+ team_name: z.ZodString;
293
+ team_tier: z.ZodString;
294
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
295
+ username: z.ZodString;
296
+ email: z.ZodString;
297
+ credits: z.ZodNumber;
298
+ granted_credits: z.ZodNumber;
299
+ avatar: z.ZodString;
300
+ team_name: z.ZodString;
301
+ team_tier: z.ZodString;
302
+ }, z.ZodTypeAny, "passthrough">>;
303
+ type CurrentUser = z.infer<typeof CurrentUserSchema>;
304
+ type GetCurrentUserParameters<T = undefined> = ActionParameters<T>;
305
+ type GetCurrentUserReturnType<T = undefined> = ActionReturnType<CurrentUser, T>;
306
+ declare function getCurrentUser<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: GetCurrentUserParameters<T>): Promise<GetCurrentUserReturnType<T>>;
307
+ declare function safeGetCurrentUser<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: GetCurrentUserParameters<T>): Promise<SafeResult<GetCurrentUserReturnType<T>>>;
308
+
309
+ declare const AvailableNodesSchema: z.ZodObject<{
310
+ tier: z.ZodString;
311
+ capacity: z.ZodObject<{
312
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
313
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
314
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
315
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
316
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
317
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
318
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
319
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
320
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
321
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
322
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
323
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
324
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
325
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
326
+ }, z.ZodTypeAny, "passthrough">>;
327
+ nodes: z.ZodArray<z.ZodObject<{
328
+ teepod_id: z.ZodNumber;
329
+ name: z.ZodString;
330
+ listed: z.ZodBoolean;
331
+ resource_score: z.ZodNumber;
332
+ remaining_vcpu: z.ZodNumber;
333
+ remaining_memory: z.ZodNumber;
334
+ remaining_cvm_slots: z.ZodNumber;
335
+ images: z.ZodArray<z.ZodObject<{
336
+ name: z.ZodString;
337
+ is_dev: z.ZodBoolean;
338
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
339
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
340
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
341
+ name: z.ZodString;
342
+ is_dev: z.ZodBoolean;
343
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
344
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
345
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
346
+ name: z.ZodString;
347
+ is_dev: z.ZodBoolean;
348
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
349
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
350
+ }, z.ZodTypeAny, "passthrough">>, "many">;
351
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
352
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
353
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
355
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
356
+ teepod_id: z.ZodNumber;
357
+ name: z.ZodString;
358
+ listed: z.ZodBoolean;
359
+ resource_score: z.ZodNumber;
360
+ remaining_vcpu: z.ZodNumber;
361
+ remaining_memory: z.ZodNumber;
362
+ remaining_cvm_slots: z.ZodNumber;
363
+ images: z.ZodArray<z.ZodObject<{
364
+ name: z.ZodString;
365
+ is_dev: z.ZodBoolean;
366
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
367
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
368
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
369
+ name: z.ZodString;
370
+ is_dev: z.ZodBoolean;
371
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
372
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
374
+ name: z.ZodString;
375
+ is_dev: z.ZodBoolean;
376
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
377
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
378
+ }, z.ZodTypeAny, "passthrough">>, "many">;
379
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
380
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
381
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
382
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
383
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
384
+ teepod_id: z.ZodNumber;
385
+ name: z.ZodString;
386
+ listed: z.ZodBoolean;
387
+ resource_score: z.ZodNumber;
388
+ remaining_vcpu: z.ZodNumber;
389
+ remaining_memory: z.ZodNumber;
390
+ remaining_cvm_slots: z.ZodNumber;
391
+ images: z.ZodArray<z.ZodObject<{
392
+ name: z.ZodString;
393
+ is_dev: z.ZodBoolean;
394
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
395
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
396
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
397
+ name: z.ZodString;
398
+ is_dev: z.ZodBoolean;
399
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
400
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
401
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
402
+ name: z.ZodString;
403
+ is_dev: z.ZodBoolean;
404
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
405
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
406
+ }, z.ZodTypeAny, "passthrough">>, "many">;
407
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
408
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
409
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
410
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
411
+ }, z.ZodTypeAny, "passthrough">>, "many">;
412
+ kms_list: z.ZodArray<z.ZodObject<{
413
+ id: z.ZodString;
414
+ slug: z.ZodNullable<z.ZodString>;
415
+ url: z.ZodString;
416
+ version: z.ZodString;
417
+ chain_id: z.ZodNullable<z.ZodNumber>;
418
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
419
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
420
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
421
+ id: z.ZodString;
422
+ slug: z.ZodNullable<z.ZodString>;
423
+ url: z.ZodString;
424
+ version: z.ZodString;
425
+ chain_id: z.ZodNullable<z.ZodNumber>;
426
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
427
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
428
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
429
+ id: z.ZodString;
430
+ slug: z.ZodNullable<z.ZodString>;
431
+ url: z.ZodString;
432
+ version: z.ZodString;
433
+ chain_id: z.ZodNullable<z.ZodNumber>;
434
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
435
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
436
+ }, z.ZodTypeAny, "passthrough">>, "many">;
437
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
438
+ tier: z.ZodString;
439
+ capacity: z.ZodObject<{
440
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
441
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
442
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
443
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
444
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
445
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
446
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
447
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
448
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
449
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
450
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
451
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
452
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
453
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
454
+ }, z.ZodTypeAny, "passthrough">>;
455
+ nodes: z.ZodArray<z.ZodObject<{
456
+ teepod_id: z.ZodNumber;
457
+ name: z.ZodString;
458
+ listed: z.ZodBoolean;
459
+ resource_score: z.ZodNumber;
460
+ remaining_vcpu: z.ZodNumber;
461
+ remaining_memory: z.ZodNumber;
462
+ remaining_cvm_slots: z.ZodNumber;
463
+ images: z.ZodArray<z.ZodObject<{
464
+ name: z.ZodString;
465
+ is_dev: z.ZodBoolean;
466
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
467
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
468
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
469
+ name: z.ZodString;
470
+ is_dev: z.ZodBoolean;
471
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
472
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
473
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
474
+ name: z.ZodString;
475
+ is_dev: z.ZodBoolean;
476
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
477
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
478
+ }, z.ZodTypeAny, "passthrough">>, "many">;
479
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
480
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
481
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
482
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
483
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
484
+ teepod_id: z.ZodNumber;
485
+ name: z.ZodString;
486
+ listed: z.ZodBoolean;
487
+ resource_score: z.ZodNumber;
488
+ remaining_vcpu: z.ZodNumber;
489
+ remaining_memory: z.ZodNumber;
490
+ remaining_cvm_slots: z.ZodNumber;
491
+ images: z.ZodArray<z.ZodObject<{
492
+ name: z.ZodString;
493
+ is_dev: z.ZodBoolean;
494
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
495
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
496
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
497
+ name: z.ZodString;
498
+ is_dev: z.ZodBoolean;
499
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
500
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
501
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
502
+ name: z.ZodString;
503
+ is_dev: z.ZodBoolean;
504
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
505
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
506
+ }, z.ZodTypeAny, "passthrough">>, "many">;
507
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
508
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
509
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
510
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
511
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
512
+ teepod_id: z.ZodNumber;
513
+ name: z.ZodString;
514
+ listed: z.ZodBoolean;
515
+ resource_score: z.ZodNumber;
516
+ remaining_vcpu: z.ZodNumber;
517
+ remaining_memory: z.ZodNumber;
518
+ remaining_cvm_slots: z.ZodNumber;
519
+ images: z.ZodArray<z.ZodObject<{
520
+ name: z.ZodString;
521
+ is_dev: z.ZodBoolean;
522
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
523
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
525
+ name: z.ZodString;
526
+ is_dev: z.ZodBoolean;
527
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
528
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
529
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
530
+ name: z.ZodString;
531
+ is_dev: z.ZodBoolean;
532
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
533
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
534
+ }, z.ZodTypeAny, "passthrough">>, "many">;
535
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
536
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
537
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
538
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
539
+ }, z.ZodTypeAny, "passthrough">>, "many">;
540
+ kms_list: z.ZodArray<z.ZodObject<{
541
+ id: z.ZodString;
542
+ slug: z.ZodNullable<z.ZodString>;
543
+ url: z.ZodString;
544
+ version: z.ZodString;
545
+ chain_id: z.ZodNullable<z.ZodNumber>;
546
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
547
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
548
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
549
+ id: z.ZodString;
550
+ slug: z.ZodNullable<z.ZodString>;
551
+ url: z.ZodString;
552
+ version: z.ZodString;
553
+ chain_id: z.ZodNullable<z.ZodNumber>;
554
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
555
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
556
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
557
+ id: z.ZodString;
558
+ slug: z.ZodNullable<z.ZodString>;
559
+ url: z.ZodString;
560
+ version: z.ZodString;
561
+ chain_id: z.ZodNullable<z.ZodNumber>;
562
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
563
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
564
+ }, z.ZodTypeAny, "passthrough">>, "many">;
565
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
566
+ tier: z.ZodString;
567
+ capacity: z.ZodObject<{
568
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
569
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
570
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
571
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
572
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
573
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
574
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
575
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
576
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
577
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
578
+ max_instances: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
579
+ max_vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
580
+ max_memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
581
+ max_disk: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
582
+ }, z.ZodTypeAny, "passthrough">>;
583
+ nodes: z.ZodArray<z.ZodObject<{
584
+ teepod_id: z.ZodNumber;
585
+ name: z.ZodString;
586
+ listed: z.ZodBoolean;
587
+ resource_score: z.ZodNumber;
588
+ remaining_vcpu: z.ZodNumber;
589
+ remaining_memory: z.ZodNumber;
590
+ remaining_cvm_slots: z.ZodNumber;
591
+ images: z.ZodArray<z.ZodObject<{
592
+ name: z.ZodString;
593
+ is_dev: z.ZodBoolean;
594
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
595
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
596
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
597
+ name: z.ZodString;
598
+ is_dev: z.ZodBoolean;
599
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
600
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
601
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
602
+ name: z.ZodString;
603
+ is_dev: z.ZodBoolean;
604
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
605
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
606
+ }, z.ZodTypeAny, "passthrough">>, "many">;
607
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
608
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
609
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
610
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
611
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
612
+ teepod_id: z.ZodNumber;
613
+ name: z.ZodString;
614
+ listed: z.ZodBoolean;
615
+ resource_score: z.ZodNumber;
616
+ remaining_vcpu: z.ZodNumber;
617
+ remaining_memory: z.ZodNumber;
618
+ remaining_cvm_slots: z.ZodNumber;
619
+ images: z.ZodArray<z.ZodObject<{
620
+ name: z.ZodString;
621
+ is_dev: z.ZodBoolean;
622
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
623
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
624
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
625
+ name: z.ZodString;
626
+ is_dev: z.ZodBoolean;
627
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
628
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
629
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
630
+ name: z.ZodString;
631
+ is_dev: z.ZodBoolean;
632
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
633
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
634
+ }, z.ZodTypeAny, "passthrough">>, "many">;
635
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
636
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
637
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
638
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
639
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
640
+ teepod_id: z.ZodNumber;
641
+ name: z.ZodString;
642
+ listed: z.ZodBoolean;
643
+ resource_score: z.ZodNumber;
644
+ remaining_vcpu: z.ZodNumber;
645
+ remaining_memory: z.ZodNumber;
646
+ remaining_cvm_slots: z.ZodNumber;
647
+ images: z.ZodArray<z.ZodObject<{
648
+ name: z.ZodString;
649
+ is_dev: z.ZodBoolean;
650
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
651
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
652
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
653
+ name: z.ZodString;
654
+ is_dev: z.ZodBoolean;
655
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
656
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
657
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
658
+ name: z.ZodString;
659
+ is_dev: z.ZodBoolean;
660
+ version: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
661
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
662
+ }, z.ZodTypeAny, "passthrough">>, "many">;
663
+ dedicated_for_team_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
664
+ support_onchain_kms: z.ZodOptional<z.ZodBoolean>;
665
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
666
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
667
+ }, z.ZodTypeAny, "passthrough">>, "many">;
668
+ kms_list: z.ZodArray<z.ZodObject<{
669
+ id: z.ZodString;
670
+ slug: z.ZodNullable<z.ZodString>;
671
+ url: z.ZodString;
672
+ version: z.ZodString;
673
+ chain_id: z.ZodNullable<z.ZodNumber>;
674
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
675
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
676
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
677
+ id: z.ZodString;
678
+ slug: z.ZodNullable<z.ZodString>;
679
+ url: z.ZodString;
680
+ version: z.ZodString;
681
+ chain_id: z.ZodNullable<z.ZodNumber>;
682
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
683
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
684
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
685
+ id: z.ZodString;
686
+ slug: z.ZodNullable<z.ZodString>;
687
+ url: z.ZodString;
688
+ version: z.ZodString;
689
+ chain_id: z.ZodNullable<z.ZodNumber>;
690
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
691
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
692
+ }, z.ZodTypeAny, "passthrough">>, "many">;
693
+ }, z.ZodTypeAny, "passthrough">>;
694
+ type AvailableNodes = z.infer<typeof AvailableNodesSchema>;
695
+ type GetAvailableNodesParameters<T = undefined> = ActionParameters<T>;
696
+ type GetAvailableNodesReturnType<T = undefined> = ActionReturnType<AvailableNodes, T>;
697
+ declare function getAvailableNodes<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: GetAvailableNodesParameters<T>): Promise<GetAvailableNodesReturnType<T>>;
698
+ declare function safeGetAvailableNodes<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: GetAvailableNodesParameters<T>): Promise<SafeResult<GetAvailableNodesReturnType<T>>>;
699
+
700
+ /**
701
+ * Provision a CVM (Confidential Virtual Machine)
702
+ *
703
+ * This action provisions a new CVM on a specified node, returning the app_id, encryption public key, and other metadata required for secure deployment.
704
+ *
705
+ * @example
706
+ * ```typescript
707
+ * import { createClient, getAvailableNodes, provisionCvm } from '@phala/cloud'
708
+ *
709
+ * const client = createClient();
710
+ * const nodes = await getAvailableNodes(client);
711
+ * const node = nodes.nodes[0];
712
+ *
713
+ * const docker_compose = `
714
+ *version: '3'
715
+ *services:
716
+ * demo:
717
+ * image: leechael/phala-cloud-bun-starter:latest
718
+ * container_name: demo
719
+ * ports:
720
+ * - "3000:3000"
721
+ * volumes:
722
+ * - /var/run/tappd.sock:/var/run/tappd.sock
723
+ *`;
724
+ *
725
+ * const app_compose = {
726
+ * name: 'my-app',
727
+ * node_id: node.node_id,
728
+ * image: node.images[0].name,
729
+ * vcpu: 1,
730
+ * memory: 1024,
731
+ * disk_size: 10,
732
+ * compose_file: {
733
+ * docker_compose_file: docker_compose,
734
+ * name: 'my-app',
735
+ * },
736
+ * };
737
+ *
738
+ * const result = await provisionCvm(client, app_compose);
739
+ * console.log(result.app_id);
740
+ * ```
741
+ *
742
+ * ## Safe Version
743
+ *
744
+ * Use `safeProvisionCvm` for error handling without exceptions:
745
+ *
746
+ * ```typescript
747
+ * const result = await safeProvisionCvm(client, app_compose);
748
+ * if (result.success) {
749
+ * console.log(result.data.app_id);
750
+ * } else {
751
+ * console.error('Failed to provision CVM:', result.error.message);
752
+ * }
753
+ * ```
754
+ */
755
+ declare const ProvisionCvmSchema: z.ZodObject<{
756
+ app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
757
+ app_env_encrypt_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
758
+ compose_hash: z.ZodString;
759
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
760
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
761
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
762
+ node_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
763
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
764
+ app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
765
+ app_env_encrypt_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
766
+ compose_hash: z.ZodString;
767
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
768
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
769
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
770
+ node_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
771
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
772
+ app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
773
+ app_env_encrypt_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
774
+ compose_hash: z.ZodString;
775
+ fmspc: z.ZodOptional<z.ZodNullable<z.ZodString>>;
776
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
777
+ os_image_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
778
+ node_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
779
+ }, z.ZodTypeAny, "passthrough">>;
780
+ type ProvisionCvm = z.infer<typeof ProvisionCvmSchema>;
781
+ declare const ProvisionCvmRequestSchema: z.ZodObject<{
782
+ node_id: z.ZodOptional<z.ZodNumber>;
783
+ teepod_id: z.ZodOptional<z.ZodNumber>;
784
+ name: z.ZodString;
785
+ image: z.ZodString;
786
+ vcpu: z.ZodNumber;
787
+ memory: z.ZodNumber;
788
+ disk_size: z.ZodNumber;
789
+ compose_file: z.ZodObject<{
790
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
791
+ pre_launch_script: z.ZodOptional<z.ZodString>;
792
+ docker_compose_file: z.ZodOptional<z.ZodString>;
793
+ name: z.ZodOptional<z.ZodString>;
794
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
795
+ public_logs: z.ZodOptional<z.ZodBoolean>;
796
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
797
+ gateway_enabled: z.ZodOptional<z.ZodBoolean>;
798
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
799
+ }, "strip", z.ZodTypeAny, {
800
+ docker_compose_file?: string | undefined;
801
+ pre_launch_script?: string | undefined;
802
+ name?: string | undefined;
803
+ allowed_envs?: string[] | undefined;
804
+ kms_enabled?: boolean | undefined;
805
+ public_logs?: boolean | undefined;
806
+ public_sysinfo?: boolean | undefined;
807
+ gateway_enabled?: boolean | undefined;
808
+ tproxy_enabled?: boolean | undefined;
809
+ }, {
810
+ docker_compose_file?: string | undefined;
811
+ pre_launch_script?: string | undefined;
812
+ name?: string | undefined;
813
+ allowed_envs?: string[] | undefined;
814
+ kms_enabled?: boolean | undefined;
815
+ public_logs?: boolean | undefined;
816
+ public_sysinfo?: boolean | undefined;
817
+ gateway_enabled?: boolean | undefined;
818
+ tproxy_enabled?: boolean | undefined;
819
+ }>;
820
+ listed: z.ZodOptional<z.ZodBoolean>;
821
+ instance_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
822
+ kms_id: z.ZodOptional<z.ZodString>;
823
+ env_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
824
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
825
+ node_id: z.ZodOptional<z.ZodNumber>;
826
+ teepod_id: z.ZodOptional<z.ZodNumber>;
827
+ name: z.ZodString;
828
+ image: z.ZodString;
829
+ vcpu: z.ZodNumber;
830
+ memory: z.ZodNumber;
831
+ disk_size: z.ZodNumber;
832
+ compose_file: z.ZodObject<{
833
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
834
+ pre_launch_script: z.ZodOptional<z.ZodString>;
835
+ docker_compose_file: z.ZodOptional<z.ZodString>;
836
+ name: z.ZodOptional<z.ZodString>;
837
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
838
+ public_logs: z.ZodOptional<z.ZodBoolean>;
839
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
840
+ gateway_enabled: z.ZodOptional<z.ZodBoolean>;
841
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
842
+ }, "strip", z.ZodTypeAny, {
843
+ docker_compose_file?: string | undefined;
844
+ pre_launch_script?: string | undefined;
845
+ name?: string | undefined;
846
+ allowed_envs?: string[] | undefined;
847
+ kms_enabled?: boolean | undefined;
848
+ public_logs?: boolean | undefined;
849
+ public_sysinfo?: boolean | undefined;
850
+ gateway_enabled?: boolean | undefined;
851
+ tproxy_enabled?: boolean | undefined;
852
+ }, {
853
+ docker_compose_file?: string | undefined;
854
+ pre_launch_script?: string | undefined;
855
+ name?: string | undefined;
856
+ allowed_envs?: string[] | undefined;
857
+ kms_enabled?: boolean | undefined;
858
+ public_logs?: boolean | undefined;
859
+ public_sysinfo?: boolean | undefined;
860
+ gateway_enabled?: boolean | undefined;
861
+ tproxy_enabled?: boolean | undefined;
862
+ }>;
863
+ listed: z.ZodOptional<z.ZodBoolean>;
864
+ instance_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
865
+ kms_id: z.ZodOptional<z.ZodString>;
866
+ env_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
867
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
868
+ node_id: z.ZodOptional<z.ZodNumber>;
869
+ teepod_id: z.ZodOptional<z.ZodNumber>;
870
+ name: z.ZodString;
871
+ image: z.ZodString;
872
+ vcpu: z.ZodNumber;
873
+ memory: z.ZodNumber;
874
+ disk_size: z.ZodNumber;
875
+ compose_file: z.ZodObject<{
876
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
877
+ pre_launch_script: z.ZodOptional<z.ZodString>;
878
+ docker_compose_file: z.ZodOptional<z.ZodString>;
879
+ name: z.ZodOptional<z.ZodString>;
880
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
881
+ public_logs: z.ZodOptional<z.ZodBoolean>;
882
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
883
+ gateway_enabled: z.ZodOptional<z.ZodBoolean>;
884
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
885
+ }, "strip", z.ZodTypeAny, {
886
+ docker_compose_file?: string | undefined;
887
+ pre_launch_script?: string | undefined;
888
+ name?: string | undefined;
889
+ allowed_envs?: string[] | undefined;
890
+ kms_enabled?: boolean | undefined;
891
+ public_logs?: boolean | undefined;
892
+ public_sysinfo?: boolean | undefined;
893
+ gateway_enabled?: boolean | undefined;
894
+ tproxy_enabled?: boolean | undefined;
895
+ }, {
896
+ docker_compose_file?: string | undefined;
897
+ pre_launch_script?: string | undefined;
898
+ name?: string | undefined;
899
+ allowed_envs?: string[] | undefined;
900
+ kms_enabled?: boolean | undefined;
901
+ public_logs?: boolean | undefined;
902
+ public_sysinfo?: boolean | undefined;
903
+ gateway_enabled?: boolean | undefined;
904
+ tproxy_enabled?: boolean | undefined;
905
+ }>;
906
+ listed: z.ZodOptional<z.ZodBoolean>;
907
+ instance_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
908
+ kms_id: z.ZodOptional<z.ZodString>;
909
+ env_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
910
+ }, z.ZodTypeAny, "passthrough">>;
911
+ type ProvisionCvmRequest = z.infer<typeof ProvisionCvmRequestSchema> & {
912
+ node_id?: number;
913
+ teepod_id?: number;
914
+ compose_file?: {
915
+ gateway_enabled?: boolean;
916
+ tproxy_enabled?: boolean;
917
+ [key: string]: unknown;
918
+ };
919
+ };
920
+ type ProvisionCvmParameters<T = undefined> = ActionParameters<T>;
921
+ type ProvisionCvmReturnType<T = undefined> = ActionReturnType<ProvisionCvm, T>;
922
+ declare function provisionCvm<T extends z.ZodSchema | false | undefined = undefined>(client: Client, appCompose: ProvisionCvmRequest, parameters?: ProvisionCvmParameters<T>): Promise<ProvisionCvmReturnType<T>>;
923
+ declare function safeProvisionCvm<T extends z.ZodSchema | false | undefined = undefined>(client: Client, appCompose: ProvisionCvmRequest, parameters?: ProvisionCvmParameters<T>): Promise<SafeResult<ProvisionCvmReturnType<T>>>;
924
+
925
+ /**
926
+ * Commit CVM Provision (Create CVM from provisioned data)
927
+ *
928
+ * This action creates a CVM using previously provisioned data and encrypted environment variables.
929
+ * It should be called after `provisionCvm` to complete the CVM deployment process.
930
+ *
931
+ * @example
932
+ * ```typescript
933
+ * import { createClient, provisionCvm, commitCvmProvision } from '@phala/cloud'
934
+ *
935
+ * const client = createClient();
936
+ *
937
+ * // First, provision the CVM
938
+ * const provision = await provisionCvm(client, appCompose);
939
+ *
940
+ * // Then, commit the provision with encrypted environment variables
941
+ * const cvm = await commitCvmProvision(client, {
942
+ * encrypted_env: "hex-encoded-encrypted-environment-data", // String, not array
943
+ * app_id: provision.app_id,
944
+ * compose_hash: provision.compose_hash,
945
+ * kms_id: "your-kms-id",
946
+ * contract_address: "0x123...",
947
+ * deployer_address: "0x456..."
948
+ * });
949
+ *
950
+ * console.log(cvm.id);
951
+ * ```
952
+ *
953
+ * ## Returns
954
+ *
955
+ * `CommitCvmProvision | unknown`
956
+ *
957
+ * The created CVM details including id, name, status, and other metadata. Return type depends on schema parameter.
958
+ *
959
+ * ## Parameters
960
+ *
961
+ * ### schema (optional)
962
+ *
963
+ * - **Type:** `ZodSchema | false`
964
+ * - **Default:** `CommitCvmProvisionSchema`
965
+ *
966
+ * Schema to validate the response. Use `false` to return raw data without validation.
967
+ *
968
+ * ```typescript
969
+ * // Use default schema
970
+ * const result = await commitCvmProvision(client, payload)
971
+ *
972
+ * // Return raw data without validation
973
+ * const raw = await commitCvmProvision(client, payload, { schema: false })
974
+ *
975
+ * // Use custom schema
976
+ * const customSchema = z.object({ id: z.number(), name: z.string() })
977
+ * const custom = await commitCvmProvision(client, payload, { schema: customSchema })
978
+ * ```
979
+ *
980
+ * ## Safe Version
981
+ *
982
+ * Use `safeCommitCvmProvision` for error handling without exceptions:
983
+ *
984
+ * ```typescript
985
+ * import { safeCommitCvmProvision } from '@phala/cloud'
986
+ *
987
+ * const result = await safeCommitCvmProvision(client, payload)
988
+ * if (result.success) {
989
+ * console.log(result.data)
990
+ * } else {
991
+ * if ("isRequestError" in result.error) {
992
+ * console.error(`HTTP ${result.error.status}: ${result.error.message}`)
993
+ * } else {
994
+ * console.error(`Validation error: ${result.error.issues}`)
995
+ * }
996
+ * }
997
+ * ```
998
+ */
999
+ declare const CommitCvmProvisionSchema: z.ZodObject<{
1000
+ id: z.ZodNumber;
1001
+ name: z.ZodString;
1002
+ status: z.ZodString;
1003
+ teepod_id: z.ZodNumber;
1004
+ teepod: z.ZodNullable<z.ZodObject<{
1005
+ id: z.ZodNumber;
1006
+ name: z.ZodString;
1007
+ }, "strip", z.ZodTypeAny, {
1008
+ name: string;
1009
+ id: number;
1010
+ }, {
1011
+ name: string;
1012
+ id: number;
1013
+ }>>;
1014
+ user_id: z.ZodNullable<z.ZodNumber>;
1015
+ app_id: z.ZodNullable<z.ZodString>;
1016
+ vm_uuid: z.ZodNullable<z.ZodString>;
1017
+ instance_id: z.ZodNullable<z.ZodString>;
1018
+ app_url: z.ZodNullable<z.ZodString>;
1019
+ base_image: z.ZodNullable<z.ZodString>;
1020
+ vcpu: z.ZodNumber;
1021
+ memory: z.ZodNumber;
1022
+ disk_size: z.ZodNumber;
1023
+ manifest_version: z.ZodNullable<z.ZodNumber>;
1024
+ version: z.ZodNullable<z.ZodString>;
1025
+ runner: z.ZodNullable<z.ZodString>;
1026
+ docker_compose_file: z.ZodNullable<z.ZodString>;
1027
+ features: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
1028
+ created_at: z.ZodString;
1029
+ encrypted_env_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1030
+ app_auth_contract_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1031
+ deployer_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1032
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1033
+ id: z.ZodNumber;
1034
+ name: z.ZodString;
1035
+ status: z.ZodString;
1036
+ teepod_id: z.ZodNumber;
1037
+ teepod: z.ZodNullable<z.ZodObject<{
1038
+ id: z.ZodNumber;
1039
+ name: z.ZodString;
1040
+ }, "strip", z.ZodTypeAny, {
1041
+ name: string;
1042
+ id: number;
1043
+ }, {
1044
+ name: string;
1045
+ id: number;
1046
+ }>>;
1047
+ user_id: z.ZodNullable<z.ZodNumber>;
1048
+ app_id: z.ZodNullable<z.ZodString>;
1049
+ vm_uuid: z.ZodNullable<z.ZodString>;
1050
+ instance_id: z.ZodNullable<z.ZodString>;
1051
+ app_url: z.ZodNullable<z.ZodString>;
1052
+ base_image: z.ZodNullable<z.ZodString>;
1053
+ vcpu: z.ZodNumber;
1054
+ memory: z.ZodNumber;
1055
+ disk_size: z.ZodNumber;
1056
+ manifest_version: z.ZodNullable<z.ZodNumber>;
1057
+ version: z.ZodNullable<z.ZodString>;
1058
+ runner: z.ZodNullable<z.ZodString>;
1059
+ docker_compose_file: z.ZodNullable<z.ZodString>;
1060
+ features: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
1061
+ created_at: z.ZodString;
1062
+ encrypted_env_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1063
+ app_auth_contract_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1064
+ deployer_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1065
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1066
+ id: z.ZodNumber;
1067
+ name: z.ZodString;
1068
+ status: z.ZodString;
1069
+ teepod_id: z.ZodNumber;
1070
+ teepod: z.ZodNullable<z.ZodObject<{
1071
+ id: z.ZodNumber;
1072
+ name: z.ZodString;
1073
+ }, "strip", z.ZodTypeAny, {
1074
+ name: string;
1075
+ id: number;
1076
+ }, {
1077
+ name: string;
1078
+ id: number;
1079
+ }>>;
1080
+ user_id: z.ZodNullable<z.ZodNumber>;
1081
+ app_id: z.ZodNullable<z.ZodString>;
1082
+ vm_uuid: z.ZodNullable<z.ZodString>;
1083
+ instance_id: z.ZodNullable<z.ZodString>;
1084
+ app_url: z.ZodNullable<z.ZodString>;
1085
+ base_image: z.ZodNullable<z.ZodString>;
1086
+ vcpu: z.ZodNumber;
1087
+ memory: z.ZodNumber;
1088
+ disk_size: z.ZodNumber;
1089
+ manifest_version: z.ZodNullable<z.ZodNumber>;
1090
+ version: z.ZodNullable<z.ZodString>;
1091
+ runner: z.ZodNullable<z.ZodString>;
1092
+ docker_compose_file: z.ZodNullable<z.ZodString>;
1093
+ features: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
1094
+ created_at: z.ZodString;
1095
+ encrypted_env_pubkey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1096
+ app_auth_contract_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1097
+ deployer_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1098
+ }, z.ZodTypeAny, "passthrough">>;
1099
+ type CommitCvmProvision = z.infer<typeof CommitCvmProvisionSchema>;
1100
+ declare const CommitCvmProvisionRequestSchema: z.ZodObject<{
1101
+ encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1102
+ app_id: z.ZodString;
1103
+ compose_hash: z.ZodOptional<z.ZodString>;
1104
+ kms_id: z.ZodOptional<z.ZodString>;
1105
+ contract_address: z.ZodOptional<z.ZodString>;
1106
+ deployer_address: z.ZodOptional<z.ZodString>;
1107
+ env_keys: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1108
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1109
+ encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1110
+ app_id: z.ZodString;
1111
+ compose_hash: z.ZodOptional<z.ZodString>;
1112
+ kms_id: z.ZodOptional<z.ZodString>;
1113
+ contract_address: z.ZodOptional<z.ZodString>;
1114
+ deployer_address: z.ZodOptional<z.ZodString>;
1115
+ env_keys: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1116
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1117
+ encrypted_env: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1118
+ app_id: z.ZodString;
1119
+ compose_hash: z.ZodOptional<z.ZodString>;
1120
+ kms_id: z.ZodOptional<z.ZodString>;
1121
+ contract_address: z.ZodOptional<z.ZodString>;
1122
+ deployer_address: z.ZodOptional<z.ZodString>;
1123
+ env_keys: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1124
+ }, z.ZodTypeAny, "passthrough">>;
1125
+ type CommitCvmProvisionRequest = z.infer<typeof CommitCvmProvisionRequestSchema>;
1126
+ type CommitCvmProvisionParameters<T = undefined> = ActionParameters<T>;
1127
+ type CommitCvmProvisionReturnType<T = undefined> = ActionReturnType<CommitCvmProvision, T>;
1128
+ declare function commitCvmProvision<T extends z.ZodSchema | false | undefined = undefined>(client: Client, payload: CommitCvmProvisionRequest, parameters?: CommitCvmProvisionParameters<T>): Promise<CommitCvmProvisionReturnType<T>>;
1129
+ declare function safeCommitCvmProvision<T extends z.ZodSchema | false | undefined = undefined>(client: Client, payload: CommitCvmProvisionRequest, parameters?: CommitCvmProvisionParameters<T>): Promise<SafeResult<CommitCvmProvisionReturnType<T>>>;
1130
+
1131
+ type SortableValue = string | number | boolean | null | undefined | SortableObject | SortableArray;
1132
+ interface SortableObject {
1133
+ [key: string]: SortableValue;
1134
+ }
1135
+ interface SortableArray extends Array<SortableValue> {
1136
+ }
1137
+ interface AppCompose extends SortableObject {
1138
+ runner?: string;
1139
+ docker_compose_file?: string;
1140
+ bash_script?: string;
1141
+ pre_launch_script?: string;
1142
+ }
1143
+
1144
+ declare function getErrorMessage(error: ApiError): string;
1145
+
1146
+ /**
1147
+ * Converts a value to a hex string with 0x prefix.
1148
+ *
1149
+ * @param value - The value to convert to hex. Can be a string with or without 0x prefix.
1150
+ * @returns A valid hex string with 0x prefix.
1151
+ * @throws Error if the value cannot be converted to a valid hex string.
1152
+ *
1153
+ * @example
1154
+ * ```typescript
1155
+ * asHex("abc123") // "0xabc123"
1156
+ * asHex("0xabc123") // "0xabc123"
1157
+ * asHex("xyz") // throws Error
1158
+ * ```
1159
+ */
1160
+ declare function asHex(value: unknown): Hex;
1161
+
1162
+ /**
1163
+ * Validates action parameters, specifically the schema parameter
1164
+ *
1165
+ * @param parameters - The parameters to validate
1166
+ * @throws Error if schema parameter is invalid (for non-safe functions)
1167
+ */
1168
+ declare function validateActionParameters<T>(parameters?: {
1169
+ schema?: T;
1170
+ }): void;
1171
+ /**
1172
+ * Validates action parameters for safe functions
1173
+ *
1174
+ * @param parameters - The parameters to validate
1175
+ * @returns SafeResult with error if validation fails, undefined if validation passes
1176
+ */
1177
+ declare function safeValidateActionParameters<T, ReturnType>(parameters?: {
1178
+ schema?: T;
1179
+ }): SafeResult<ReturnType> | undefined;
1180
+
1181
+ interface NetworkClients {
1182
+ publicClient: PublicClient;
1183
+ walletClient: WalletClient;
1184
+ address: Address;
1185
+ chainId: number;
1186
+ }
1187
+ interface NetworkConfig {
1188
+ chainId: number;
1189
+ name: string;
1190
+ rpcUrl: string;
1191
+ blockExplorer?: string;
1192
+ }
1193
+ interface WalletConnection {
1194
+ address: Address;
1195
+ chainId: number;
1196
+ }
1197
+ interface BalanceCheckResult {
1198
+ address: Address;
1199
+ balance: bigint;
1200
+ sufficient: boolean;
1201
+ required?: bigint;
1202
+ }
1203
+ interface TransactionOptions {
1204
+ timeout?: number;
1205
+ confirmations?: number;
1206
+ onSubmitted?: (hash: Hash) => void;
1207
+ onConfirmed?: (receipt: TransactionReceipt) => void;
1208
+ onError?: (error: Error, hash?: Hash) => void;
1209
+ }
1210
+ interface TransactionResult {
1211
+ hash: Hash;
1212
+ receipt: TransactionReceipt;
1213
+ success: boolean;
1214
+ }
1215
+ declare class NetworkError extends Error {
1216
+ code?: string | undefined;
1217
+ details?: unknown | undefined;
1218
+ constructor(message: string, code?: string | undefined, details?: unknown | undefined);
1219
+ }
1220
+ declare class WalletError extends Error {
1221
+ code?: string | undefined;
1222
+ details?: unknown | undefined;
1223
+ constructor(message: string, code?: string | undefined, details?: unknown | undefined);
1224
+ }
1225
+ declare class TransactionError extends Error {
1226
+ hash?: Hash | undefined;
1227
+ details?: unknown | undefined;
1228
+ constructor(message: string, hash?: Hash | undefined, details?: unknown | undefined);
1229
+ }
1230
+ /**
1231
+ * Create a NetworkClients object from existing viem clients
1232
+ * This is the primary way to create NetworkClients - the caller provides pre-configured clients
1233
+ */
1234
+ declare function createNetworkClients(publicClient: PublicClient, walletClient: WalletClient, address: Address, chainId: number): NetworkClients;
1235
+ /**
1236
+ * Check wallet connection and network status
1237
+ */
1238
+ declare function checkNetworkStatus(clients: NetworkClients, targetChainId: number): Promise<{
1239
+ isCorrectNetwork: boolean;
1240
+ currentChainId: number;
1241
+ }>;
1242
+ /**
1243
+ * Check wallet balance
1244
+ */
1245
+ declare function checkBalance(publicClient: PublicClient, address: Address, minBalance?: bigint): Promise<BalanceCheckResult>;
1246
+ /**
1247
+ * Wait for transaction receipt with timeout and polling
1248
+ */
1249
+ declare function waitForTransactionReceipt(publicClient: PublicClient, hash: Hash, options?: {
1250
+ timeout?: number;
1251
+ pollingInterval?: number;
1252
+ confirmations?: number;
1253
+ }): Promise<TransactionReceipt>;
1254
+ /**
1255
+ * Execute a transaction with automatic receipt waiting and error handling
1256
+ */
1257
+ declare function executeTransaction<T extends unknown[]>(clients: NetworkClients, operation: (clients: NetworkClients, ...args: T) => Promise<Hash>, args: T, options?: TransactionOptions): Promise<TransactionResult>;
1258
+ /**
1259
+ * Extract NetworkClients info from existing viem clients
1260
+ * Useful when you have existing clients and want to create a NetworkClients object
1261
+ */
1262
+ declare function extractNetworkClients(publicClient: PublicClient, walletClient: WalletClient): Promise<NetworkClients>;
1263
+ /**
1264
+ * Comprehensive network validation
1265
+ */
1266
+ declare function validateNetworkPrerequisites(clients: NetworkClients, requirements: {
1267
+ targetChainId: number;
1268
+ minBalance?: bigint;
1269
+ requiredAddress?: Address;
1270
+ }): Promise<{
1271
+ networkValid: boolean;
1272
+ balanceValid: boolean;
1273
+ addressValid: boolean;
1274
+ details: {
1275
+ currentChainId: number;
1276
+ balance: bigint;
1277
+ address: Address;
1278
+ };
1279
+ }>;
1280
+
1281
+ type TransactionState = "idle" | "submitting" | "pending" | "success" | "error" | "timeout";
1282
+ interface TransactionStatus {
1283
+ state: TransactionState;
1284
+ hash?: Hash;
1285
+ receipt?: TransactionReceipt;
1286
+ error?: string;
1287
+ startTime?: number;
1288
+ submitTime?: number;
1289
+ confirmTime?: number;
1290
+ aborted?: boolean;
1291
+ }
1292
+ interface TransactionTracker {
1293
+ readonly status: TransactionStatus;
1294
+ readonly isIdle: boolean;
1295
+ readonly isSubmitting: boolean;
1296
+ readonly isPending: boolean;
1297
+ readonly isSuccess: boolean;
1298
+ readonly isError: boolean;
1299
+ readonly isTimeout: boolean;
1300
+ readonly isAborted: boolean;
1301
+ readonly isComplete: boolean;
1302
+ abort(): void;
1303
+ reset(): void;
1304
+ execute<T extends unknown[]>(operation: (clients: NetworkClients, ...args: T) => Promise<Hash>, clients: NetworkClients, args: T, options?: TransactionOptions & {
1305
+ signal?: AbortSignal;
1306
+ }): Promise<TransactionResult>;
1307
+ }
1308
+ /**
1309
+ * Create a transaction tracker for monitoring transaction state
1310
+ */
1311
+ declare function createTransactionTracker(): TransactionTracker;
1312
+ /**
1313
+ * Batch transaction executor with sequential or parallel execution
1314
+ */
1315
+ interface BatchTransactionOptions {
1316
+ mode: "sequential" | "parallel";
1317
+ failFast?: boolean;
1318
+ timeout?: number;
1319
+ onProgress?: (completed: number, total: number, results: (TransactionResult | Error)[]) => void;
1320
+ }
1321
+ interface BatchTransactionResult {
1322
+ results: (TransactionResult | Error)[];
1323
+ successCount: number;
1324
+ errorCount: number;
1325
+ allSuccessful: boolean;
1326
+ }
1327
+ /**
1328
+ * Execute multiple transactions in batch
1329
+ */
1330
+ declare function executeBatchTransactions<T extends unknown[]>(operations: Array<{
1331
+ operation: (clients: NetworkClients, ...args: T) => Promise<Hash>;
1332
+ args: T;
1333
+ options?: TransactionOptions;
1334
+ }>, clients: NetworkClients, batchOptions: BatchTransactionOptions): Promise<BatchTransactionResult>;
1335
+ /**
1336
+ * Transaction retry utility with exponential backoff
1337
+ */
1338
+ interface RetryOptions {
1339
+ maxRetries?: number;
1340
+ initialDelay?: number;
1341
+ maxDelay?: number;
1342
+ backoffFactor?: number;
1343
+ retryCondition?: (error: Error) => boolean;
1344
+ }
1345
+ declare function executeTransactionWithRetry<T extends unknown[]>(operation: (clients: NetworkClients, ...args: T) => Promise<Hash>, clients: NetworkClients, args: T, options?: TransactionOptions, retryOptions?: RetryOptions): Promise<TransactionResult>;
1346
+ /**
1347
+ * Smart gas estimation and transaction optimization
1348
+ */
1349
+ interface GasEstimationOptions {
1350
+ gasLimitMultiplier?: number;
1351
+ maxFeePerGasMultiplier?: number;
1352
+ priorityFeeMultiplier?: number;
1353
+ }
1354
+ declare function estimateTransactionGas(clients: NetworkClients, transaction: Parameters<typeof clients.publicClient.estimateGas>[0], options?: GasEstimationOptions): Promise<{
1355
+ gasLimit: bigint;
1356
+ maxFeePerGas?: bigint;
1357
+ maxPriorityFeePerGas?: bigint;
1358
+ }>;
1359
+
1360
+ interface EthereumProvider {
1361
+ request: (args: {
1362
+ method: string;
1363
+ params?: unknown[];
1364
+ }) => Promise<unknown>;
1365
+ on?(event: string, handler: (...args: unknown[]) => void): void;
1366
+ removeListener?(event: string, handler: (...args: unknown[]) => void): void;
1367
+ }
1368
+ /**
1369
+ * CONVENIENCE: Create clients from private key (server-side)
1370
+ * You can also create your own viem clients and use createNetworkClients() directly
1371
+ */
1372
+ declare function createClientsFromPrivateKey(chain: Chain, privateKey: Hash, rpcUrl?: string): NetworkClients;
1373
+ /**
1374
+ * CONVENIENCE: Create clients from browser wallet (client-side)
1375
+ * You can also create your own viem clients and use createNetworkClients() directly
1376
+ */
1377
+ declare function createClientsFromBrowser(chain: Chain, rpcUrl?: string): Promise<NetworkClients>;
1378
+ /**
1379
+ * CONVENIENCE: Switch to a specific network in browser wallet
1380
+ */
1381
+ declare function switchToNetwork(provider: EthereumProvider, chainId: number): Promise<void>;
1382
+ /**
1383
+ * CONVENIENCE: Add a custom network to browser wallet
1384
+ */
1385
+ declare function addNetwork(provider: EthereumProvider, config: {
1386
+ chainId: number;
1387
+ name: string;
1388
+ rpcUrl: string;
1389
+ blockExplorer?: string;
1390
+ }): Promise<void>;
1391
+ /**
1392
+ * CONVENIENCE: Auto-detect environment and create clients
1393
+ * You can also create your own viem clients and use createNetworkClients() directly
1394
+ */
1395
+ declare function autoCreateClients(chain: Chain, options?: {
1396
+ privateKey?: Hash;
1397
+ rpcUrl?: string;
1398
+ preferBrowser?: boolean;
1399
+ }): Promise<NetworkClients>;
1400
+
1401
+ declare const DeployAppAuthRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
1402
+ chain: z.ZodOptional<z.ZodUnknown>;
1403
+ kmsContractAddress: z.ZodString;
1404
+ privateKey: z.ZodOptional<z.ZodString>;
1405
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1406
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1407
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1408
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1409
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1410
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1411
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1412
+ minBalance: z.ZodOptional<z.ZodString>;
1413
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1414
+ chain: z.ZodOptional<z.ZodUnknown>;
1415
+ kmsContractAddress: z.ZodString;
1416
+ privateKey: z.ZodOptional<z.ZodString>;
1417
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1418
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1419
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1420
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1421
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1422
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1423
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1424
+ minBalance: z.ZodOptional<z.ZodString>;
1425
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1426
+ chain: z.ZodOptional<z.ZodUnknown>;
1427
+ kmsContractAddress: z.ZodString;
1428
+ privateKey: z.ZodOptional<z.ZodString>;
1429
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1430
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1431
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1432
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1433
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1434
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1435
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1436
+ minBalance: z.ZodOptional<z.ZodString>;
1437
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
1438
+ chain: z.ZodOptional<z.ZodUnknown>;
1439
+ kmsContractAddress: z.ZodString;
1440
+ privateKey: z.ZodOptional<z.ZodString>;
1441
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1442
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1443
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1444
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1445
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1446
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1447
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1448
+ minBalance: z.ZodOptional<z.ZodString>;
1449
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1450
+ chain: z.ZodOptional<z.ZodUnknown>;
1451
+ kmsContractAddress: z.ZodString;
1452
+ privateKey: z.ZodOptional<z.ZodString>;
1453
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1454
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1455
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1456
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1457
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1458
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1459
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1460
+ minBalance: z.ZodOptional<z.ZodString>;
1461
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
1462
+ chain: z.ZodOptional<z.ZodUnknown>;
1463
+ kmsContractAddress: z.ZodString;
1464
+ privateKey: z.ZodOptional<z.ZodString>;
1465
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1466
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1467
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1468
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1469
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1470
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1471
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1472
+ minBalance: z.ZodOptional<z.ZodString>;
1473
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1474
+ chain: z.ZodOptional<z.ZodUnknown>;
1475
+ kmsContractAddress: z.ZodString;
1476
+ privateKey: z.ZodOptional<z.ZodString>;
1477
+ walletClient: z.ZodOptional<z.ZodUnknown>;
1478
+ publicClient: z.ZodOptional<z.ZodUnknown>;
1479
+ allowAnyDevice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1480
+ deviceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1481
+ composeHash: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1482
+ disableUpgrades: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1483
+ skipPrerequisiteChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1484
+ minBalance: z.ZodOptional<z.ZodString>;
1485
+ }, z.ZodTypeAny, "passthrough">>;
1486
+ type DeployAppAuthRequest = {
1487
+ chain?: Chain;
1488
+ kmsContractAddress: Address;
1489
+ privateKey?: Hex;
1490
+ walletClient?: WalletClient;
1491
+ publicClient?: PublicClient;
1492
+ allowAnyDevice?: boolean;
1493
+ deviceId?: string;
1494
+ composeHash?: string;
1495
+ disableUpgrades?: boolean;
1496
+ skipPrerequisiteChecks?: boolean;
1497
+ minBalance?: string;
1498
+ timeout?: number;
1499
+ retryOptions?: RetryOptions;
1500
+ signal?: AbortSignal;
1501
+ onTransactionStateChange?: (state: TransactionTracker["status"]) => void;
1502
+ onTransactionSubmitted?: (hash: Hash) => void;
1503
+ onTransactionConfirmed?: (receipt: TransactionReceipt) => void;
1504
+ };
1505
+ declare const DeployAppAuthSchema: z.ZodObject<{
1506
+ appId: z.ZodString;
1507
+ appAuthAddress: z.ZodString;
1508
+ deployer: z.ZodString;
1509
+ transactionHash: z.ZodString;
1510
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1511
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1512
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1513
+ appId: z.ZodString;
1514
+ appAuthAddress: z.ZodString;
1515
+ deployer: z.ZodString;
1516
+ transactionHash: z.ZodString;
1517
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1518
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1519
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1520
+ appId: z.ZodString;
1521
+ appAuthAddress: z.ZodString;
1522
+ deployer: z.ZodString;
1523
+ transactionHash: z.ZodString;
1524
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1525
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1526
+ }, z.ZodTypeAny, "passthrough">>;
1527
+ type DeployAppAuth = z.infer<typeof DeployAppAuthSchema>;
1528
+ type DeployAppAuthParameters<T = undefined> = T extends z.ZodSchema ? {
1529
+ schema: T;
1530
+ } : T extends false ? {
1531
+ schema: false;
1532
+ } : {
1533
+ schema?: z.ZodSchema | false;
1534
+ };
1535
+ type DeployAppAuthReturnType<T = undefined> = T extends z.ZodSchema ? z.infer<T> : T extends false ? unknown : DeployAppAuth;
1536
+ declare function deployAppAuth<T extends z.ZodSchema | false | undefined = undefined>(request: DeployAppAuthRequest, parameters?: DeployAppAuthParameters<T>): Promise<DeployAppAuthReturnType<T>>;
1537
+ /**
1538
+ * Enhanced safe version with transaction tracking capabilities
1539
+ */
1540
+ type SafeDeployAppAuthResult<T = undefined> = {
1541
+ success: true;
1542
+ data: DeployAppAuthReturnType<T>;
1543
+ } | {
1544
+ success: false;
1545
+ error: {
1546
+ isRequestError: true;
1547
+ message: string;
1548
+ status: number;
1549
+ detail: string;
1550
+ };
1551
+ };
1552
+ declare function safeDeployAppAuth<T extends z.ZodSchema | false | undefined = undefined>(request: DeployAppAuthRequest, parameters?: DeployAppAuthParameters<T>): Promise<SafeDeployAppAuthResult<T>>;
1553
+
1554
+ type AddComposeHashRequest = {
1555
+ chain?: Chain;
1556
+ appId: Address;
1557
+ composeHash: string;
1558
+ privateKey?: Hex;
1559
+ walletClient?: WalletClient;
1560
+ publicClient?: PublicClient;
1561
+ skipPrerequisiteChecks?: boolean;
1562
+ minBalance?: string;
1563
+ timeout?: number;
1564
+ retryOptions?: RetryOptions;
1565
+ signal?: AbortSignal;
1566
+ onTransactionStateChange?: (state: TransactionTracker["status"]) => void;
1567
+ onTransactionSubmitted?: (hash: Hash) => void;
1568
+ onTransactionConfirmed?: (receipt: TransactionReceipt) => void;
1569
+ };
1570
+ declare const AddComposeHashSchema: z.ZodObject<{
1571
+ composeHash: z.ZodString;
1572
+ appId: z.ZodString;
1573
+ transactionHash: z.ZodString;
1574
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1575
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1576
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1577
+ composeHash: z.ZodString;
1578
+ appId: z.ZodString;
1579
+ transactionHash: z.ZodString;
1580
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1581
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1582
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1583
+ composeHash: z.ZodString;
1584
+ appId: z.ZodString;
1585
+ transactionHash: z.ZodString;
1586
+ blockNumber: z.ZodOptional<z.ZodBigInt>;
1587
+ gasUsed: z.ZodOptional<z.ZodBigInt>;
1588
+ }, z.ZodTypeAny, "passthrough">>;
1589
+ type AddComposeHash = z.infer<typeof AddComposeHashSchema>;
1590
+ type AddComposeHashParameters<T = undefined> = T extends z.ZodSchema ? {
1591
+ schema: T;
1592
+ } : T extends false ? {
1593
+ schema: false;
1594
+ } : {
1595
+ schema?: z.ZodSchema | false;
1596
+ };
1597
+ type AddComposeHashReturnType<T = undefined> = T extends z.ZodSchema ? z.infer<T> : T extends false ? unknown : AddComposeHash;
1598
+ declare function addComposeHash<T extends z.ZodSchema | false | undefined = undefined>(request: AddComposeHashRequest, parameters?: AddComposeHashParameters<T>): Promise<AddComposeHashReturnType<T>>;
1599
+ type SafeAddComposeHashResult<T = undefined> = {
1600
+ success: true;
1601
+ data: AddComposeHashReturnType<T>;
1602
+ } | {
1603
+ success: false;
1604
+ error: {
1605
+ isRequestError: true;
1606
+ message: string;
1607
+ status: number;
1608
+ detail: string;
1609
+ };
1610
+ };
1611
+ declare function safeAddComposeHash<T extends z.ZodSchema | false | undefined = undefined>(request: AddComposeHashRequest, parameters?: AddComposeHashParameters<T>): Promise<SafeAddComposeHashResult<T>>;
1612
+
1613
+ /**
1614
+ * Get CVM compose file configuration
1615
+ *
1616
+ * Retrieves the current Docker Compose file configuration and metadata for a specified CVM.
1617
+ *
1618
+ * @example
1619
+ * ```typescript
1620
+ * import { createClient, getCvmComposeFile } from '@phala/cloud'
1621
+ *
1622
+ * const client = createClient({ apiKey: 'your-api-key' })
1623
+ * const composeFile = await getCvmComposeFile(client, { id: 'cvm-123' })
1624
+ * // Output: { compose_content: '...', version: '...', last_modified: '...' }
1625
+ * ```
1626
+ *
1627
+ * ## Returns
1628
+ *
1629
+ * `GetCvmComposeFileResult | unknown`
1630
+ *
1631
+ * The CVM compose file configuration including compose_content and metadata. Return type depends on schema parameter.
1632
+ *
1633
+ * ## Parameters
1634
+ *
1635
+ * ### request (required)
1636
+ * - **Type:** `GetCvmComposeFileRequest`
1637
+ *
1638
+ * Request parameters containing the CVM identifier. Can be one of:
1639
+ * - id: The CVM ID
1640
+ * - uuid: The CVM UUID
1641
+ * - appId: The App ID (40 chars)
1642
+ * - instanceId: The Instance ID (40 chars)
1643
+ *
1644
+ * ### parameters (optional)
1645
+ * - **Type:** `GetCvmComposeFileParameters`
1646
+ *
1647
+ * Optional behavior parameters for schema validation.
1648
+ *
1649
+ * ```typescript
1650
+ * // Use default schema
1651
+ * const result = await getCvmComposeFile(client, { id: 'cvm-123' })
1652
+ *
1653
+ * // Return raw data without validation
1654
+ * const raw = await getCvmComposeFile(client, { id: 'cvm-123' }, { schema: false })
1655
+ *
1656
+ * // Use custom schema
1657
+ * const customSchema = z.object({ compose_content: z.string() })
1658
+ * const custom = await getCvmComposeFile(client, { id: 'cvm-123' }, { schema: customSchema })
1659
+ * ```
1660
+ *
1661
+ * ## Safe Version
1662
+ *
1663
+ * Use `safeGetCvmComposeFile` for error handling without exceptions:
1664
+ *
1665
+ * ```typescript
1666
+ * import { safeGetCvmComposeFile } from '@phala/cloud'
1667
+ *
1668
+ * const result = await safeGetCvmComposeFile(client, { id: 'cvm-123' })
1669
+ * if (result.success) {
1670
+ * console.log(result.data.compose_content)
1671
+ * } else {
1672
+ * if ("isRequestError" in result.error) {
1673
+ * console.error(`HTTP ${result.error.status}: ${result.error.message}`)
1674
+ * } else {
1675
+ * console.error(`Validation error: ${result.error.issues}`)
1676
+ * }
1677
+ * }
1678
+ * ```
1679
+ */
1680
+ declare const GetCvmComposeFileResultSchema: z.ZodObject<{
1681
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1682
+ docker_compose_file: z.ZodString;
1683
+ features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1684
+ name: z.ZodOptional<z.ZodString>;
1685
+ manifest_version: z.ZodOptional<z.ZodNumber>;
1686
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
1687
+ public_logs: z.ZodOptional<z.ZodBoolean>;
1688
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
1689
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
1690
+ pre_launch_script: z.ZodOptional<z.ZodString>;
1691
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1692
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1693
+ docker_compose_file: z.ZodString;
1694
+ features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1695
+ name: z.ZodOptional<z.ZodString>;
1696
+ manifest_version: z.ZodOptional<z.ZodNumber>;
1697
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
1698
+ public_logs: z.ZodOptional<z.ZodBoolean>;
1699
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
1700
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
1701
+ pre_launch_script: z.ZodOptional<z.ZodString>;
1702
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1703
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1704
+ docker_compose_file: z.ZodString;
1705
+ features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1706
+ name: z.ZodOptional<z.ZodString>;
1707
+ manifest_version: z.ZodOptional<z.ZodNumber>;
1708
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
1709
+ public_logs: z.ZodOptional<z.ZodBoolean>;
1710
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
1711
+ tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
1712
+ pre_launch_script: z.ZodOptional<z.ZodString>;
1713
+ }, z.ZodTypeAny, "passthrough">>;
1714
+ type GetCvmComposeFileResult = z.infer<typeof GetCvmComposeFileResultSchema>;
1715
+ type GetCvmComposeFileRequest = {
1716
+ id?: string;
1717
+ uuid?: string;
1718
+ app_id?: string;
1719
+ instance_id?: string;
1720
+ };
1721
+ type GetCvmComposeFileParameters<T = undefined> = ActionParameters<T>;
1722
+ type GetCvmComposeFileReturnType<T = undefined> = ActionReturnType<GetCvmComposeFileResult, T>;
1723
+ declare function getCvmComposeFile<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetCvmComposeFileRequest, parameters?: GetCvmComposeFileParameters<T>): Promise<GetCvmComposeFileReturnType<T>>;
1724
+ declare function safeGetCvmComposeFile<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetCvmComposeFileRequest, parameters?: GetCvmComposeFileParameters<T>): Promise<SafeResult<GetCvmComposeFileReturnType<T>>>;
1725
+
1726
+ /**
1727
+ * Provision CVM compose file update
1728
+ *
1729
+ * Provisions a CVM compose file update by uploading the new compose file configuration.
1730
+ * Returns a compose_hash that must be used with `commitCvmComposeFileUpdate` to finalize the update.
1731
+ *
1732
+ * @example
1733
+ * ```typescript
1734
+ * import { createClient, provisionCvmComposeFileUpdate } from '@phala/cloud'
1735
+ *
1736
+ * const client = createClient({ apiKey: 'your-api-key' })
1737
+ * const result = await provisionCvmComposeFileUpdate(client, {
1738
+ * id: 'cvm-123',
1739
+ * app_compose: {
1740
+ * name: 'my-app',
1741
+ * docker_compose_file: 'version: "3.8"\nservices:\n app:\n image: nginx'
1742
+ * }
1743
+ * })
1744
+ * console.log(`Compose hash: ${result.compose_hash}`)
1745
+ * ```
1746
+ *
1747
+ * ## Returns
1748
+ *
1749
+ * `ProvisionCvmComposeFileUpdateResult | unknown`
1750
+ *
1751
+ * Provision response including compose_hash and metadata needed for committing the update.
1752
+ * Return type depends on schema parameter.
1753
+ *
1754
+ * ## Parameters
1755
+ *
1756
+ * ### request (required)
1757
+ * - **Type:** `ProvisionCvmComposeFileUpdateRequest`
1758
+ *
1759
+ * Request parameters containing the CVM ID and compose file configuration.
1760
+ *
1761
+ * ### parameters (optional)
1762
+ * - **Type:** `ProvisionCvmComposeFileUpdateParameters`
1763
+ *
1764
+ * Optional behavior parameters for schema validation.
1765
+ *
1766
+ * ```typescript
1767
+ * // Use default schema
1768
+ * const result = await provisionCvmComposeFileUpdate(client, {
1769
+ * id: 'cvm-123',
1770
+ * app_compose: { name: 'my-app', docker_compose_file: '...' }
1771
+ * })
1772
+ *
1773
+ * // Return raw data without validation
1774
+ * const raw = await provisionCvmComposeFileUpdate(client, request, { schema: false })
1775
+ *
1776
+ * // Use custom schema
1777
+ * const customSchema = z.object({ compose_hash: z.string() })
1778
+ * const custom = await provisionCvmComposeFileUpdate(client, request, { schema: customSchema })
1779
+ * ```
1780
+ *
1781
+ * ## Safe Version
1782
+ *
1783
+ * Use `safeProvisionCvmComposeFileUpdate` for error handling without exceptions:
1784
+ *
1785
+ * ```typescript
1786
+ * import { safeProvisionCvmComposeFileUpdate } from '@phala/cloud'
1787
+ *
1788
+ * const result = await safeProvisionCvmComposeFileUpdate(client, {
1789
+ * id: 'cvm-123',
1790
+ * app_compose: { name: 'my-app', docker_compose_file: '...' }
1791
+ * })
1792
+ * if (result.success) {
1793
+ * console.log(`Compose hash: ${result.data.compose_hash}`)
1794
+ * } else {
1795
+ * if ("isRequestError" in result.error) {
1796
+ * console.error(`HTTP ${result.error.status}: ${result.error.message}`)
1797
+ * } else {
1798
+ * console.error(`Validation error: ${result.error.issues}`)
1799
+ * }
1800
+ * }
1801
+ * ```
1802
+ */
1803
+ declare const ProvisionCvmComposeFileUpdateRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
1804
+ id: z.ZodOptional<z.ZodString>;
1805
+ uuid: z.ZodOptional<z.ZodString>;
1806
+ app_id: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
1807
+ instance_id: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
1808
+ app_compose: z.ZodObject<{
1809
+ allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1810
+ docker_compose_file: z.ZodString;
1811
+ name: z.ZodString;
1812
+ kms_enabled: z.ZodOptional<z.ZodBoolean>;
1813
+ public_logs: z.ZodOptional<z.ZodBoolean>;
1814
+ public_sysinfo: z.ZodOptional<z.ZodBoolean>;
1815
+ pre_launch_script: z.ZodOptional<z.ZodString>;
1816
+ }, "strip", z.ZodTypeAny, {
1817
+ docker_compose_file: string;
1818
+ name: string;
1819
+ pre_launch_script?: string | undefined;
1820
+ allowed_envs?: string[] | undefined;
1821
+ kms_enabled?: boolean | undefined;
1822
+ public_logs?: boolean | undefined;
1823
+ public_sysinfo?: boolean | undefined;
1824
+ }, {
1825
+ docker_compose_file: string;
1826
+ name: string;
1827
+ pre_launch_script?: string | undefined;
1828
+ allowed_envs?: string[] | undefined;
1829
+ kms_enabled?: boolean | undefined;
1830
+ public_logs?: boolean | undefined;
1831
+ public_sysinfo?: boolean | undefined;
1832
+ }>;
1833
+ }, "strip", z.ZodTypeAny, {
1834
+ app_compose: {
1835
+ docker_compose_file: string;
1836
+ name: string;
1837
+ pre_launch_script?: string | undefined;
1838
+ allowed_envs?: string[] | undefined;
1839
+ kms_enabled?: boolean | undefined;
1840
+ public_logs?: boolean | undefined;
1841
+ public_sysinfo?: boolean | undefined;
1842
+ };
1843
+ id?: string | undefined;
1844
+ app_id?: string | undefined;
1845
+ instance_id?: string | undefined;
1846
+ uuid?: string | undefined;
1847
+ }, {
1848
+ app_compose: {
1849
+ docker_compose_file: string;
1850
+ name: string;
1851
+ pre_launch_script?: string | undefined;
1852
+ allowed_envs?: string[] | undefined;
1853
+ kms_enabled?: boolean | undefined;
1854
+ public_logs?: boolean | undefined;
1855
+ public_sysinfo?: boolean | undefined;
1856
+ };
1857
+ id?: string | undefined;
1858
+ app_id?: string | undefined;
1859
+ instance_id?: string | undefined;
1860
+ uuid?: string | undefined;
1861
+ }>, {
1862
+ app_compose: {
1863
+ docker_compose_file: string;
1864
+ name: string;
1865
+ pre_launch_script?: string | undefined;
1866
+ allowed_envs?: string[] | undefined;
1867
+ kms_enabled?: boolean | undefined;
1868
+ public_logs?: boolean | undefined;
1869
+ public_sysinfo?: boolean | undefined;
1870
+ };
1871
+ id?: string | undefined;
1872
+ app_id?: string | undefined;
1873
+ instance_id?: string | undefined;
1874
+ uuid?: string | undefined;
1875
+ }, {
1876
+ app_compose: {
1877
+ docker_compose_file: string;
1878
+ name: string;
1879
+ pre_launch_script?: string | undefined;
1880
+ allowed_envs?: string[] | undefined;
1881
+ kms_enabled?: boolean | undefined;
1882
+ public_logs?: boolean | undefined;
1883
+ public_sysinfo?: boolean | undefined;
1884
+ };
1885
+ id?: string | undefined;
1886
+ app_id?: string | undefined;
1887
+ instance_id?: string | undefined;
1888
+ uuid?: string | undefined;
1889
+ }>, {
1890
+ cvmId: string | undefined;
1891
+ request: {
1892
+ docker_compose_file: string;
1893
+ name: string;
1894
+ pre_launch_script?: string | undefined;
1895
+ allowed_envs?: string[] | undefined;
1896
+ kms_enabled?: boolean | undefined;
1897
+ public_logs?: boolean | undefined;
1898
+ public_sysinfo?: boolean | undefined;
1899
+ };
1900
+ _raw: {
1901
+ app_compose: {
1902
+ docker_compose_file: string;
1903
+ name: string;
1904
+ pre_launch_script?: string | undefined;
1905
+ allowed_envs?: string[] | undefined;
1906
+ kms_enabled?: boolean | undefined;
1907
+ public_logs?: boolean | undefined;
1908
+ public_sysinfo?: boolean | undefined;
1909
+ };
1910
+ id?: string | undefined;
1911
+ app_id?: string | undefined;
1912
+ instance_id?: string | undefined;
1913
+ uuid?: string | undefined;
1914
+ };
1915
+ }, {
1916
+ app_compose: {
1917
+ docker_compose_file: string;
1918
+ name: string;
1919
+ pre_launch_script?: string | undefined;
1920
+ allowed_envs?: string[] | undefined;
1921
+ kms_enabled?: boolean | undefined;
1922
+ public_logs?: boolean | undefined;
1923
+ public_sysinfo?: boolean | undefined;
1924
+ };
1925
+ id?: string | undefined;
1926
+ app_id?: string | undefined;
1927
+ instance_id?: string | undefined;
1928
+ uuid?: string | undefined;
1929
+ }>;
1930
+ declare const ProvisionCvmComposeFileUpdateResultSchema: z.ZodObject<{
1931
+ app_id: z.ZodNullable<z.ZodString>;
1932
+ device_id: z.ZodNullable<z.ZodString>;
1933
+ compose_hash: z.ZodString;
1934
+ kms_info: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1935
+ id: z.ZodString;
1936
+ slug: z.ZodNullable<z.ZodString>;
1937
+ url: z.ZodString;
1938
+ version: z.ZodString;
1939
+ chain_id: z.ZodNullable<z.ZodNumber>;
1940
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1941
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1942
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1943
+ id: z.ZodString;
1944
+ slug: z.ZodNullable<z.ZodString>;
1945
+ url: z.ZodString;
1946
+ version: z.ZodString;
1947
+ chain_id: z.ZodNullable<z.ZodNumber>;
1948
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1949
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1950
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1951
+ id: z.ZodString;
1952
+ slug: z.ZodNullable<z.ZodString>;
1953
+ url: z.ZodString;
1954
+ version: z.ZodString;
1955
+ chain_id: z.ZodNullable<z.ZodNumber>;
1956
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1957
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1958
+ }, z.ZodTypeAny, "passthrough">>>>;
1959
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1960
+ app_id: z.ZodNullable<z.ZodString>;
1961
+ device_id: z.ZodNullable<z.ZodString>;
1962
+ compose_hash: z.ZodString;
1963
+ kms_info: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1964
+ id: z.ZodString;
1965
+ slug: z.ZodNullable<z.ZodString>;
1966
+ url: z.ZodString;
1967
+ version: z.ZodString;
1968
+ chain_id: z.ZodNullable<z.ZodNumber>;
1969
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1970
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1971
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1972
+ id: z.ZodString;
1973
+ slug: z.ZodNullable<z.ZodString>;
1974
+ url: z.ZodString;
1975
+ version: z.ZodString;
1976
+ chain_id: z.ZodNullable<z.ZodNumber>;
1977
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1978
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1979
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1980
+ id: z.ZodString;
1981
+ slug: z.ZodNullable<z.ZodString>;
1982
+ url: z.ZodString;
1983
+ version: z.ZodString;
1984
+ chain_id: z.ZodNullable<z.ZodNumber>;
1985
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1986
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1987
+ }, z.ZodTypeAny, "passthrough">>>>;
1988
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1989
+ app_id: z.ZodNullable<z.ZodString>;
1990
+ device_id: z.ZodNullable<z.ZodString>;
1991
+ compose_hash: z.ZodString;
1992
+ kms_info: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1993
+ id: z.ZodString;
1994
+ slug: z.ZodNullable<z.ZodString>;
1995
+ url: z.ZodString;
1996
+ version: z.ZodString;
1997
+ chain_id: z.ZodNullable<z.ZodNumber>;
1998
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
1999
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2000
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2001
+ id: z.ZodString;
2002
+ slug: z.ZodNullable<z.ZodString>;
2003
+ url: z.ZodString;
2004
+ version: z.ZodString;
2005
+ chain_id: z.ZodNullable<z.ZodNumber>;
2006
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2007
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2008
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2009
+ id: z.ZodString;
2010
+ slug: z.ZodNullable<z.ZodString>;
2011
+ url: z.ZodString;
2012
+ version: z.ZodString;
2013
+ chain_id: z.ZodNullable<z.ZodNumber>;
2014
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2015
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2016
+ }, z.ZodTypeAny, "passthrough">>>>;
2017
+ }, z.ZodTypeAny, "passthrough">>;
2018
+ type ProvisionCvmComposeFileUpdateRequest = z.input<typeof ProvisionCvmComposeFileUpdateRequestSchema>;
2019
+ type ProvisionCvmComposeFileUpdateResult = z.infer<typeof ProvisionCvmComposeFileUpdateResultSchema>;
2020
+ type ProvisionCvmComposeFileUpdateParameters<T = undefined> = ActionParameters<T>;
2021
+ type ProvisionCvmComposeFileUpdateReturnType<T = undefined> = ActionReturnType<ProvisionCvmComposeFileUpdateResult, T>;
2022
+ /**
2023
+ * Provision a CVM compose file update
2024
+ *
2025
+ * @param client - The API client
2026
+ * @param request - Request parameters containing CVM ID and compose file configuration
2027
+ * @param parameters - Optional behavior parameters
2028
+ * @returns Update provision result
2029
+ */
2030
+ declare function provisionCvmComposeFileUpdate<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: ProvisionCvmComposeFileUpdateRequest, parameters?: ProvisionCvmComposeFileUpdateParameters<T>): Promise<ProvisionCvmComposeFileUpdateReturnType<T>>;
2031
+ /**
2032
+ * Safe version of provisionCvmComposeFileUpdate that returns a Result type instead of throwing
2033
+ */
2034
+ declare function safeProvisionCvmComposeFileUpdate<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: ProvisionCvmComposeFileUpdateRequest, parameters?: ProvisionCvmComposeFileUpdateParameters<T>): Promise<SafeResult<ProvisionCvmComposeFileUpdateReturnType<T>>>;
2035
+
2036
+ /**
2037
+ * Commit CVM compose file update
2038
+ *
2039
+ * Finalizes a CVM compose file update by committing the previously provisioned changes.
2040
+ * This should be called after `provisionCvmComposeFileUpdate` to complete the update process.
2041
+ *
2042
+ * @example
2043
+ * ```typescript
2044
+ * import { createClient, commitCvmComposeFileUpdate } from '@phala/cloud'
2045
+ *
2046
+ * const client = createClient({ apiKey: 'your-api-key' })
2047
+ * await commitCvmComposeFileUpdate(client, {
2048
+ * cvmId: 'cvm-123',
2049
+ * request: {
2050
+ * compose_hash: 'abc123...'
2051
+ * }
2052
+ * })
2053
+ * // Request accepted, update will be processed asynchronously
2054
+ * ```
2055
+ *
2056
+ * ## Returns
2057
+ *
2058
+ * `void | unknown`
2059
+ *
2060
+ * No response body (HTTP 202 Accepted). The update is processed asynchronously. Return type depends on schema parameter.
2061
+ *
2062
+ * ## Parameters
2063
+ *
2064
+ * ### request (required)
2065
+ * - **Type:** `CommitCvmComposeFileUpdateRequestData`
2066
+ *
2067
+ * Request parameters containing the CVM ID and commit request data.
2068
+ *
2069
+ * ### parameters (optional)
2070
+ * - **Type:** `CommitCvmComposeFileUpdateParameters`
2071
+ *
2072
+ * Optional behavior parameters for schema validation.
2073
+ *
2074
+ * ```typescript
2075
+ * // Use default schema (void response)
2076
+ * await commitCvmComposeFileUpdate(client, { cvmId: 'cvm-123', request: commitRequest })
2077
+ *
2078
+ * // Return raw data without validation
2079
+ * const raw = await commitCvmComposeFileUpdate(client, { cvmId: 'cvm-123', request: commitRequest }, { schema: false })
2080
+ *
2081
+ * // Use custom schema
2082
+ * const customSchema = z.object({ status: z.string() })
2083
+ * const custom = await commitCvmComposeFileUpdate(client, { cvmId: 'cvm-123', request: commitRequest }, { schema: customSchema })
2084
+ * ```
2085
+ *
2086
+ * ## Safe Version
2087
+ *
2088
+ * Use `safeCommitCvmComposeFileUpdate` for error handling without exceptions:
2089
+ *
2090
+ * ```typescript
2091
+ * import { safeCommitCvmComposeFileUpdate } from '@phala/cloud'
2092
+ *
2093
+ * const result = await safeCommitCvmComposeFileUpdate(client, { cvmId: 'cvm-123', request: commitRequest })
2094
+ * if (result.success) {
2095
+ * console.log('Compose file update committed successfully')
2096
+ * } else {
2097
+ * if ("isRequestError" in result.error) {
2098
+ * console.error(`HTTP ${result.error.status}: ${result.error.message}`)
2099
+ * } else {
2100
+ * console.error(`Validation error: ${result.error.issues}`)
2101
+ * }
2102
+ * }
2103
+ * ```
2104
+ */
2105
+ declare const CommitCvmComposeFileUpdateRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
2106
+ id: z.ZodOptional<z.ZodString>;
2107
+ uuid: z.ZodOptional<z.ZodString>;
2108
+ app_id: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
2109
+ instance_id: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
2110
+ compose_hash: z.ZodString;
2111
+ encrypted_env: z.ZodOptional<z.ZodString>;
2112
+ env_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2113
+ }, "strip", z.ZodTypeAny, {
2114
+ compose_hash: string;
2115
+ id?: string | undefined;
2116
+ app_id?: string | undefined;
2117
+ env_keys?: string[] | undefined;
2118
+ instance_id?: string | undefined;
2119
+ encrypted_env?: string | undefined;
2120
+ uuid?: string | undefined;
2121
+ }, {
2122
+ compose_hash: string;
2123
+ id?: string | undefined;
2124
+ app_id?: string | undefined;
2125
+ env_keys?: string[] | undefined;
2126
+ instance_id?: string | undefined;
2127
+ encrypted_env?: string | undefined;
2128
+ uuid?: string | undefined;
2129
+ }>, {
2130
+ compose_hash: string;
2131
+ id?: string | undefined;
2132
+ app_id?: string | undefined;
2133
+ env_keys?: string[] | undefined;
2134
+ instance_id?: string | undefined;
2135
+ encrypted_env?: string | undefined;
2136
+ uuid?: string | undefined;
2137
+ }, {
2138
+ compose_hash: string;
2139
+ id?: string | undefined;
2140
+ app_id?: string | undefined;
2141
+ env_keys?: string[] | undefined;
2142
+ instance_id?: string | undefined;
2143
+ encrypted_env?: string | undefined;
2144
+ uuid?: string | undefined;
2145
+ }>, {
2146
+ cvmId: string | undefined;
2147
+ compose_hash: string;
2148
+ encrypted_env: string | undefined;
2149
+ env_keys: string[] | undefined;
2150
+ _raw: {
2151
+ compose_hash: string;
2152
+ id?: string | undefined;
2153
+ app_id?: string | undefined;
2154
+ env_keys?: string[] | undefined;
2155
+ instance_id?: string | undefined;
2156
+ encrypted_env?: string | undefined;
2157
+ uuid?: string | undefined;
2158
+ };
2159
+ }, {
2160
+ compose_hash: string;
2161
+ id?: string | undefined;
2162
+ app_id?: string | undefined;
2163
+ env_keys?: string[] | undefined;
2164
+ instance_id?: string | undefined;
2165
+ encrypted_env?: string | undefined;
2166
+ uuid?: string | undefined;
2167
+ }>;
2168
+ declare const CommitCvmComposeFileUpdateSchema: z.ZodEffects<z.ZodAny, undefined, any>;
2169
+ type CommitCvmComposeFileUpdateRequest = z.infer<typeof CommitCvmComposeFileUpdateRequestSchema>;
2170
+ type CommitCvmComposeFileUpdate = undefined;
2171
+ type CommitCvmComposeFileUpdateParameters<T = undefined> = ActionParameters<T>;
2172
+ type CommitCvmComposeFileUpdateReturnType<T = undefined> = ActionReturnType<CommitCvmComposeFileUpdate, T>;
2173
+ declare function commitCvmComposeFileUpdate<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: CommitCvmComposeFileUpdateRequest, parameters?: CommitCvmComposeFileUpdateParameters<T>): Promise<CommitCvmComposeFileUpdateReturnType<T>>;
2174
+ declare function safeCommitCvmComposeFileUpdate<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: CommitCvmComposeFileUpdateRequest, parameters?: CommitCvmComposeFileUpdateParameters<T>): Promise<SafeResult<CommitCvmComposeFileUpdateReturnType<T>>>;
2175
+
2176
+ declare const GetAppEnvEncryptPubKeyRequestSchema: z.ZodObject<{
2177
+ kms: z.ZodString;
2178
+ app_id: z.ZodString;
2179
+ }, "strict", z.ZodTypeAny, {
2180
+ app_id: string;
2181
+ kms: string;
2182
+ }, {
2183
+ app_id: string;
2184
+ kms: string;
2185
+ }>;
2186
+ declare const GetAppEnvEncryptPubKeySchema: z.ZodObject<{
2187
+ public_key: z.ZodString;
2188
+ signature: z.ZodString;
2189
+ }, "strict", z.ZodTypeAny, {
2190
+ signature: string;
2191
+ public_key: string;
2192
+ }, {
2193
+ signature: string;
2194
+ public_key: string;
2195
+ }>;
2196
+ type GetAppEnvEncryptPubKeyRequest = z.infer<typeof GetAppEnvEncryptPubKeyRequestSchema>;
2197
+ type GetAppEnvEncryptPubKey = z.infer<typeof GetAppEnvEncryptPubKeySchema>;
2198
+ type GetAppEnvEncryptPubKeyParameters<T = undefined> = ActionParameters<T>;
2199
+ type GetAppEnvEncryptPubKeyReturnType<T = undefined> = ActionReturnType<GetAppEnvEncryptPubKey, T>;
2200
+ declare const getAppEnvEncryptPubKey: <T extends z.ZodSchema | false | undefined = undefined>(client: Client, payload: GetAppEnvEncryptPubKeyRequest, parameters?: GetAppEnvEncryptPubKeyParameters<T>) => Promise<GetAppEnvEncryptPubKeyReturnType<T>>;
2201
+ declare const safeGetAppEnvEncryptPubKey: <T extends z.ZodSchema | false | undefined = undefined>(client: Client, payload: GetAppEnvEncryptPubKeyRequest, parameters?: GetAppEnvEncryptPubKeyParameters<T>) => Promise<SafeResult<GetAppEnvEncryptPubKeyReturnType<T>>>;
2202
+
2203
+ declare const GetCvmInfoSchema: z.ZodObject<{
2204
+ hosted: z.ZodOptional<z.ZodObject<{
2205
+ id: z.ZodString;
2206
+ name: z.ZodString;
2207
+ status: z.ZodString;
2208
+ uptime: z.ZodString;
2209
+ app_url: z.ZodNullable<z.ZodString>;
2210
+ app_id: z.ZodString;
2211
+ instance_id: z.ZodNullable<z.ZodString>;
2212
+ configuration: z.ZodOptional<z.ZodAny>;
2213
+ exited_at: z.ZodNullable<z.ZodString>;
2214
+ boot_progress: z.ZodNullable<z.ZodString>;
2215
+ boot_error: z.ZodNullable<z.ZodString>;
2216
+ shutdown_progress: z.ZodNullable<z.ZodString>;
2217
+ image_version: z.ZodNullable<z.ZodString>;
2218
+ }, "strip", z.ZodTypeAny, {
2219
+ status: string;
2220
+ name: string;
2221
+ id: string;
2222
+ app_id: string;
2223
+ instance_id: string | null;
2224
+ app_url: string | null;
2225
+ uptime: string;
2226
+ exited_at: string | null;
2227
+ boot_progress: string | null;
2228
+ boot_error: string | null;
2229
+ shutdown_progress: string | null;
2230
+ image_version: string | null;
2231
+ configuration?: any;
2232
+ }, {
2233
+ status: string;
2234
+ name: string;
2235
+ id: string;
2236
+ app_id: string;
2237
+ instance_id: string | null;
2238
+ app_url: string | null;
2239
+ uptime: string;
2240
+ exited_at: string | null;
2241
+ boot_progress: string | null;
2242
+ boot_error: string | null;
2243
+ shutdown_progress: string | null;
2244
+ image_version: string | null;
2245
+ configuration?: any;
2246
+ }>>;
2247
+ name: z.ZodOptional<z.ZodString>;
2248
+ managed_user: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
2249
+ id: z.ZodNumber;
2250
+ username: z.ZodString;
2251
+ }, "strip", z.ZodTypeAny, {
2252
+ id: number;
2253
+ username: string;
2254
+ }, {
2255
+ id: number;
2256
+ username: string;
2257
+ }>>>>;
2258
+ node: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
2259
+ id: z.ZodNumber;
2260
+ name: z.ZodString;
2261
+ region_identifier: z.ZodOptional<z.ZodString>;
2262
+ }, "strip", z.ZodTypeAny, {
2263
+ name: string;
2264
+ id: number;
2265
+ region_identifier?: string | undefined;
2266
+ }, {
2267
+ name: string;
2268
+ id: number;
2269
+ region_identifier?: string | undefined;
2270
+ }>>>>;
2271
+ listed: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2272
+ status: z.ZodOptional<z.ZodString>;
2273
+ in_progress: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2274
+ dapp_dashboard_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2275
+ syslog_endpoint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2276
+ allow_upgrade: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2277
+ project_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2278
+ project_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2279
+ billing_period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2280
+ kms_info: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2281
+ id: z.ZodString;
2282
+ slug: z.ZodString;
2283
+ url: z.ZodString;
2284
+ version: z.ZodString;
2285
+ chain_id: z.ZodOptional<z.ZodNumber>;
2286
+ kms_contract_address: z.ZodOptional<z.ZodString>;
2287
+ gateway_app_id: z.ZodOptional<z.ZodString>;
2288
+ }, "strip", z.ZodTypeAny, {
2289
+ id: string;
2290
+ version: string;
2291
+ slug: string;
2292
+ url: string;
2293
+ chain_id?: number | undefined;
2294
+ kms_contract_address?: string | undefined;
2295
+ gateway_app_id?: string | undefined;
2296
+ }, {
2297
+ id: string;
2298
+ version: string;
2299
+ slug: string;
2300
+ url: string;
2301
+ chain_id?: number | undefined;
2302
+ kms_contract_address?: string | undefined;
2303
+ gateway_app_id?: string | undefined;
2304
+ }>>>;
2305
+ vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2306
+ memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2307
+ disk_size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2308
+ gateway_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2309
+ public_urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2310
+ app: z.ZodString;
2311
+ instance: z.ZodString;
2312
+ }, "strip", z.ZodTypeAny, {
2313
+ app: string;
2314
+ instance: string;
2315
+ }, {
2316
+ app: string;
2317
+ instance: string;
2318
+ }>, "many">>;
2319
+ }, "strip", z.ZodTypeAny, {
2320
+ status?: string | undefined;
2321
+ name?: string | undefined;
2322
+ listed?: boolean | undefined;
2323
+ vcpu?: number | null | undefined;
2324
+ memory?: number | null | undefined;
2325
+ disk_size?: number | null | undefined;
2326
+ kms_info?: {
2327
+ id: string;
2328
+ version: string;
2329
+ slug: string;
2330
+ url: string;
2331
+ chain_id?: number | undefined;
2332
+ kms_contract_address?: string | undefined;
2333
+ gateway_app_id?: string | undefined;
2334
+ } | null | undefined;
2335
+ hosted?: {
2336
+ status: string;
2337
+ name: string;
2338
+ id: string;
2339
+ app_id: string;
2340
+ instance_id: string | null;
2341
+ app_url: string | null;
2342
+ uptime: string;
2343
+ exited_at: string | null;
2344
+ boot_progress: string | null;
2345
+ boot_error: string | null;
2346
+ shutdown_progress: string | null;
2347
+ image_version: string | null;
2348
+ configuration?: any;
2349
+ } | undefined;
2350
+ managed_user?: {
2351
+ id: number;
2352
+ username: string;
2353
+ } | null | undefined;
2354
+ node?: {
2355
+ name: string;
2356
+ id: number;
2357
+ region_identifier?: string | undefined;
2358
+ } | null | undefined;
2359
+ in_progress?: boolean | undefined;
2360
+ dapp_dashboard_url?: string | null | undefined;
2361
+ syslog_endpoint?: string | null | undefined;
2362
+ allow_upgrade?: boolean | undefined;
2363
+ project_id?: string | null | undefined;
2364
+ project_type?: string | null | undefined;
2365
+ billing_period?: string | null | undefined;
2366
+ gateway_domain?: string | null | undefined;
2367
+ public_urls?: {
2368
+ app: string;
2369
+ instance: string;
2370
+ }[] | undefined;
2371
+ }, {
2372
+ status?: string | undefined;
2373
+ name?: string | undefined;
2374
+ listed?: boolean | undefined;
2375
+ vcpu?: number | null | undefined;
2376
+ memory?: number | null | undefined;
2377
+ disk_size?: number | null | undefined;
2378
+ kms_info?: {
2379
+ id: string;
2380
+ version: string;
2381
+ slug: string;
2382
+ url: string;
2383
+ chain_id?: number | undefined;
2384
+ kms_contract_address?: string | undefined;
2385
+ gateway_app_id?: string | undefined;
2386
+ } | null | undefined;
2387
+ hosted?: {
2388
+ status: string;
2389
+ name: string;
2390
+ id: string;
2391
+ app_id: string;
2392
+ instance_id: string | null;
2393
+ app_url: string | null;
2394
+ uptime: string;
2395
+ exited_at: string | null;
2396
+ boot_progress: string | null;
2397
+ boot_error: string | null;
2398
+ shutdown_progress: string | null;
2399
+ image_version: string | null;
2400
+ configuration?: any;
2401
+ } | undefined;
2402
+ managed_user?: {
2403
+ id: number;
2404
+ username: string;
2405
+ } | null | undefined;
2406
+ node?: {
2407
+ name: string;
2408
+ id: number;
2409
+ region_identifier?: string | undefined;
2410
+ } | null | undefined;
2411
+ in_progress?: boolean | undefined;
2412
+ dapp_dashboard_url?: string | null | undefined;
2413
+ syslog_endpoint?: string | null | undefined;
2414
+ allow_upgrade?: boolean | undefined;
2415
+ project_id?: string | null | undefined;
2416
+ project_type?: string | null | undefined;
2417
+ billing_period?: string | null | undefined;
2418
+ gateway_domain?: string | null | undefined;
2419
+ public_urls?: {
2420
+ app: string;
2421
+ instance: string;
2422
+ }[] | undefined;
2423
+ }>;
2424
+ type GetCvmInfoResponse = z.infer<typeof GetCvmInfoSchema>;
2425
+ type GetCvmInfoRequest = {
2426
+ id?: string;
2427
+ uuid?: string;
2428
+ app_id?: string;
2429
+ instance_id?: string;
2430
+ };
2431
+ type GetCvmInfoParameters<T = undefined> = ActionParameters<T>;
2432
+ type GetCvmInfoReturnType<T = undefined> = ActionReturnType<GetCvmInfoResponse, T>;
2433
+ /**
2434
+ * Get information about a specific CVM
2435
+ *
2436
+ * @param client - The API client
2437
+ * @param request - Request parameters
2438
+ * @param request.cvmId - ID of the CVM to get information for
2439
+ * @param parameters - Optional behavior parameters
2440
+ * @returns CVM information
2441
+ *
2442
+ * @example
2443
+ * ```typescript
2444
+ * const info = await getCvmInfo(client, { cvmId: "cvm-123" })
2445
+ * ```
2446
+ */
2447
+ declare function getCvmInfo<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetCvmInfoRequest, parameters?: GetCvmInfoParameters<T>): Promise<GetCvmInfoReturnType<T>>;
2448
+ /**
2449
+ * Safe version of getCvmInfo that returns a Result type instead of throwing
2450
+ */
2451
+ declare function safeGetCvmInfo<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetCvmInfoRequest, parameters?: GetCvmInfoParameters<T>): Promise<SafeResult<GetCvmInfoReturnType<T>>>;
2452
+
2453
+ declare const GetCvmListRequestSchema: z.ZodObject<{
2454
+ page: z.ZodOptional<z.ZodNumber>;
2455
+ page_size: z.ZodOptional<z.ZodNumber>;
2456
+ node_id: z.ZodOptional<z.ZodNumber>;
2457
+ }, "strict", z.ZodTypeAny, {
2458
+ node_id?: number | undefined;
2459
+ page?: number | undefined;
2460
+ page_size?: number | undefined;
2461
+ }, {
2462
+ node_id?: number | undefined;
2463
+ page?: number | undefined;
2464
+ page_size?: number | undefined;
2465
+ }>;
2466
+ declare const GetCvmListSchema: z.ZodObject<{
2467
+ items: z.ZodArray<z.ZodObject<{
2468
+ hosted: z.ZodOptional<z.ZodObject<{
2469
+ id: z.ZodString;
2470
+ name: z.ZodString;
2471
+ status: z.ZodString;
2472
+ uptime: z.ZodString;
2473
+ app_url: z.ZodNullable<z.ZodString>;
2474
+ app_id: z.ZodString;
2475
+ instance_id: z.ZodNullable<z.ZodString>;
2476
+ configuration: z.ZodOptional<z.ZodAny>;
2477
+ exited_at: z.ZodNullable<z.ZodString>;
2478
+ boot_progress: z.ZodNullable<z.ZodString>;
2479
+ boot_error: z.ZodNullable<z.ZodString>;
2480
+ shutdown_progress: z.ZodNullable<z.ZodString>;
2481
+ image_version: z.ZodNullable<z.ZodString>;
2482
+ }, "strip", z.ZodTypeAny, {
2483
+ status: string;
2484
+ name: string;
2485
+ id: string;
2486
+ app_id: string;
2487
+ instance_id: string | null;
2488
+ app_url: string | null;
2489
+ uptime: string;
2490
+ exited_at: string | null;
2491
+ boot_progress: string | null;
2492
+ boot_error: string | null;
2493
+ shutdown_progress: string | null;
2494
+ image_version: string | null;
2495
+ configuration?: any;
2496
+ }, {
2497
+ status: string;
2498
+ name: string;
2499
+ id: string;
2500
+ app_id: string;
2501
+ instance_id: string | null;
2502
+ app_url: string | null;
2503
+ uptime: string;
2504
+ exited_at: string | null;
2505
+ boot_progress: string | null;
2506
+ boot_error: string | null;
2507
+ shutdown_progress: string | null;
2508
+ image_version: string | null;
2509
+ configuration?: any;
2510
+ }>>;
2511
+ name: z.ZodOptional<z.ZodString>;
2512
+ managed_user: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
2513
+ id: z.ZodNumber;
2514
+ username: z.ZodString;
2515
+ }, "strip", z.ZodTypeAny, {
2516
+ id: number;
2517
+ username: string;
2518
+ }, {
2519
+ id: number;
2520
+ username: string;
2521
+ }>>>>;
2522
+ node: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
2523
+ id: z.ZodNumber;
2524
+ name: z.ZodString;
2525
+ region_identifier: z.ZodOptional<z.ZodString>;
2526
+ }, "strip", z.ZodTypeAny, {
2527
+ name: string;
2528
+ id: number;
2529
+ region_identifier?: string | undefined;
2530
+ }, {
2531
+ name: string;
2532
+ id: number;
2533
+ region_identifier?: string | undefined;
2534
+ }>>>>;
2535
+ listed: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2536
+ status: z.ZodOptional<z.ZodString>;
2537
+ in_progress: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2538
+ dapp_dashboard_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2539
+ syslog_endpoint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2540
+ allow_upgrade: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2541
+ project_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2542
+ project_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2543
+ billing_period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2544
+ kms_info: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2545
+ id: z.ZodString;
2546
+ slug: z.ZodString;
2547
+ url: z.ZodString;
2548
+ version: z.ZodString;
2549
+ chain_id: z.ZodOptional<z.ZodNumber>;
2550
+ kms_contract_address: z.ZodOptional<z.ZodString>;
2551
+ gateway_app_id: z.ZodOptional<z.ZodString>;
2552
+ }, "strip", z.ZodTypeAny, {
2553
+ id: string;
2554
+ version: string;
2555
+ slug: string;
2556
+ url: string;
2557
+ chain_id?: number | undefined;
2558
+ kms_contract_address?: string | undefined;
2559
+ gateway_app_id?: string | undefined;
2560
+ }, {
2561
+ id: string;
2562
+ version: string;
2563
+ slug: string;
2564
+ url: string;
2565
+ chain_id?: number | undefined;
2566
+ kms_contract_address?: string | undefined;
2567
+ gateway_app_id?: string | undefined;
2568
+ }>>>;
2569
+ vcpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2570
+ memory: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2571
+ disk_size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2572
+ gateway_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2573
+ public_urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
2574
+ app: z.ZodString;
2575
+ instance: z.ZodString;
2576
+ }, "strip", z.ZodTypeAny, {
2577
+ app: string;
2578
+ instance: string;
2579
+ }, {
2580
+ app: string;
2581
+ instance: string;
2582
+ }>, "many">>;
2583
+ }, "strip", z.ZodTypeAny, {
2584
+ status?: string | undefined;
2585
+ name?: string | undefined;
2586
+ listed?: boolean | undefined;
2587
+ vcpu?: number | null | undefined;
2588
+ memory?: number | null | undefined;
2589
+ disk_size?: number | null | undefined;
2590
+ kms_info?: {
2591
+ id: string;
2592
+ version: string;
2593
+ slug: string;
2594
+ url: string;
2595
+ chain_id?: number | undefined;
2596
+ kms_contract_address?: string | undefined;
2597
+ gateway_app_id?: string | undefined;
2598
+ } | null | undefined;
2599
+ hosted?: {
2600
+ status: string;
2601
+ name: string;
2602
+ id: string;
2603
+ app_id: string;
2604
+ instance_id: string | null;
2605
+ app_url: string | null;
2606
+ uptime: string;
2607
+ exited_at: string | null;
2608
+ boot_progress: string | null;
2609
+ boot_error: string | null;
2610
+ shutdown_progress: string | null;
2611
+ image_version: string | null;
2612
+ configuration?: any;
2613
+ } | undefined;
2614
+ managed_user?: {
2615
+ id: number;
2616
+ username: string;
2617
+ } | null | undefined;
2618
+ node?: {
2619
+ name: string;
2620
+ id: number;
2621
+ region_identifier?: string | undefined;
2622
+ } | null | undefined;
2623
+ in_progress?: boolean | undefined;
2624
+ dapp_dashboard_url?: string | null | undefined;
2625
+ syslog_endpoint?: string | null | undefined;
2626
+ allow_upgrade?: boolean | undefined;
2627
+ project_id?: string | null | undefined;
2628
+ project_type?: string | null | undefined;
2629
+ billing_period?: string | null | undefined;
2630
+ gateway_domain?: string | null | undefined;
2631
+ public_urls?: {
2632
+ app: string;
2633
+ instance: string;
2634
+ }[] | undefined;
2635
+ }, {
2636
+ status?: string | undefined;
2637
+ name?: string | undefined;
2638
+ listed?: boolean | undefined;
2639
+ vcpu?: number | null | undefined;
2640
+ memory?: number | null | undefined;
2641
+ disk_size?: number | null | undefined;
2642
+ kms_info?: {
2643
+ id: string;
2644
+ version: string;
2645
+ slug: string;
2646
+ url: string;
2647
+ chain_id?: number | undefined;
2648
+ kms_contract_address?: string | undefined;
2649
+ gateway_app_id?: string | undefined;
2650
+ } | null | undefined;
2651
+ hosted?: {
2652
+ status: string;
2653
+ name: string;
2654
+ id: string;
2655
+ app_id: string;
2656
+ instance_id: string | null;
2657
+ app_url: string | null;
2658
+ uptime: string;
2659
+ exited_at: string | null;
2660
+ boot_progress: string | null;
2661
+ boot_error: string | null;
2662
+ shutdown_progress: string | null;
2663
+ image_version: string | null;
2664
+ configuration?: any;
2665
+ } | undefined;
2666
+ managed_user?: {
2667
+ id: number;
2668
+ username: string;
2669
+ } | null | undefined;
2670
+ node?: {
2671
+ name: string;
2672
+ id: number;
2673
+ region_identifier?: string | undefined;
2674
+ } | null | undefined;
2675
+ in_progress?: boolean | undefined;
2676
+ dapp_dashboard_url?: string | null | undefined;
2677
+ syslog_endpoint?: string | null | undefined;
2678
+ allow_upgrade?: boolean | undefined;
2679
+ project_id?: string | null | undefined;
2680
+ project_type?: string | null | undefined;
2681
+ billing_period?: string | null | undefined;
2682
+ gateway_domain?: string | null | undefined;
2683
+ public_urls?: {
2684
+ app: string;
2685
+ instance: string;
2686
+ }[] | undefined;
2687
+ }>, "many">;
2688
+ total: z.ZodNumber;
2689
+ page: z.ZodNumber;
2690
+ page_size: z.ZodNumber;
2691
+ pages: z.ZodNumber;
2692
+ }, "strict", z.ZodTypeAny, {
2693
+ page: number;
2694
+ page_size: number;
2695
+ items: {
2696
+ status?: string | undefined;
2697
+ name?: string | undefined;
2698
+ listed?: boolean | undefined;
2699
+ vcpu?: number | null | undefined;
2700
+ memory?: number | null | undefined;
2701
+ disk_size?: number | null | undefined;
2702
+ kms_info?: {
2703
+ id: string;
2704
+ version: string;
2705
+ slug: string;
2706
+ url: string;
2707
+ chain_id?: number | undefined;
2708
+ kms_contract_address?: string | undefined;
2709
+ gateway_app_id?: string | undefined;
2710
+ } | null | undefined;
2711
+ hosted?: {
2712
+ status: string;
2713
+ name: string;
2714
+ id: string;
2715
+ app_id: string;
2716
+ instance_id: string | null;
2717
+ app_url: string | null;
2718
+ uptime: string;
2719
+ exited_at: string | null;
2720
+ boot_progress: string | null;
2721
+ boot_error: string | null;
2722
+ shutdown_progress: string | null;
2723
+ image_version: string | null;
2724
+ configuration?: any;
2725
+ } | undefined;
2726
+ managed_user?: {
2727
+ id: number;
2728
+ username: string;
2729
+ } | null | undefined;
2730
+ node?: {
2731
+ name: string;
2732
+ id: number;
2733
+ region_identifier?: string | undefined;
2734
+ } | null | undefined;
2735
+ in_progress?: boolean | undefined;
2736
+ dapp_dashboard_url?: string | null | undefined;
2737
+ syslog_endpoint?: string | null | undefined;
2738
+ allow_upgrade?: boolean | undefined;
2739
+ project_id?: string | null | undefined;
2740
+ project_type?: string | null | undefined;
2741
+ billing_period?: string | null | undefined;
2742
+ gateway_domain?: string | null | undefined;
2743
+ public_urls?: {
2744
+ app: string;
2745
+ instance: string;
2746
+ }[] | undefined;
2747
+ }[];
2748
+ total: number;
2749
+ pages: number;
2750
+ }, {
2751
+ page: number;
2752
+ page_size: number;
2753
+ items: {
2754
+ status?: string | undefined;
2755
+ name?: string | undefined;
2756
+ listed?: boolean | undefined;
2757
+ vcpu?: number | null | undefined;
2758
+ memory?: number | null | undefined;
2759
+ disk_size?: number | null | undefined;
2760
+ kms_info?: {
2761
+ id: string;
2762
+ version: string;
2763
+ slug: string;
2764
+ url: string;
2765
+ chain_id?: number | undefined;
2766
+ kms_contract_address?: string | undefined;
2767
+ gateway_app_id?: string | undefined;
2768
+ } | null | undefined;
2769
+ hosted?: {
2770
+ status: string;
2771
+ name: string;
2772
+ id: string;
2773
+ app_id: string;
2774
+ instance_id: string | null;
2775
+ app_url: string | null;
2776
+ uptime: string;
2777
+ exited_at: string | null;
2778
+ boot_progress: string | null;
2779
+ boot_error: string | null;
2780
+ shutdown_progress: string | null;
2781
+ image_version: string | null;
2782
+ configuration?: any;
2783
+ } | undefined;
2784
+ managed_user?: {
2785
+ id: number;
2786
+ username: string;
2787
+ } | null | undefined;
2788
+ node?: {
2789
+ name: string;
2790
+ id: number;
2791
+ region_identifier?: string | undefined;
2792
+ } | null | undefined;
2793
+ in_progress?: boolean | undefined;
2794
+ dapp_dashboard_url?: string | null | undefined;
2795
+ syslog_endpoint?: string | null | undefined;
2796
+ allow_upgrade?: boolean | undefined;
2797
+ project_id?: string | null | undefined;
2798
+ project_type?: string | null | undefined;
2799
+ billing_period?: string | null | undefined;
2800
+ gateway_domain?: string | null | undefined;
2801
+ public_urls?: {
2802
+ app: string;
2803
+ instance: string;
2804
+ }[] | undefined;
2805
+ }[];
2806
+ total: number;
2807
+ pages: number;
2808
+ }>;
2809
+ type GetCvmListRequest = z.infer<typeof GetCvmListRequestSchema>;
2810
+ type GetCvmListResponse = z.infer<typeof GetCvmListSchema>;
2811
+ type GetCvmListParameters<T = undefined> = ActionParameters<T>;
2812
+ type GetCvmListReturnType<T = undefined> = ActionReturnType<GetCvmListResponse, T>;
2813
+ /**
2814
+ * Get a paginated list of CVMs
2815
+ *
2816
+ * @param client - The API client
2817
+ * @param request - Optional request parameters for pagination and filtering
2818
+ * @param request.page - Page number (1-based)
2819
+ * @param request.page_size - Number of items per page
2820
+ * @param request.node_id - Filter by node ID
2821
+ * @param parameters - Optional behavior parameters
2822
+ * @returns Paginated list of CVMs
2823
+ *
2824
+ * @example
2825
+ * ```typescript
2826
+ * // Get first page with default size
2827
+ * const list = await getCvmList(client, { page: 1 })
2828
+ *
2829
+ * // Get with custom page size
2830
+ * const list = await getCvmList(client, { page: 1, page_size: 20 })
2831
+ *
2832
+ * // Get with custom schema
2833
+ * const list = await getCvmList(client, { page: 1 }, { schema: customSchema })
2834
+ * ```
2835
+ */
2836
+ declare function getCvmList<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request?: GetCvmListRequest, parameters?: GetCvmListParameters<T>): Promise<GetCvmListReturnType<T>>;
2837
+ /**
2838
+ * Safe version of getCvmList that returns a Result type instead of throwing
2839
+ */
2840
+ declare function safeGetCvmList<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request?: GetCvmListRequest, parameters?: GetCvmListParameters<T>): Promise<SafeResult<GetCvmListReturnType<T>>>;
2841
+
2842
+ declare const KmsInfoSchema: z.ZodObject<{
2843
+ id: z.ZodString;
2844
+ slug: z.ZodNullable<z.ZodString>;
2845
+ url: z.ZodString;
2846
+ version: z.ZodString;
2847
+ chain_id: z.ZodNullable<z.ZodNumber>;
2848
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2849
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2850
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2851
+ id: z.ZodString;
2852
+ slug: z.ZodNullable<z.ZodString>;
2853
+ url: z.ZodString;
2854
+ version: z.ZodString;
2855
+ chain_id: z.ZodNullable<z.ZodNumber>;
2856
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2857
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2858
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2859
+ id: z.ZodString;
2860
+ slug: z.ZodNullable<z.ZodString>;
2861
+ url: z.ZodString;
2862
+ version: z.ZodString;
2863
+ chain_id: z.ZodNullable<z.ZodNumber>;
2864
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2865
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2866
+ }, z.ZodTypeAny, "passthrough">>;
2867
+ type KmsInfo = z.infer<typeof KmsInfoSchema>;
2868
+
2869
+ declare const GetKmsInfoRequestSchema: z.ZodObject<{
2870
+ kms_id: z.ZodString;
2871
+ }, "strip", z.ZodTypeAny, {
2872
+ kms_id: string;
2873
+ }, {
2874
+ kms_id: string;
2875
+ }>;
2876
+ type GetKmsInfoRequest = z.infer<typeof GetKmsInfoRequestSchema>;
2877
+ type GetKmsInfoParameters<T = undefined> = ActionParameters<T>;
2878
+ type GetKmsInfoReturnType<T = undefined> = ActionReturnType<KmsInfo, T>;
2879
+ /**
2880
+ * Get information about a specific KMS
2881
+ *
2882
+ * @param client - The API client
2883
+ * @param request - Request parameters
2884
+ * @param request.kms_id - ID of the KMS to get information for
2885
+ * @param parameters - Optional behavior parameters
2886
+ * @returns KMS information
2887
+ *
2888
+ * @example
2889
+ * ```typescript
2890
+ * const info = await getKmsInfo(client, { kms_id: "kms-123" })
2891
+ * ```
2892
+ */
2893
+ declare function getKmsInfo<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetKmsInfoRequest, parameters?: GetKmsInfoParameters<T>): Promise<GetKmsInfoReturnType<T>>;
2894
+ /**
2895
+ * Safe version of getKmsInfo that returns a Result type instead of throwing
2896
+ */
2897
+ declare function safeGetKmsInfo<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request: GetKmsInfoRequest, parameters?: GetKmsInfoParameters<T>): Promise<SafeResult<GetKmsInfoReturnType<T>>>;
2898
+
2899
+ declare const GetKmsListRequestSchema: z.ZodObject<{
2900
+ page: z.ZodOptional<z.ZodNumber>;
2901
+ page_size: z.ZodOptional<z.ZodNumber>;
2902
+ is_onchain: z.ZodOptional<z.ZodBoolean>;
2903
+ }, "strict", z.ZodTypeAny, {
2904
+ page?: number | undefined;
2905
+ page_size?: number | undefined;
2906
+ is_onchain?: boolean | undefined;
2907
+ }, {
2908
+ page?: number | undefined;
2909
+ page_size?: number | undefined;
2910
+ is_onchain?: boolean | undefined;
2911
+ }>;
2912
+ declare const GetKmsListSchema: z.ZodObject<{
2913
+ items: z.ZodArray<z.ZodObject<{
2914
+ id: z.ZodString;
2915
+ slug: z.ZodNullable<z.ZodString>;
2916
+ url: z.ZodString;
2917
+ version: z.ZodString;
2918
+ chain_id: z.ZodNullable<z.ZodNumber>;
2919
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2920
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2921
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2922
+ id: z.ZodString;
2923
+ slug: z.ZodNullable<z.ZodString>;
2924
+ url: z.ZodString;
2925
+ version: z.ZodString;
2926
+ chain_id: z.ZodNullable<z.ZodNumber>;
2927
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2928
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2929
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2930
+ id: z.ZodString;
2931
+ slug: z.ZodNullable<z.ZodString>;
2932
+ url: z.ZodString;
2933
+ version: z.ZodString;
2934
+ chain_id: z.ZodNullable<z.ZodNumber>;
2935
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2936
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2937
+ }, z.ZodTypeAny, "passthrough">>, "many">;
2938
+ total: z.ZodNumber;
2939
+ page: z.ZodNumber;
2940
+ page_size: z.ZodNumber;
2941
+ pages: z.ZodNumber;
2942
+ }, "strict", z.ZodTypeAny, {
2943
+ page: number;
2944
+ page_size: number;
2945
+ items: z.objectOutputType<{
2946
+ id: z.ZodString;
2947
+ slug: z.ZodNullable<z.ZodString>;
2948
+ url: z.ZodString;
2949
+ version: z.ZodString;
2950
+ chain_id: z.ZodNullable<z.ZodNumber>;
2951
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2952
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2953
+ }, z.ZodTypeAny, "passthrough">[];
2954
+ total: number;
2955
+ pages: number;
2956
+ }, {
2957
+ page: number;
2958
+ page_size: number;
2959
+ items: z.objectInputType<{
2960
+ id: z.ZodString;
2961
+ slug: z.ZodNullable<z.ZodString>;
2962
+ url: z.ZodString;
2963
+ version: z.ZodString;
2964
+ chain_id: z.ZodNullable<z.ZodNumber>;
2965
+ kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2966
+ gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
2967
+ }, z.ZodTypeAny, "passthrough">[];
2968
+ total: number;
2969
+ pages: number;
2970
+ }>;
2971
+ type GetKmsListRequest = z.infer<typeof GetKmsListRequestSchema>;
2972
+ type GetKmsListResponse = z.infer<typeof GetKmsListSchema>;
2973
+ type GetKmsListParameters<T = undefined> = ActionParameters<T>;
2974
+ type GetKmsListReturnType<T = undefined> = ActionReturnType<GetKmsListResponse, T>;
2975
+ declare function getKmsList<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request?: GetKmsListRequest, parameters?: GetKmsListParameters<T>): Promise<GetKmsListReturnType<T>>;
2976
+ declare function safeGetKmsList<T extends z.ZodSchema | false | undefined = undefined>(client: Client, request?: GetKmsListRequest, parameters?: GetKmsListParameters<T>): Promise<SafeResult<GetKmsListReturnType<T>>>;
2977
+
2978
+ export { type AddComposeHash, type AddComposeHashParameters, type AddComposeHashRequest, type AddComposeHashReturnType, AddComposeHashSchema, type ApiError, ApiErrorSchema, type AppCompose, type AvailableNodes, AvailableNodesSchema, type BalanceCheckResult, type BatchTransactionOptions, type BatchTransactionResult, Client, type ClientConfig, type CommitCvmComposeFileUpdate, type CommitCvmComposeFileUpdateParameters, type CommitCvmComposeFileUpdateRequest, CommitCvmComposeFileUpdateRequestSchema, type CommitCvmComposeFileUpdateReturnType, CommitCvmComposeFileUpdateSchema, type CommitCvmProvision, type CommitCvmProvisionParameters, type CommitCvmProvisionRequest, CommitCvmProvisionRequestSchema, type CommitCvmProvisionReturnType, CommitCvmProvisionSchema, type CurrentUser, CurrentUserSchema, type DeployAppAuth, type DeployAppAuthParameters, type DeployAppAuthRequest, DeployAppAuthRequestSchema, type DeployAppAuthReturnType, DeployAppAuthSchema, type GasEstimationOptions, type GetAppEnvEncryptPubKey, type GetAppEnvEncryptPubKeyParameters, type GetAppEnvEncryptPubKeyRequest, type GetAppEnvEncryptPubKeyReturnType, GetAppEnvEncryptPubKeySchema, type GetAvailableNodesParameters, type GetAvailableNodesReturnType, type GetCurrentUserParameters, type GetCurrentUserReturnType, type GetCvmComposeFileParameters, type GetCvmComposeFileResult, GetCvmComposeFileResultSchema, type GetCvmComposeFileReturnType, type GetCvmInfoParameters, type GetCvmInfoReturnType, GetCvmInfoSchema, type GetCvmListParameters, type GetCvmListReturnType, GetCvmListSchema, type GetKmsInfoParameters, type GetKmsInfoReturnType, type GetKmsListParameters, type GetKmsListReturnType, GetKmsListSchema, type NetworkClients, type NetworkConfig, NetworkError, type ProvisionCvm, type ProvisionCvmComposeFileUpdateParameters, type ProvisionCvmComposeFileUpdateRequest, ProvisionCvmComposeFileUpdateRequestSchema, type ProvisionCvmComposeFileUpdateResult, ProvisionCvmComposeFileUpdateResultSchema, type ProvisionCvmComposeFileUpdateReturnType, type ProvisionCvmParameters, type ProvisionCvmRequest, ProvisionCvmRequestSchema, type ProvisionCvmReturnType, ProvisionCvmSchema, RequestError, type RetryOptions, type SafeAddComposeHashResult, type SafeDeployAppAuthResult, type SafeError, type SafeResult, TransactionError, type TransactionOptions, type TransactionResult, type TransactionState, type TransactionStatus, type TransactionTracker, type WalletConnection, WalletError, addComposeHash, addNetwork, asHex, autoCreateClients, checkBalance, checkNetworkStatus, commitCvmComposeFileUpdate, commitCvmProvision, createClient, createClientsFromBrowser, createClientsFromPrivateKey, createNetworkClients, createTransactionTracker, deployAppAuth, estimateTransactionGas, executeBatchTransactions, executeTransaction, executeTransactionWithRetry, extractNetworkClients, getAppEnvEncryptPubKey, getAvailableNodes, getCurrentUser, getCvmComposeFile, getCvmInfo, getCvmList, getErrorMessage, getKmsInfo, getKmsList, provisionCvm, provisionCvmComposeFileUpdate, safeAddComposeHash, safeCommitCvmComposeFileUpdate, safeCommitCvmProvision, safeDeployAppAuth, safeGetAppEnvEncryptPubKey, safeGetAvailableNodes, safeGetCurrentUser, safeGetCvmComposeFile, safeGetCvmInfo, safeGetCvmList, safeGetKmsInfo, safeGetKmsList, safeProvisionCvm, safeProvisionCvmComposeFileUpdate, safeValidateActionParameters, switchToNetwork, validateActionParameters, validateNetworkPrerequisites, waitForTransactionReceipt };