@phala/cloud 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -216,9 +216,133 @@ function createClient(config = {}) {
216
216
  return new Client(config);
217
217
  }
218
218
 
219
- // src/actions/get_current_user.ts
219
+ // src/types/kms_info.ts
220
220
  import { z as z2 } from "zod";
221
221
 
222
+ // src/types/supported_chains.ts
223
+ import { anvil, base, mainnet } from "viem/chains";
224
+ var SUPPORTED_CHAINS = {
225
+ [mainnet.id]: mainnet,
226
+ [base.id]: base,
227
+ [anvil.id]: anvil
228
+ };
229
+
230
+ // src/types/kms_info.ts
231
+ var KmsInfoBaseSchema = z2.object({
232
+ id: z2.string(),
233
+ slug: z2.string().nullable(),
234
+ url: z2.string(),
235
+ version: z2.string(),
236
+ chain_id: z2.number().nullable(),
237
+ kms_contract_address: z2.string().nullable().transform((val) => val),
238
+ gateway_app_id: z2.string().nullable().transform((val) => val)
239
+ }).passthrough();
240
+ var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
241
+ if (data.chain_id != null) {
242
+ const chain = SUPPORTED_CHAINS[data.chain_id];
243
+ if (chain) {
244
+ return { ...data, chain };
245
+ }
246
+ }
247
+ return data;
248
+ });
249
+
250
+ // src/types/cvm_info.ts
251
+ import { z as z3 } from "zod";
252
+ var VmInfoSchema = z3.object({
253
+ id: z3.string(),
254
+ name: z3.string(),
255
+ status: z3.string(),
256
+ uptime: z3.string(),
257
+ app_url: z3.string().nullable(),
258
+ app_id: z3.string(),
259
+ instance_id: z3.string().nullable(),
260
+ configuration: z3.any().optional(),
261
+ // TODO: add VmConfiguration schema if needed
262
+ exited_at: z3.string().nullable(),
263
+ boot_progress: z3.string().nullable(),
264
+ boot_error: z3.string().nullable(),
265
+ shutdown_progress: z3.string().nullable(),
266
+ image_version: z3.string().nullable()
267
+ });
268
+ var ManagedUserSchema = z3.object({
269
+ id: z3.number(),
270
+ username: z3.string()
271
+ });
272
+ var CvmNodeSchema = z3.object({
273
+ id: z3.number(),
274
+ name: z3.string(),
275
+ region_identifier: z3.string().optional()
276
+ });
277
+ var CvmNetworkUrlsSchema = z3.object({
278
+ app: z3.string(),
279
+ instance: z3.string()
280
+ });
281
+ var KMSInfoSchema = z3.object({
282
+ id: z3.string(),
283
+ // HashedId is represented as string in JS
284
+ slug: z3.string(),
285
+ url: z3.string(),
286
+ version: z3.string(),
287
+ chain_id: z3.number().optional(),
288
+ kms_contract_address: z3.string().optional(),
289
+ gateway_app_id: z3.string().optional()
290
+ });
291
+ var CvmInfoSchema = z3.object({
292
+ hosted: VmInfoSchema,
293
+ name: z3.string(),
294
+ managed_user: ManagedUserSchema.optional().nullable(),
295
+ node: CvmNodeSchema.optional().nullable(),
296
+ listed: z3.boolean().default(false),
297
+ status: z3.string(),
298
+ in_progress: z3.boolean().default(false),
299
+ dapp_dashboard_url: z3.string().nullable(),
300
+ syslog_endpoint: z3.string().nullable(),
301
+ allow_upgrade: z3.boolean().default(false),
302
+ project_id: z3.string().nullable(),
303
+ // HashedId is represented as string in JS
304
+ project_type: z3.string().nullable(),
305
+ billing_period: z3.string().nullable(),
306
+ kms_info: KMSInfoSchema.nullable(),
307
+ vcpu: z3.number().nullable(),
308
+ memory: z3.number().nullable(),
309
+ disk_size: z3.number().nullable(),
310
+ gateway_domain: z3.string().nullable(),
311
+ public_urls: z3.array(CvmNetworkUrlsSchema)
312
+ }).partial();
313
+ var CvmLegacyDetailSchema = z3.object({
314
+ id: z3.number(),
315
+ name: z3.string(),
316
+ status: z3.string(),
317
+ in_progress: z3.boolean(),
318
+ teepod_id: z3.number().nullable(),
319
+ teepod: CvmNodeSchema,
320
+ app_id: z3.string(),
321
+ vm_uuid: z3.string().nullable(),
322
+ instance_id: z3.string().nullable(),
323
+ vcpu: z3.number().nullable(),
324
+ memory: z3.number().nullable(),
325
+ disk_size: z3.number().nullable(),
326
+ base_image: z3.string(),
327
+ encrypted_env_pubkey: z3.string().nullable(),
328
+ listed: z3.boolean(),
329
+ project_id: z3.string().nullable(),
330
+ project_type: z3.string().nullable(),
331
+ public_sysinfo: z3.boolean(),
332
+ public_logs: z3.boolean(),
333
+ dapp_dashboard_url: z3.string().nullable(),
334
+ syslog_endpoint: z3.string().nullable(),
335
+ kms_info: KMSInfoSchema.nullable(),
336
+ contract_address: z3.string().nullable(),
337
+ deployer_address: z3.string().nullable(),
338
+ scheduled_delete_at: z3.string().nullable(),
339
+ public_urls: z3.array(CvmNetworkUrlsSchema),
340
+ gateway_domain: z3.string().nullable()
341
+ });
342
+
343
+ // src/actions/get_current_user.ts
344
+ import { z as z4 } from "zod";
345
+
222
346
  // src/utils/index.ts
223
347
  import { encryptEnvVars } from "@phala/dstack-sdk/encrypt-env-vars";
224
348
 
@@ -889,14 +1013,14 @@ async function autoCreateClients(chain, options = {}) {
889
1013
  }
890
1014
 
891
1015
  // src/actions/get_current_user.ts
892
- var CurrentUserSchema = z2.object({
893
- username: z2.string(),
894
- email: z2.string(),
895
- credits: z2.number(),
896
- granted_credits: z2.number(),
897
- avatar: z2.string(),
898
- team_name: z2.string(),
899
- team_tier: z2.string()
1016
+ var CurrentUserSchema = z4.object({
1017
+ username: z4.string(),
1018
+ email: z4.string(),
1019
+ credits: z4.number(),
1020
+ granted_credits: z4.number(),
1021
+ avatar: z4.string(),
1022
+ team_name: z4.string(),
1023
+ team_tier: z4.string()
900
1024
  }).passthrough();
901
1025
  async function getCurrentUser(client, parameters) {
902
1026
  validateActionParameters(parameters);
@@ -924,53 +1048,41 @@ async function safeGetCurrentUser(client, parameters) {
924
1048
  }
925
1049
 
926
1050
  // src/actions/get_available_nodes.ts
927
- import { z as z4 } from "zod";
928
-
929
- // src/types/kms_info.ts
930
- import { z as z3 } from "zod";
931
- var KmsInfoSchema = z3.object({
932
- id: z3.string(),
933
- slug: z3.string().nullable(),
934
- url: z3.string(),
935
- version: z3.string(),
936
- chain_id: z3.number().nullable(),
937
- kms_contract_address: z3.string().nullable().transform((val) => val),
938
- gateway_app_id: z3.string().nullable().transform((val) => val)
939
- }).passthrough();
940
-
941
- // src/actions/get_available_nodes.ts
942
- var AvailableOSImageSchema = z4.object({
943
- name: z4.string(),
944
- is_dev: z4.boolean(),
945
- version: z4.tuple([z4.number(), z4.number(), z4.number()]),
946
- os_image_hash: z4.string().nullable().optional()
1051
+ import { z as z5 } from "zod";
1052
+ var AvailableOSImageSchema = z5.object({
1053
+ name: z5.string(),
1054
+ is_dev: z5.boolean(),
1055
+ version: z5.tuple([z5.number(), z5.number(), z5.number()]),
1056
+ os_image_hash: z5.string().nullable().optional()
947
1057
  }).passthrough();
948
- var TeepodCapacitySchema = z4.object({
949
- teepod_id: z4.number(),
950
- name: z4.string(),
951
- listed: z4.boolean(),
952
- resource_score: z4.number(),
953
- remaining_vcpu: z4.number(),
954
- remaining_memory: z4.number(),
955
- remaining_cvm_slots: z4.number(),
956
- images: z4.array(AvailableOSImageSchema),
957
- dedicated_for_team_id: z4.number().nullable().optional(),
958
- support_onchain_kms: z4.boolean().optional(),
959
- fmspc: z4.string().nullable().optional(),
960
- device_id: z4.string().nullable().optional()
1058
+ var TeepodCapacitySchema = z5.object({
1059
+ teepod_id: z5.number(),
1060
+ name: z5.string(),
1061
+ listed: z5.boolean(),
1062
+ resource_score: z5.number(),
1063
+ remaining_vcpu: z5.number(),
1064
+ remaining_memory: z5.number(),
1065
+ remaining_cvm_slots: z5.number(),
1066
+ images: z5.array(AvailableOSImageSchema),
1067
+ support_onchain_kms: z5.boolean().optional(),
1068
+ fmspc: z5.string().nullable().optional(),
1069
+ device_id: z5.string().nullable().optional(),
1070
+ region_identifier: z5.string().nullable().optional(),
1071
+ default_kms: z5.string().nullable().optional(),
1072
+ kms_list: z5.array(z5.string()).default([])
961
1073
  }).passthrough();
962
- var ResourceThresholdSchema = z4.object({
963
- max_instances: z4.number().nullable().optional(),
964
- max_vcpu: z4.number().nullable().optional(),
965
- max_memory: z4.number().nullable().optional(),
966
- max_disk: z4.number().nullable().optional()
1074
+ var ResourceThresholdSchema = z5.object({
1075
+ max_instances: z5.number().nullable().optional(),
1076
+ max_vcpu: z5.number().nullable().optional(),
1077
+ max_memory: z5.number().nullable().optional(),
1078
+ max_disk: z5.number().nullable().optional()
967
1079
  }).passthrough();
968
- var AvailableNodesSchema = z4.object({
969
- tier: z4.string(),
1080
+ var AvailableNodesSchema = z5.object({
1081
+ tier: z5.string(),
970
1082
  // TeamTier is string enum
971
1083
  capacity: ResourceThresholdSchema,
972
- nodes: z4.array(TeepodCapacitySchema),
973
- kms_list: z4.array(KmsInfoSchema)
1084
+ nodes: z5.array(TeepodCapacitySchema),
1085
+ kms_list: z5.array(KmsInfoSchema)
974
1086
  }).passthrough();
975
1087
  async function getAvailableNodes(client, parameters) {
976
1088
  const response = await client.get("/teepods/available");
@@ -993,44 +1105,44 @@ async function safeGetAvailableNodes(client, parameters) {
993
1105
  }
994
1106
 
995
1107
  // src/actions/provision_cvm.ts
996
- import { z as z5 } from "zod";
997
- var ProvisionCvmSchema = z5.object({
998
- app_id: z5.string().nullable().optional(),
999
- app_env_encrypt_pubkey: z5.string().nullable().optional(),
1000
- compose_hash: z5.string(),
1001
- fmspc: z5.string().nullable().optional(),
1002
- device_id: z5.string().nullable().optional(),
1003
- os_image_hash: z5.string().nullable().optional(),
1004
- node_id: z5.number().nullable().optional()
1108
+ import { z as z6 } from "zod";
1109
+ var ProvisionCvmSchema = z6.object({
1110
+ app_id: z6.string().nullable().optional(),
1111
+ app_env_encrypt_pubkey: z6.string().nullable().optional(),
1112
+ compose_hash: z6.string(),
1113
+ fmspc: z6.string().nullable().optional(),
1114
+ device_id: z6.string().nullable().optional(),
1115
+ os_image_hash: z6.string().nullable().optional(),
1116
+ node_id: z6.number().nullable().optional()
1005
1117
  // Transformed from teepod_id in response
1006
1118
  }).passthrough();
1007
- var ProvisionCvmRequestSchema = z5.object({
1008
- node_id: z5.number().optional(),
1119
+ var ProvisionCvmRequestSchema = z6.object({
1120
+ node_id: z6.number().optional(),
1009
1121
  // recommended
1010
- teepod_id: z5.number().optional(),
1122
+ teepod_id: z6.number().optional(),
1011
1123
  // deprecated, for compatibility
1012
- name: z5.string(),
1013
- image: z5.string(),
1014
- vcpu: z5.number(),
1015
- memory: z5.number(),
1016
- disk_size: z5.number(),
1017
- compose_file: z5.object({
1018
- allowed_envs: z5.array(z5.string()).optional(),
1019
- pre_launch_script: z5.string().optional(),
1020
- docker_compose_file: z5.string().optional(),
1021
- name: z5.string().optional(),
1022
- kms_enabled: z5.boolean().optional(),
1023
- public_logs: z5.boolean().optional(),
1024
- public_sysinfo: z5.boolean().optional(),
1025
- gateway_enabled: z5.boolean().optional(),
1124
+ name: z6.string(),
1125
+ image: z6.string(),
1126
+ vcpu: z6.number(),
1127
+ memory: z6.number(),
1128
+ disk_size: z6.number(),
1129
+ compose_file: z6.object({
1130
+ allowed_envs: z6.array(z6.string()).optional(),
1131
+ pre_launch_script: z6.string().optional(),
1132
+ docker_compose_file: z6.string().optional(),
1133
+ name: z6.string().optional(),
1134
+ kms_enabled: z6.boolean().optional(),
1135
+ public_logs: z6.boolean().optional(),
1136
+ public_sysinfo: z6.boolean().optional(),
1137
+ gateway_enabled: z6.boolean().optional(),
1026
1138
  // recommended
1027
- tproxy_enabled: z5.boolean().optional()
1139
+ tproxy_enabled: z6.boolean().optional()
1028
1140
  // deprecated, for compatibility
1029
1141
  }),
1030
- listed: z5.boolean().optional(),
1031
- instance_type: z5.string().nullable().optional(),
1032
- kms_id: z5.string().optional(),
1033
- env_keys: z5.array(z5.string()).optional()
1142
+ listed: z6.boolean().optional(),
1143
+ instance_type: z6.string().nullable().optional(),
1144
+ kms_id: z6.string().optional(),
1145
+ env_keys: z6.array(z6.string()).optional()
1034
1146
  }).passthrough();
1035
1147
  function autofillComposeFileName(appCompose) {
1036
1148
  if (appCompose.compose_file && !appCompose.compose_file.name) {
@@ -1122,43 +1234,43 @@ async function safeProvisionCvm(client, appCompose, parameters) {
1122
1234
  }
1123
1235
 
1124
1236
  // src/actions/commit_cvm_provision.ts
1125
- import { z as z6 } from "zod";
1126
- var CommitCvmProvisionSchema = z6.object({
1127
- id: z6.number(),
1128
- name: z6.string(),
1129
- status: z6.string(),
1130
- teepod_id: z6.number(),
1131
- teepod: z6.object({
1132
- id: z6.number(),
1133
- name: z6.string()
1237
+ import { z as z7 } from "zod";
1238
+ var CommitCvmProvisionSchema = z7.object({
1239
+ id: z7.number(),
1240
+ name: z7.string(),
1241
+ status: z7.string(),
1242
+ teepod_id: z7.number(),
1243
+ teepod: z7.object({
1244
+ id: z7.number(),
1245
+ name: z7.string()
1134
1246
  }).nullable(),
1135
- user_id: z6.number().nullable(),
1136
- app_id: z6.string().nullable(),
1137
- vm_uuid: z6.string().nullable(),
1138
- instance_id: z6.string().nullable(),
1139
- app_url: z6.string().nullable(),
1140
- base_image: z6.string().nullable(),
1141
- vcpu: z6.number(),
1142
- memory: z6.number(),
1143
- disk_size: z6.number(),
1144
- manifest_version: z6.number().nullable(),
1145
- version: z6.string().nullable(),
1146
- runner: z6.string().nullable(),
1147
- docker_compose_file: z6.string().nullable(),
1148
- features: z6.array(z6.string()).nullable(),
1149
- created_at: z6.string(),
1150
- encrypted_env_pubkey: z6.string().nullable().optional(),
1151
- app_auth_contract_address: z6.string().nullable().optional(),
1152
- deployer_address: z6.string().nullable().optional()
1247
+ user_id: z7.number().nullable(),
1248
+ app_id: z7.string().nullable(),
1249
+ vm_uuid: z7.string().nullable(),
1250
+ instance_id: z7.string().nullable(),
1251
+ app_url: z7.string().nullable(),
1252
+ base_image: z7.string().nullable(),
1253
+ vcpu: z7.number(),
1254
+ memory: z7.number(),
1255
+ disk_size: z7.number(),
1256
+ manifest_version: z7.number().nullable(),
1257
+ version: z7.string().nullable(),
1258
+ runner: z7.string().nullable(),
1259
+ docker_compose_file: z7.string().nullable(),
1260
+ features: z7.array(z7.string()).nullable(),
1261
+ created_at: z7.string(),
1262
+ encrypted_env_pubkey: z7.string().nullable().optional(),
1263
+ app_auth_contract_address: z7.string().nullable().optional(),
1264
+ deployer_address: z7.string().nullable().optional()
1153
1265
  }).passthrough();
1154
- var CommitCvmProvisionRequestSchema = z6.object({
1155
- encrypted_env: z6.string().optional().nullable(),
1156
- app_id: z6.string(),
1157
- compose_hash: z6.string().optional(),
1158
- kms_id: z6.string().optional(),
1159
- contract_address: z6.string().optional(),
1160
- deployer_address: z6.string().optional(),
1161
- env_keys: z6.array(z6.string()).optional().nullable()
1266
+ var CommitCvmProvisionRequestSchema = z7.object({
1267
+ encrypted_env: z7.string().optional().nullable(),
1268
+ app_id: z7.string(),
1269
+ compose_hash: z7.string().optional(),
1270
+ kms_id: z7.string().optional(),
1271
+ contract_address: z7.string().optional(),
1272
+ deployer_address: z7.string().optional(),
1273
+ env_keys: z7.array(z7.string()).optional().nullable()
1162
1274
  }).passthrough();
1163
1275
  async function commitCvmProvision(client, payload, parameters) {
1164
1276
  validateActionParameters(parameters);
@@ -1187,7 +1299,7 @@ async function safeCommitCvmProvision(client, payload, parameters) {
1187
1299
  }
1188
1300
 
1189
1301
  // src/actions/deploy_app_auth.ts
1190
- import { z as z7 } from "zod";
1302
+ import { z as z8 } from "zod";
1191
1303
  import {
1192
1304
  createPublicClient as createPublicClient2,
1193
1305
  createWalletClient as createWalletClient2,
@@ -1226,25 +1338,25 @@ var kmsAuthAbi = [
1226
1338
  anonymous: false
1227
1339
  }
1228
1340
  ];
1229
- var DeployAppAuthRequestBaseSchema = z7.object({
1341
+ var DeployAppAuthRequestBaseSchema = z8.object({
1230
1342
  // Chain configuration (conditionally required)
1231
- chain: z7.unknown().optional(),
1232
- rpcUrl: z7.string().optional(),
1343
+ chain: z8.unknown().optional(),
1344
+ rpcUrl: z8.string().optional(),
1233
1345
  // Contract configuration (required)
1234
- kmsContractAddress: z7.string(),
1346
+ kmsContractAddress: z8.string(),
1235
1347
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1236
- privateKey: z7.string().optional(),
1237
- walletClient: z7.unknown().optional(),
1348
+ privateKey: z8.string().optional(),
1349
+ walletClient: z8.unknown().optional(),
1238
1350
  // Public client (optional, will create default if not provided)
1239
- publicClient: z7.unknown().optional(),
1351
+ publicClient: z8.unknown().optional(),
1240
1352
  // App configuration (optional)
1241
- allowAnyDevice: z7.boolean().optional().default(false),
1242
- deviceId: z7.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1243
- composeHash: z7.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1244
- disableUpgrades: z7.boolean().optional().default(false),
1353
+ allowAnyDevice: z8.boolean().optional().default(false),
1354
+ deviceId: z8.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1355
+ composeHash: z8.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1356
+ disableUpgrades: z8.boolean().optional().default(false),
1245
1357
  // Validation configuration (optional)
1246
- skipPrerequisiteChecks: z7.boolean().optional().default(false),
1247
- minBalance: z7.string().optional()
1358
+ skipPrerequisiteChecks: z8.boolean().optional().default(false),
1359
+ minBalance: z8.string().optional()
1248
1360
  // ETH amount as string, e.g., "0.01"
1249
1361
  }).passthrough();
1250
1362
  var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
@@ -1272,13 +1384,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
1272
1384
  path: ["chain"]
1273
1385
  }
1274
1386
  );
1275
- var DeployAppAuthSchema = z7.object({
1276
- appId: z7.string(),
1277
- appAuthAddress: z7.string(),
1278
- deployer: z7.string(),
1279
- transactionHash: z7.string(),
1280
- blockNumber: z7.bigint().optional(),
1281
- gasUsed: z7.bigint().optional()
1387
+ var DeployAppAuthSchema = z8.object({
1388
+ appId: z8.string(),
1389
+ appAuthAddress: z8.string(),
1390
+ deployer: z8.string(),
1391
+ transactionHash: z8.string(),
1392
+ blockNumber: z8.bigint().optional(),
1393
+ gasUsed: z8.bigint().optional()
1282
1394
  }).passthrough();
1283
1395
  function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
1284
1396
  try {
@@ -1524,7 +1636,7 @@ async function safeDeployAppAuth(request, parameters) {
1524
1636
  }
1525
1637
 
1526
1638
  // src/actions/add_compose_hash.ts
1527
- import { z as z8 } from "zod";
1639
+ import { z as z9 } from "zod";
1528
1640
  import {
1529
1641
  createPublicClient as createPublicClient3,
1530
1642
  createWalletClient as createWalletClient3,
@@ -1548,29 +1660,29 @@ var appAuthAbi = [
1548
1660
  anonymous: false
1549
1661
  }
1550
1662
  ];
1551
- var AddComposeHashRequestSchema = z8.object({
1663
+ var AddComposeHashRequestSchema = z9.object({
1552
1664
  // Chain configuration (conditionally required)
1553
- chain: z8.unknown().optional(),
1554
- rpcUrl: z8.string().optional(),
1555
- appId: z8.string(),
1556
- composeHash: z8.string(),
1665
+ chain: z9.unknown().optional(),
1666
+ rpcUrl: z9.string().optional(),
1667
+ appId: z9.string(),
1668
+ composeHash: z9.string(),
1557
1669
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1558
- privateKey: z8.string().optional(),
1559
- walletClient: z8.unknown().optional(),
1670
+ privateKey: z9.string().optional(),
1671
+ walletClient: z9.unknown().optional(),
1560
1672
  // Public client (optional, will create default if not provided)
1561
- publicClient: z8.unknown().optional(),
1673
+ publicClient: z9.unknown().optional(),
1562
1674
  // Validation configuration (optional)
1563
- skipPrerequisiteChecks: z8.boolean().optional().default(false),
1564
- minBalance: z8.string().optional(),
1675
+ skipPrerequisiteChecks: z9.boolean().optional().default(false),
1676
+ minBalance: z9.string().optional(),
1565
1677
  // ETH amount as string, e.g., "0.01"
1566
1678
  // Transaction control options
1567
- timeout: z8.number().optional().default(12e4),
1568
- retryOptions: z8.unknown().optional(),
1569
- signal: z8.unknown().optional(),
1679
+ timeout: z9.number().optional().default(12e4),
1680
+ retryOptions: z9.unknown().optional(),
1681
+ signal: z9.unknown().optional(),
1570
1682
  // Progress callbacks
1571
- onTransactionStateChange: z8.function().optional(),
1572
- onTransactionSubmitted: z8.function().optional(),
1573
- onTransactionConfirmed: z8.function().optional()
1683
+ onTransactionStateChange: z9.function().optional(),
1684
+ onTransactionSubmitted: z9.function().optional(),
1685
+ onTransactionConfirmed: z9.function().optional()
1574
1686
  }).passthrough().refine(
1575
1687
  (data) => {
1576
1688
  const hasPrivateKey = !!data.privateKey;
@@ -1594,12 +1706,12 @@ var AddComposeHashRequestSchema = z8.object({
1594
1706
  path: ["chain"]
1595
1707
  }
1596
1708
  );
1597
- var AddComposeHashSchema = z8.object({
1598
- composeHash: z8.string(),
1599
- appId: z8.string(),
1600
- transactionHash: z8.string(),
1601
- blockNumber: z8.bigint().optional(),
1602
- gasUsed: z8.bigint().optional()
1709
+ var AddComposeHashSchema = z9.object({
1710
+ composeHash: z9.string(),
1711
+ appId: z9.string(),
1712
+ transactionHash: z9.string(),
1713
+ blockNumber: z9.bigint().optional(),
1714
+ gasUsed: z9.bigint().optional()
1603
1715
  }).passthrough();
1604
1716
  function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
1605
1717
  console.log(receipt.logs);
@@ -1791,27 +1903,27 @@ async function safeAddComposeHash(request, parameters) {
1791
1903
  }
1792
1904
 
1793
1905
  // src/actions/get_cvm_compose_file.ts
1794
- import { z as z9 } from "zod";
1795
- var GetCvmComposeFileResultSchema = z9.object({
1796
- allowed_envs: z9.array(z9.string()).optional(),
1797
- docker_compose_file: z9.string(),
1798
- features: z9.array(z9.string()).optional(),
1799
- name: z9.string().optional(),
1800
- manifest_version: z9.number().optional(),
1801
- kms_enabled: z9.boolean().optional(),
1802
- public_logs: z9.boolean().optional(),
1803
- public_sysinfo: z9.boolean().optional(),
1804
- tproxy_enabled: z9.boolean().optional(),
1805
- pre_launch_script: z9.string().optional()
1906
+ import { z as z10 } from "zod";
1907
+ var GetCvmComposeFileResultSchema = z10.object({
1908
+ allowed_envs: z10.array(z10.string()).optional(),
1909
+ docker_compose_file: z10.string(),
1910
+ features: z10.array(z10.string()).optional(),
1911
+ name: z10.string().optional(),
1912
+ manifest_version: z10.number().optional(),
1913
+ kms_enabled: z10.boolean().optional(),
1914
+ public_logs: z10.boolean().optional(),
1915
+ public_sysinfo: z10.boolean().optional(),
1916
+ tproxy_enabled: z10.boolean().optional(),
1917
+ pre_launch_script: z10.string().optional()
1806
1918
  }).passthrough();
1807
- var GetCvmComposeFileRequestSchema = z9.object({
1808
- id: z9.string().optional(),
1809
- uuid: z9.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1810
- app_id: z9.string().refine(
1919
+ var GetCvmComposeFileRequestSchema = z10.object({
1920
+ id: z10.string().optional(),
1921
+ uuid: z10.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1922
+ app_id: z10.string().refine(
1811
1923
  (val) => !val.startsWith("app_") && val.length === 40,
1812
1924
  "app_id should be 40 characters without prefix"
1813
1925
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1814
- instance_id: z9.string().refine(
1926
+ instance_id: z10.string().refine(
1815
1927
  (val) => !val.startsWith("instance_") && val.length === 40,
1816
1928
  "instance_id should be 40 characters without prefix"
1817
1929
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional()
@@ -1848,26 +1960,26 @@ async function safeGetCvmComposeFile(client, request, parameters) {
1848
1960
  }
1849
1961
 
1850
1962
  // src/actions/provision_cvm_compose_file_update.ts
1851
- import { z as z10 } from "zod";
1852
- var ProvisionCvmComposeFileUpdateRequestSchema = z10.object({
1853
- id: z10.string().optional(),
1854
- uuid: z10.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1855
- app_id: z10.string().refine(
1963
+ import { z as z11 } from "zod";
1964
+ var ProvisionCvmComposeFileUpdateRequestSchema = z11.object({
1965
+ id: z11.string().optional(),
1966
+ uuid: z11.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1967
+ app_id: z11.string().refine(
1856
1968
  (val) => !val.startsWith("app_") && val.length === 40,
1857
1969
  "app_id should be 40 characters without prefix"
1858
1970
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1859
- instance_id: z10.string().refine(
1971
+ instance_id: z11.string().refine(
1860
1972
  (val) => !val.startsWith("instance_") && val.length === 40,
1861
1973
  "instance_id should be 40 characters without prefix"
1862
1974
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
1863
- app_compose: z10.object({
1864
- allowed_envs: z10.array(z10.string()).optional(),
1865
- docker_compose_file: z10.string().min(1, "Docker compose file is required"),
1866
- name: z10.string(),
1867
- kms_enabled: z10.boolean().optional(),
1868
- public_logs: z10.boolean().optional(),
1869
- public_sysinfo: z10.boolean().optional(),
1870
- pre_launch_script: z10.string().optional()
1975
+ app_compose: z11.object({
1976
+ allowed_envs: z11.array(z11.string()).optional(),
1977
+ docker_compose_file: z11.string().min(1, "Docker compose file is required"),
1978
+ name: z11.string(),
1979
+ kms_enabled: z11.boolean().optional(),
1980
+ public_logs: z11.boolean().optional(),
1981
+ public_sysinfo: z11.boolean().optional(),
1982
+ pre_launch_script: z11.string().optional()
1871
1983
  })
1872
1984
  }).refine(
1873
1985
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
@@ -1877,10 +1989,10 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z10.object({
1877
1989
  request: data.app_compose,
1878
1990
  _raw: data
1879
1991
  }));
1880
- var ProvisionCvmComposeFileUpdateResultSchema = z10.object({
1881
- app_id: z10.string().nullable(),
1882
- device_id: z10.string().nullable(),
1883
- compose_hash: z10.string(),
1992
+ var ProvisionCvmComposeFileUpdateResultSchema = z11.object({
1993
+ app_id: z11.string().nullable(),
1994
+ device_id: z11.string().nullable(),
1995
+ compose_hash: z11.string(),
1884
1996
  kms_info: KmsInfoSchema.nullable().optional()
1885
1997
  }).passthrough();
1886
1998
  async function provisionCvmComposeFileUpdate(client, request, parameters) {
@@ -1915,21 +2027,21 @@ async function safeProvisionCvmComposeFileUpdate(client, request, parameters) {
1915
2027
  }
1916
2028
 
1917
2029
  // src/actions/commit_cvm_compose_file_update.ts
1918
- import { z as z11 } from "zod";
1919
- var CommitCvmComposeFileUpdateRequestSchema = z11.object({
1920
- id: z11.string().optional(),
1921
- uuid: z11.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1922
- app_id: z11.string().refine(
2030
+ import { z as z12 } from "zod";
2031
+ var CommitCvmComposeFileUpdateRequestSchema = z12.object({
2032
+ id: z12.string().optional(),
2033
+ uuid: z12.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
2034
+ app_id: z12.string().refine(
1923
2035
  (val) => !val.startsWith("app_") && val.length === 40,
1924
2036
  "app_id should be 40 characters without prefix"
1925
2037
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1926
- instance_id: z11.string().refine(
2038
+ instance_id: z12.string().refine(
1927
2039
  (val) => !val.startsWith("instance_") && val.length === 40,
1928
2040
  "instance_id should be 40 characters without prefix"
1929
2041
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
1930
- compose_hash: z11.string().min(1, "Compose hash is required"),
1931
- encrypted_env: z11.string().optional(),
1932
- env_keys: z11.array(z11.string()).optional()
2042
+ compose_hash: z12.string().min(1, "Compose hash is required"),
2043
+ encrypted_env: z12.string().optional(),
2044
+ env_keys: z12.array(z12.string()).optional()
1933
2045
  }).refine(
1934
2046
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
1935
2047
  "One of id, uuid, app_id, or instance_id must be provided"
@@ -1940,7 +2052,7 @@ var CommitCvmComposeFileUpdateRequestSchema = z11.object({
1940
2052
  env_keys: data.env_keys,
1941
2053
  _raw: data
1942
2054
  }));
1943
- var CommitCvmComposeFileUpdateSchema = z11.any().transform(() => void 0);
2055
+ var CommitCvmComposeFileUpdateSchema = z12.any().transform(() => void 0);
1944
2056
  async function commitCvmComposeFileUpdate(client, request, parameters) {
1945
2057
  const validatedRequest = CommitCvmComposeFileUpdateRequestSchema.parse(request);
1946
2058
  const response = await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
@@ -1975,17 +2087,17 @@ async function safeCommitCvmComposeFileUpdate(client, request, parameters) {
1975
2087
  }
1976
2088
 
1977
2089
  // src/actions/get_app_env_encrypt_pubkey.ts
1978
- import { z as z12 } from "zod";
1979
- var GetAppEnvEncryptPubKeyRequestSchema = z12.object({
1980
- kms: z12.string().min(1, "KMS ID or slug is required"),
1981
- app_id: z12.string().refine(
2090
+ import { z as z13 } from "zod";
2091
+ var GetAppEnvEncryptPubKeyRequestSchema = z13.object({
2092
+ kms: z13.string().min(1, "KMS ID or slug is required"),
2093
+ app_id: z13.string().refine(
1982
2094
  (val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
1983
2095
  "App ID must be exactly 40 characters or 42 characters with 0x prefix"
1984
2096
  )
1985
2097
  }).strict();
1986
- var GetAppEnvEncryptPubKeySchema = z12.object({
1987
- public_key: z12.string(),
1988
- signature: z12.string()
2098
+ var GetAppEnvEncryptPubKeySchema = z13.object({
2099
+ public_key: z13.string(),
2100
+ signature: z13.string()
1989
2101
  }).strict();
1990
2102
  var getAppEnvEncryptPubKey = async (client, payload, parameters) => {
1991
2103
  const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
@@ -2023,101 +2135,6 @@ var safeGetAppEnvEncryptPubKey = async (client, payload, parameters) => {
2023
2135
 
2024
2136
  // src/actions/get_cvm_info.ts
2025
2137
  import { z as z14 } from "zod";
2026
-
2027
- // src/types/cvm_info.ts
2028
- import { z as z13 } from "zod";
2029
- var VmInfoSchema = z13.object({
2030
- id: z13.string(),
2031
- name: z13.string(),
2032
- status: z13.string(),
2033
- uptime: z13.string(),
2034
- app_url: z13.string().nullable(),
2035
- app_id: z13.string(),
2036
- instance_id: z13.string().nullable(),
2037
- configuration: z13.any().optional(),
2038
- // TODO: add VmConfiguration schema if needed
2039
- exited_at: z13.string().nullable(),
2040
- boot_progress: z13.string().nullable(),
2041
- boot_error: z13.string().nullable(),
2042
- shutdown_progress: z13.string().nullable(),
2043
- image_version: z13.string().nullable()
2044
- });
2045
- var ManagedUserSchema = z13.object({
2046
- id: z13.number(),
2047
- username: z13.string()
2048
- });
2049
- var CvmNodeSchema = z13.object({
2050
- id: z13.number(),
2051
- name: z13.string(),
2052
- region_identifier: z13.string().optional()
2053
- });
2054
- var CvmNetworkUrlsSchema = z13.object({
2055
- app: z13.string(),
2056
- instance: z13.string()
2057
- });
2058
- var KMSInfoSchema = z13.object({
2059
- id: z13.string(),
2060
- // HashedId is represented as string in JS
2061
- slug: z13.string(),
2062
- url: z13.string(),
2063
- version: z13.string(),
2064
- chain_id: z13.number().optional(),
2065
- kms_contract_address: z13.string().optional(),
2066
- gateway_app_id: z13.string().optional()
2067
- });
2068
- var CvmInfoSchema = z13.object({
2069
- hosted: VmInfoSchema,
2070
- name: z13.string(),
2071
- managed_user: ManagedUserSchema.optional().nullable(),
2072
- node: CvmNodeSchema.optional().nullable(),
2073
- listed: z13.boolean().default(false),
2074
- status: z13.string(),
2075
- in_progress: z13.boolean().default(false),
2076
- dapp_dashboard_url: z13.string().nullable(),
2077
- syslog_endpoint: z13.string().nullable(),
2078
- allow_upgrade: z13.boolean().default(false),
2079
- project_id: z13.string().nullable(),
2080
- // HashedId is represented as string in JS
2081
- project_type: z13.string().nullable(),
2082
- billing_period: z13.string().nullable(),
2083
- kms_info: KMSInfoSchema.nullable(),
2084
- vcpu: z13.number().nullable(),
2085
- memory: z13.number().nullable(),
2086
- disk_size: z13.number().nullable(),
2087
- gateway_domain: z13.string().nullable(),
2088
- public_urls: z13.array(CvmNetworkUrlsSchema)
2089
- }).partial();
2090
- var CvmLegacyDetailSchema = z13.object({
2091
- id: z13.number(),
2092
- name: z13.string(),
2093
- status: z13.string(),
2094
- in_progress: z13.boolean(),
2095
- teepod_id: z13.number().nullable(),
2096
- teepod: CvmNodeSchema,
2097
- app_id: z13.string(),
2098
- vm_uuid: z13.string().nullable(),
2099
- instance_id: z13.string().nullable(),
2100
- vcpu: z13.number().nullable(),
2101
- memory: z13.number().nullable(),
2102
- disk_size: z13.number().nullable(),
2103
- base_image: z13.string(),
2104
- encrypted_env_pubkey: z13.string().nullable(),
2105
- listed: z13.boolean(),
2106
- project_id: z13.string().nullable(),
2107
- project_type: z13.string().nullable(),
2108
- public_sysinfo: z13.boolean(),
2109
- public_logs: z13.boolean(),
2110
- dapp_dashboard_url: z13.string().nullable(),
2111
- syslog_endpoint: z13.string().nullable(),
2112
- kms_info: KMSInfoSchema.nullable(),
2113
- contract_address: z13.string().nullable(),
2114
- deployer_address: z13.string().nullable(),
2115
- scheduled_delete_at: z13.string().nullable(),
2116
- public_urls: z13.array(CvmNetworkUrlsSchema),
2117
- gateway_domain: z13.string().nullable()
2118
- });
2119
-
2120
- // src/actions/get_cvm_info.ts
2121
2138
  var GetCvmInfoRequestSchema = z14.object({
2122
2139
  id: z14.string().optional(),
2123
2140
  uuid: z14.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
@@ -2348,20 +2365,28 @@ export {
2348
2365
  CommitCvmProvisionRequestSchema,
2349
2366
  CommitCvmProvisionSchema,
2350
2367
  CurrentUserSchema,
2368
+ CvmInfoSchema,
2351
2369
  CvmLegacyDetailSchema,
2370
+ CvmNetworkUrlsSchema,
2371
+ CvmNodeSchema,
2352
2372
  DeployAppAuthRequestSchema,
2353
2373
  DeployAppAuthSchema,
2354
2374
  GetAppEnvEncryptPubKeySchema,
2355
2375
  GetCvmComposeFileResultSchema,
2356
2376
  GetCvmListSchema,
2357
2377
  GetKmsListSchema,
2378
+ KMSInfoSchema,
2379
+ KmsInfoSchema,
2380
+ ManagedUserSchema,
2358
2381
  NetworkError,
2359
2382
  ProvisionCvmComposeFileUpdateRequestSchema,
2360
2383
  ProvisionCvmComposeFileUpdateResultSchema,
2361
2384
  ProvisionCvmRequestSchema,
2362
2385
  ProvisionCvmSchema,
2363
2386
  RequestError,
2387
+ SUPPORTED_CHAINS,
2364
2388
  TransactionError,
2389
+ VmInfoSchema,
2365
2390
  WalletError,
2366
2391
  addComposeHash,
2367
2392
  addNetwork,