@phala/cloud 0.0.5 → 0.0.7

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,74 +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
-
932
- // src/types/supported_chains.ts
933
- import { anvil, base, mainnet } from "viem/chains";
934
- var SUPPORTED_CHAINS = {
935
- [mainnet.id]: mainnet,
936
- [base.id]: base,
937
- [anvil.id]: anvil
938
- };
939
-
940
- // src/types/kms_info.ts
941
- var KmsInfoBaseSchema = z3.object({
942
- id: z3.string(),
943
- slug: z3.string().nullable(),
944
- url: z3.string(),
945
- version: z3.string(),
946
- chain_id: z3.number().nullable(),
947
- kms_contract_address: z3.string().nullable().transform((val) => val),
948
- gateway_app_id: z3.string().nullable().transform((val) => val)
949
- }).passthrough();
950
- var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
951
- if (data.chain_id != null) {
952
- const chain = SUPPORTED_CHAINS[data.chain_id];
953
- if (chain) {
954
- return { ...data, chain };
955
- }
956
- }
957
- return data;
958
- });
959
-
960
- // src/actions/get_available_nodes.ts
961
- var AvailableOSImageSchema = z4.object({
962
- name: z4.string(),
963
- is_dev: z4.boolean(),
964
- version: z4.tuple([z4.number(), z4.number(), z4.number()]),
965
- 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()
966
1057
  }).passthrough();
967
- var TeepodCapacitySchema = z4.object({
968
- teepod_id: z4.number(),
969
- name: z4.string(),
970
- listed: z4.boolean(),
971
- resource_score: z4.number(),
972
- remaining_vcpu: z4.number(),
973
- remaining_memory: z4.number(),
974
- remaining_cvm_slots: z4.number(),
975
- images: z4.array(AvailableOSImageSchema),
976
- support_onchain_kms: z4.boolean().optional(),
977
- fmspc: z4.string().nullable().optional(),
978
- device_id: z4.string().nullable().optional(),
979
- region_identifier: z4.string().nullable().optional(),
980
- default_kms: z4.string().nullable().optional(),
981
- kms_list: z4.array(z4.string()).default([])
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([])
982
1073
  }).passthrough();
983
- var ResourceThresholdSchema = z4.object({
984
- max_instances: z4.number().nullable().optional(),
985
- max_vcpu: z4.number().nullable().optional(),
986
- max_memory: z4.number().nullable().optional(),
987
- 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()
988
1079
  }).passthrough();
989
- var AvailableNodesSchema = z4.object({
990
- tier: z4.string(),
1080
+ var AvailableNodesSchema = z5.object({
1081
+ tier: z5.string(),
991
1082
  // TeamTier is string enum
992
1083
  capacity: ResourceThresholdSchema,
993
- nodes: z4.array(TeepodCapacitySchema),
994
- kms_list: z4.array(KmsInfoSchema)
1084
+ nodes: z5.array(TeepodCapacitySchema),
1085
+ kms_list: z5.array(KmsInfoSchema)
995
1086
  }).passthrough();
996
1087
  async function getAvailableNodes(client, parameters) {
997
1088
  const response = await client.get("/teepods/available");
@@ -1014,44 +1105,45 @@ async function safeGetAvailableNodes(client, parameters) {
1014
1105
  }
1015
1106
 
1016
1107
  // src/actions/provision_cvm.ts
1017
- import { z as z5 } from "zod";
1018
- var ProvisionCvmSchema = z5.object({
1019
- app_id: z5.string().nullable().optional(),
1020
- app_env_encrypt_pubkey: z5.string().nullable().optional(),
1021
- compose_hash: z5.string(),
1022
- fmspc: z5.string().nullable().optional(),
1023
- device_id: z5.string().nullable().optional(),
1024
- os_image_hash: z5.string().nullable().optional(),
1025
- 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(),
1026
1117
  // Transformed from teepod_id in response
1118
+ kms_id: z6.string().nullable().optional()
1027
1119
  }).passthrough();
1028
- var ProvisionCvmRequestSchema = z5.object({
1029
- node_id: z5.number().optional(),
1120
+ var ProvisionCvmRequestSchema = z6.object({
1121
+ node_id: z6.number().optional(),
1030
1122
  // recommended
1031
- teepod_id: z5.number().optional(),
1123
+ teepod_id: z6.number().optional(),
1032
1124
  // deprecated, for compatibility
1033
- name: z5.string(),
1034
- image: z5.string(),
1035
- vcpu: z5.number(),
1036
- memory: z5.number(),
1037
- disk_size: z5.number(),
1038
- compose_file: z5.object({
1039
- allowed_envs: z5.array(z5.string()).optional(),
1040
- pre_launch_script: z5.string().optional(),
1041
- docker_compose_file: z5.string().optional(),
1042
- name: z5.string().optional(),
1043
- kms_enabled: z5.boolean().optional(),
1044
- public_logs: z5.boolean().optional(),
1045
- public_sysinfo: z5.boolean().optional(),
1046
- gateway_enabled: z5.boolean().optional(),
1125
+ name: z6.string(),
1126
+ image: z6.string(),
1127
+ vcpu: z6.number(),
1128
+ memory: z6.number(),
1129
+ disk_size: z6.number(),
1130
+ compose_file: z6.object({
1131
+ allowed_envs: z6.array(z6.string()).optional(),
1132
+ pre_launch_script: z6.string().optional(),
1133
+ docker_compose_file: z6.string().optional(),
1134
+ name: z6.string().optional(),
1135
+ kms_enabled: z6.boolean().optional(),
1136
+ public_logs: z6.boolean().optional(),
1137
+ public_sysinfo: z6.boolean().optional(),
1138
+ gateway_enabled: z6.boolean().optional(),
1047
1139
  // recommended
1048
- tproxy_enabled: z5.boolean().optional()
1140
+ tproxy_enabled: z6.boolean().optional()
1049
1141
  // deprecated, for compatibility
1050
1142
  }),
1051
- listed: z5.boolean().optional(),
1052
- instance_type: z5.string().nullable().optional(),
1053
- kms_id: z5.string().optional(),
1054
- env_keys: z5.array(z5.string()).optional()
1143
+ listed: z6.boolean().optional(),
1144
+ instance_type: z6.string().nullable().optional(),
1145
+ kms_id: z6.string().optional(),
1146
+ env_keys: z6.array(z6.string()).optional()
1055
1147
  }).passthrough();
1056
1148
  function autofillComposeFileName(appCompose) {
1057
1149
  if (appCompose.compose_file && !appCompose.compose_file.name) {
@@ -1143,43 +1235,43 @@ async function safeProvisionCvm(client, appCompose, parameters) {
1143
1235
  }
1144
1236
 
1145
1237
  // src/actions/commit_cvm_provision.ts
1146
- import { z as z6 } from "zod";
1147
- var CommitCvmProvisionSchema = z6.object({
1148
- id: z6.number(),
1149
- name: z6.string(),
1150
- status: z6.string(),
1151
- teepod_id: z6.number(),
1152
- teepod: z6.object({
1153
- id: z6.number(),
1154
- name: z6.string()
1238
+ import { z as z7 } from "zod";
1239
+ var CommitCvmProvisionSchema = z7.object({
1240
+ id: z7.number(),
1241
+ name: z7.string(),
1242
+ status: z7.string(),
1243
+ teepod_id: z7.number(),
1244
+ teepod: z7.object({
1245
+ id: z7.number(),
1246
+ name: z7.string()
1155
1247
  }).nullable(),
1156
- user_id: z6.number().nullable(),
1157
- app_id: z6.string().nullable(),
1158
- vm_uuid: z6.string().nullable(),
1159
- instance_id: z6.string().nullable(),
1160
- app_url: z6.string().nullable(),
1161
- base_image: z6.string().nullable(),
1162
- vcpu: z6.number(),
1163
- memory: z6.number(),
1164
- disk_size: z6.number(),
1165
- manifest_version: z6.number().nullable(),
1166
- version: z6.string().nullable(),
1167
- runner: z6.string().nullable(),
1168
- docker_compose_file: z6.string().nullable(),
1169
- features: z6.array(z6.string()).nullable(),
1170
- created_at: z6.string(),
1171
- encrypted_env_pubkey: z6.string().nullable().optional(),
1172
- app_auth_contract_address: z6.string().nullable().optional(),
1173
- deployer_address: z6.string().nullable().optional()
1248
+ user_id: z7.number().nullable(),
1249
+ app_id: z7.string().nullable(),
1250
+ vm_uuid: z7.string().nullable(),
1251
+ instance_id: z7.string().nullable(),
1252
+ app_url: z7.string().nullable(),
1253
+ base_image: z7.string().nullable(),
1254
+ vcpu: z7.number(),
1255
+ memory: z7.number(),
1256
+ disk_size: z7.number(),
1257
+ manifest_version: z7.number().nullable(),
1258
+ version: z7.string().nullable(),
1259
+ runner: z7.string().nullable(),
1260
+ docker_compose_file: z7.string().nullable(),
1261
+ features: z7.array(z7.string()).nullable(),
1262
+ created_at: z7.string(),
1263
+ encrypted_env_pubkey: z7.string().nullable().optional(),
1264
+ app_auth_contract_address: z7.string().nullable().optional(),
1265
+ deployer_address: z7.string().nullable().optional()
1174
1266
  }).passthrough();
1175
- var CommitCvmProvisionRequestSchema = z6.object({
1176
- encrypted_env: z6.string().optional().nullable(),
1177
- app_id: z6.string(),
1178
- compose_hash: z6.string().optional(),
1179
- kms_id: z6.string().optional(),
1180
- contract_address: z6.string().optional(),
1181
- deployer_address: z6.string().optional(),
1182
- env_keys: z6.array(z6.string()).optional().nullable()
1267
+ var CommitCvmProvisionRequestSchema = z7.object({
1268
+ encrypted_env: z7.string().optional().nullable(),
1269
+ app_id: z7.string(),
1270
+ compose_hash: z7.string().optional(),
1271
+ kms_id: z7.string().optional(),
1272
+ contract_address: z7.string().optional(),
1273
+ deployer_address: z7.string().optional(),
1274
+ env_keys: z7.array(z7.string()).optional().nullable()
1183
1275
  }).passthrough();
1184
1276
  async function commitCvmProvision(client, payload, parameters) {
1185
1277
  validateActionParameters(parameters);
@@ -1208,7 +1300,7 @@ async function safeCommitCvmProvision(client, payload, parameters) {
1208
1300
  }
1209
1301
 
1210
1302
  // src/actions/deploy_app_auth.ts
1211
- import { z as z7 } from "zod";
1303
+ import { z as z8 } from "zod";
1212
1304
  import {
1213
1305
  createPublicClient as createPublicClient2,
1214
1306
  createWalletClient as createWalletClient2,
@@ -1247,25 +1339,25 @@ var kmsAuthAbi = [
1247
1339
  anonymous: false
1248
1340
  }
1249
1341
  ];
1250
- var DeployAppAuthRequestBaseSchema = z7.object({
1342
+ var DeployAppAuthRequestBaseSchema = z8.object({
1251
1343
  // Chain configuration (conditionally required)
1252
- chain: z7.unknown().optional(),
1253
- rpcUrl: z7.string().optional(),
1344
+ chain: z8.unknown().optional(),
1345
+ rpcUrl: z8.string().optional(),
1254
1346
  // Contract configuration (required)
1255
- kmsContractAddress: z7.string(),
1347
+ kmsContractAddress: z8.string(),
1256
1348
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1257
- privateKey: z7.string().optional(),
1258
- walletClient: z7.unknown().optional(),
1349
+ privateKey: z8.string().optional(),
1350
+ walletClient: z8.unknown().optional(),
1259
1351
  // Public client (optional, will create default if not provided)
1260
- publicClient: z7.unknown().optional(),
1352
+ publicClient: z8.unknown().optional(),
1261
1353
  // App configuration (optional)
1262
- allowAnyDevice: z7.boolean().optional().default(false),
1263
- deviceId: z7.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1264
- composeHash: z7.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1265
- disableUpgrades: z7.boolean().optional().default(false),
1354
+ allowAnyDevice: z8.boolean().optional().default(false),
1355
+ deviceId: z8.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1356
+ composeHash: z8.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
1357
+ disableUpgrades: z8.boolean().optional().default(false),
1266
1358
  // Validation configuration (optional)
1267
- skipPrerequisiteChecks: z7.boolean().optional().default(false),
1268
- minBalance: z7.string().optional()
1359
+ skipPrerequisiteChecks: z8.boolean().optional().default(false),
1360
+ minBalance: z8.string().optional()
1269
1361
  // ETH amount as string, e.g., "0.01"
1270
1362
  }).passthrough();
1271
1363
  var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
@@ -1293,13 +1385,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
1293
1385
  path: ["chain"]
1294
1386
  }
1295
1387
  );
1296
- var DeployAppAuthSchema = z7.object({
1297
- appId: z7.string(),
1298
- appAuthAddress: z7.string(),
1299
- deployer: z7.string(),
1300
- transactionHash: z7.string(),
1301
- blockNumber: z7.bigint().optional(),
1302
- gasUsed: z7.bigint().optional()
1388
+ var DeployAppAuthSchema = z8.object({
1389
+ appId: z8.string(),
1390
+ appAuthAddress: z8.string(),
1391
+ deployer: z8.string(),
1392
+ transactionHash: z8.string(),
1393
+ blockNumber: z8.bigint().optional(),
1394
+ gasUsed: z8.bigint().optional()
1303
1395
  }).passthrough();
1304
1396
  function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
1305
1397
  try {
@@ -1545,7 +1637,7 @@ async function safeDeployAppAuth(request, parameters) {
1545
1637
  }
1546
1638
 
1547
1639
  // src/actions/add_compose_hash.ts
1548
- import { z as z8 } from "zod";
1640
+ import { z as z9 } from "zod";
1549
1641
  import {
1550
1642
  createPublicClient as createPublicClient3,
1551
1643
  createWalletClient as createWalletClient3,
@@ -1569,29 +1661,29 @@ var appAuthAbi = [
1569
1661
  anonymous: false
1570
1662
  }
1571
1663
  ];
1572
- var AddComposeHashRequestSchema = z8.object({
1664
+ var AddComposeHashRequestSchema = z9.object({
1573
1665
  // Chain configuration (conditionally required)
1574
- chain: z8.unknown().optional(),
1575
- rpcUrl: z8.string().optional(),
1576
- appId: z8.string(),
1577
- composeHash: z8.string(),
1666
+ chain: z9.unknown().optional(),
1667
+ rpcUrl: z9.string().optional(),
1668
+ appId: z9.string(),
1669
+ composeHash: z9.string(),
1578
1670
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1579
- privateKey: z8.string().optional(),
1580
- walletClient: z8.unknown().optional(),
1671
+ privateKey: z9.string().optional(),
1672
+ walletClient: z9.unknown().optional(),
1581
1673
  // Public client (optional, will create default if not provided)
1582
- publicClient: z8.unknown().optional(),
1674
+ publicClient: z9.unknown().optional(),
1583
1675
  // Validation configuration (optional)
1584
- skipPrerequisiteChecks: z8.boolean().optional().default(false),
1585
- minBalance: z8.string().optional(),
1676
+ skipPrerequisiteChecks: z9.boolean().optional().default(false),
1677
+ minBalance: z9.string().optional(),
1586
1678
  // ETH amount as string, e.g., "0.01"
1587
1679
  // Transaction control options
1588
- timeout: z8.number().optional().default(12e4),
1589
- retryOptions: z8.unknown().optional(),
1590
- signal: z8.unknown().optional(),
1680
+ timeout: z9.number().optional().default(12e4),
1681
+ retryOptions: z9.unknown().optional(),
1682
+ signal: z9.unknown().optional(),
1591
1683
  // Progress callbacks
1592
- onTransactionStateChange: z8.function().optional(),
1593
- onTransactionSubmitted: z8.function().optional(),
1594
- onTransactionConfirmed: z8.function().optional()
1684
+ onTransactionStateChange: z9.function().optional(),
1685
+ onTransactionSubmitted: z9.function().optional(),
1686
+ onTransactionConfirmed: z9.function().optional()
1595
1687
  }).passthrough().refine(
1596
1688
  (data) => {
1597
1689
  const hasPrivateKey = !!data.privateKey;
@@ -1615,12 +1707,12 @@ var AddComposeHashRequestSchema = z8.object({
1615
1707
  path: ["chain"]
1616
1708
  }
1617
1709
  );
1618
- var AddComposeHashSchema = z8.object({
1619
- composeHash: z8.string(),
1620
- appId: z8.string(),
1621
- transactionHash: z8.string(),
1622
- blockNumber: z8.bigint().optional(),
1623
- gasUsed: z8.bigint().optional()
1710
+ var AddComposeHashSchema = z9.object({
1711
+ composeHash: z9.string(),
1712
+ appId: z9.string(),
1713
+ transactionHash: z9.string(),
1714
+ blockNumber: z9.bigint().optional(),
1715
+ gasUsed: z9.bigint().optional()
1624
1716
  }).passthrough();
1625
1717
  function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
1626
1718
  console.log(receipt.logs);
@@ -1812,27 +1904,27 @@ async function safeAddComposeHash(request, parameters) {
1812
1904
  }
1813
1905
 
1814
1906
  // src/actions/get_cvm_compose_file.ts
1815
- import { z as z9 } from "zod";
1816
- var GetCvmComposeFileResultSchema = z9.object({
1817
- allowed_envs: z9.array(z9.string()).optional(),
1818
- docker_compose_file: z9.string(),
1819
- features: z9.array(z9.string()).optional(),
1820
- name: z9.string().optional(),
1821
- manifest_version: z9.number().optional(),
1822
- kms_enabled: z9.boolean().optional(),
1823
- public_logs: z9.boolean().optional(),
1824
- public_sysinfo: z9.boolean().optional(),
1825
- tproxy_enabled: z9.boolean().optional(),
1826
- pre_launch_script: z9.string().optional()
1907
+ import { z as z10 } from "zod";
1908
+ var GetCvmComposeFileResultSchema = z10.object({
1909
+ allowed_envs: z10.array(z10.string()).optional(),
1910
+ docker_compose_file: z10.string(),
1911
+ features: z10.array(z10.string()).optional(),
1912
+ name: z10.string().optional(),
1913
+ manifest_version: z10.number().optional(),
1914
+ kms_enabled: z10.boolean().optional(),
1915
+ public_logs: z10.boolean().optional(),
1916
+ public_sysinfo: z10.boolean().optional(),
1917
+ tproxy_enabled: z10.boolean().optional(),
1918
+ pre_launch_script: z10.string().optional()
1827
1919
  }).passthrough();
1828
- var GetCvmComposeFileRequestSchema = z9.object({
1829
- id: z9.string().optional(),
1830
- 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(),
1831
- app_id: z9.string().refine(
1920
+ var GetCvmComposeFileRequestSchema = z10.object({
1921
+ id: z10.string().optional(),
1922
+ 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(),
1923
+ app_id: z10.string().refine(
1832
1924
  (val) => !val.startsWith("app_") && val.length === 40,
1833
1925
  "app_id should be 40 characters without prefix"
1834
1926
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1835
- instance_id: z9.string().refine(
1927
+ instance_id: z10.string().refine(
1836
1928
  (val) => !val.startsWith("instance_") && val.length === 40,
1837
1929
  "instance_id should be 40 characters without prefix"
1838
1930
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional()
@@ -1869,26 +1961,26 @@ async function safeGetCvmComposeFile(client, request, parameters) {
1869
1961
  }
1870
1962
 
1871
1963
  // src/actions/provision_cvm_compose_file_update.ts
1872
- import { z as z10 } from "zod";
1873
- var ProvisionCvmComposeFileUpdateRequestSchema = z10.object({
1874
- id: z10.string().optional(),
1875
- 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(),
1876
- app_id: z10.string().refine(
1964
+ import { z as z11 } from "zod";
1965
+ var ProvisionCvmComposeFileUpdateRequestSchema = z11.object({
1966
+ id: z11.string().optional(),
1967
+ 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(),
1968
+ app_id: z11.string().refine(
1877
1969
  (val) => !val.startsWith("app_") && val.length === 40,
1878
1970
  "app_id should be 40 characters without prefix"
1879
1971
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1880
- instance_id: z10.string().refine(
1972
+ instance_id: z11.string().refine(
1881
1973
  (val) => !val.startsWith("instance_") && val.length === 40,
1882
1974
  "instance_id should be 40 characters without prefix"
1883
1975
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
1884
- app_compose: z10.object({
1885
- allowed_envs: z10.array(z10.string()).optional(),
1886
- docker_compose_file: z10.string().min(1, "Docker compose file is required"),
1887
- name: z10.string(),
1888
- kms_enabled: z10.boolean().optional(),
1889
- public_logs: z10.boolean().optional(),
1890
- public_sysinfo: z10.boolean().optional(),
1891
- pre_launch_script: z10.string().optional()
1976
+ app_compose: z11.object({
1977
+ allowed_envs: z11.array(z11.string()).optional(),
1978
+ docker_compose_file: z11.string().min(1, "Docker compose file is required"),
1979
+ name: z11.string(),
1980
+ kms_enabled: z11.boolean().optional(),
1981
+ public_logs: z11.boolean().optional(),
1982
+ public_sysinfo: z11.boolean().optional(),
1983
+ pre_launch_script: z11.string().optional()
1892
1984
  })
1893
1985
  }).refine(
1894
1986
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
@@ -1898,10 +1990,10 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z10.object({
1898
1990
  request: data.app_compose,
1899
1991
  _raw: data
1900
1992
  }));
1901
- var ProvisionCvmComposeFileUpdateResultSchema = z10.object({
1902
- app_id: z10.string().nullable(),
1903
- device_id: z10.string().nullable(),
1904
- compose_hash: z10.string(),
1993
+ var ProvisionCvmComposeFileUpdateResultSchema = z11.object({
1994
+ app_id: z11.string().nullable(),
1995
+ device_id: z11.string().nullable(),
1996
+ compose_hash: z11.string(),
1905
1997
  kms_info: KmsInfoSchema.nullable().optional()
1906
1998
  }).passthrough();
1907
1999
  async function provisionCvmComposeFileUpdate(client, request, parameters) {
@@ -1936,21 +2028,21 @@ async function safeProvisionCvmComposeFileUpdate(client, request, parameters) {
1936
2028
  }
1937
2029
 
1938
2030
  // src/actions/commit_cvm_compose_file_update.ts
1939
- import { z as z11 } from "zod";
1940
- var CommitCvmComposeFileUpdateRequestSchema = z11.object({
1941
- id: z11.string().optional(),
1942
- 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(),
1943
- app_id: z11.string().refine(
2031
+ import { z as z12 } from "zod";
2032
+ var CommitCvmComposeFileUpdateRequestSchema = z12.object({
2033
+ id: z12.string().optional(),
2034
+ 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(),
2035
+ app_id: z12.string().refine(
1944
2036
  (val) => !val.startsWith("app_") && val.length === 40,
1945
2037
  "app_id should be 40 characters without prefix"
1946
2038
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1947
- instance_id: z11.string().refine(
2039
+ instance_id: z12.string().refine(
1948
2040
  (val) => !val.startsWith("instance_") && val.length === 40,
1949
2041
  "instance_id should be 40 characters without prefix"
1950
2042
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
1951
- compose_hash: z11.string().min(1, "Compose hash is required"),
1952
- encrypted_env: z11.string().optional(),
1953
- env_keys: z11.array(z11.string()).optional()
2043
+ compose_hash: z12.string().min(1, "Compose hash is required"),
2044
+ encrypted_env: z12.string().optional(),
2045
+ env_keys: z12.array(z12.string()).optional()
1954
2046
  }).refine(
1955
2047
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
1956
2048
  "One of id, uuid, app_id, or instance_id must be provided"
@@ -1961,7 +2053,7 @@ var CommitCvmComposeFileUpdateRequestSchema = z11.object({
1961
2053
  env_keys: data.env_keys,
1962
2054
  _raw: data
1963
2055
  }));
1964
- var CommitCvmComposeFileUpdateSchema = z11.any().transform(() => void 0);
2056
+ var CommitCvmComposeFileUpdateSchema = z12.any().transform(() => void 0);
1965
2057
  async function commitCvmComposeFileUpdate(client, request, parameters) {
1966
2058
  const validatedRequest = CommitCvmComposeFileUpdateRequestSchema.parse(request);
1967
2059
  const response = await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
@@ -1996,17 +2088,17 @@ async function safeCommitCvmComposeFileUpdate(client, request, parameters) {
1996
2088
  }
1997
2089
 
1998
2090
  // src/actions/get_app_env_encrypt_pubkey.ts
1999
- import { z as z12 } from "zod";
2000
- var GetAppEnvEncryptPubKeyRequestSchema = z12.object({
2001
- kms: z12.string().min(1, "KMS ID or slug is required"),
2002
- app_id: z12.string().refine(
2091
+ import { z as z13 } from "zod";
2092
+ var GetAppEnvEncryptPubKeyRequestSchema = z13.object({
2093
+ kms: z13.string().min(1, "KMS ID or slug is required"),
2094
+ app_id: z13.string().refine(
2003
2095
  (val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
2004
2096
  "App ID must be exactly 40 characters or 42 characters with 0x prefix"
2005
2097
  )
2006
2098
  }).strict();
2007
- var GetAppEnvEncryptPubKeySchema = z12.object({
2008
- public_key: z12.string(),
2009
- signature: z12.string()
2099
+ var GetAppEnvEncryptPubKeySchema = z13.object({
2100
+ public_key: z13.string(),
2101
+ signature: z13.string()
2010
2102
  }).strict();
2011
2103
  var getAppEnvEncryptPubKey = async (client, payload, parameters) => {
2012
2104
  const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
@@ -2044,101 +2136,6 @@ var safeGetAppEnvEncryptPubKey = async (client, payload, parameters) => {
2044
2136
 
2045
2137
  // src/actions/get_cvm_info.ts
2046
2138
  import { z as z14 } from "zod";
2047
-
2048
- // src/types/cvm_info.ts
2049
- import { z as z13 } from "zod";
2050
- var VmInfoSchema = z13.object({
2051
- id: z13.string(),
2052
- name: z13.string(),
2053
- status: z13.string(),
2054
- uptime: z13.string(),
2055
- app_url: z13.string().nullable(),
2056
- app_id: z13.string(),
2057
- instance_id: z13.string().nullable(),
2058
- configuration: z13.any().optional(),
2059
- // TODO: add VmConfiguration schema if needed
2060
- exited_at: z13.string().nullable(),
2061
- boot_progress: z13.string().nullable(),
2062
- boot_error: z13.string().nullable(),
2063
- shutdown_progress: z13.string().nullable(),
2064
- image_version: z13.string().nullable()
2065
- });
2066
- var ManagedUserSchema = z13.object({
2067
- id: z13.number(),
2068
- username: z13.string()
2069
- });
2070
- var CvmNodeSchema = z13.object({
2071
- id: z13.number(),
2072
- name: z13.string(),
2073
- region_identifier: z13.string().optional()
2074
- });
2075
- var CvmNetworkUrlsSchema = z13.object({
2076
- app: z13.string(),
2077
- instance: z13.string()
2078
- });
2079
- var KMSInfoSchema = z13.object({
2080
- id: z13.string(),
2081
- // HashedId is represented as string in JS
2082
- slug: z13.string(),
2083
- url: z13.string(),
2084
- version: z13.string(),
2085
- chain_id: z13.number().optional(),
2086
- kms_contract_address: z13.string().optional(),
2087
- gateway_app_id: z13.string().optional()
2088
- });
2089
- var CvmInfoSchema = z13.object({
2090
- hosted: VmInfoSchema,
2091
- name: z13.string(),
2092
- managed_user: ManagedUserSchema.optional().nullable(),
2093
- node: CvmNodeSchema.optional().nullable(),
2094
- listed: z13.boolean().default(false),
2095
- status: z13.string(),
2096
- in_progress: z13.boolean().default(false),
2097
- dapp_dashboard_url: z13.string().nullable(),
2098
- syslog_endpoint: z13.string().nullable(),
2099
- allow_upgrade: z13.boolean().default(false),
2100
- project_id: z13.string().nullable(),
2101
- // HashedId is represented as string in JS
2102
- project_type: z13.string().nullable(),
2103
- billing_period: z13.string().nullable(),
2104
- kms_info: KMSInfoSchema.nullable(),
2105
- vcpu: z13.number().nullable(),
2106
- memory: z13.number().nullable(),
2107
- disk_size: z13.number().nullable(),
2108
- gateway_domain: z13.string().nullable(),
2109
- public_urls: z13.array(CvmNetworkUrlsSchema)
2110
- }).partial();
2111
- var CvmLegacyDetailSchema = z13.object({
2112
- id: z13.number(),
2113
- name: z13.string(),
2114
- status: z13.string(),
2115
- in_progress: z13.boolean(),
2116
- teepod_id: z13.number().nullable(),
2117
- teepod: CvmNodeSchema,
2118
- app_id: z13.string(),
2119
- vm_uuid: z13.string().nullable(),
2120
- instance_id: z13.string().nullable(),
2121
- vcpu: z13.number().nullable(),
2122
- memory: z13.number().nullable(),
2123
- disk_size: z13.number().nullable(),
2124
- base_image: z13.string(),
2125
- encrypted_env_pubkey: z13.string().nullable(),
2126
- listed: z13.boolean(),
2127
- project_id: z13.string().nullable(),
2128
- project_type: z13.string().nullable(),
2129
- public_sysinfo: z13.boolean(),
2130
- public_logs: z13.boolean(),
2131
- dapp_dashboard_url: z13.string().nullable(),
2132
- syslog_endpoint: z13.string().nullable(),
2133
- kms_info: KMSInfoSchema.nullable(),
2134
- contract_address: z13.string().nullable(),
2135
- deployer_address: z13.string().nullable(),
2136
- scheduled_delete_at: z13.string().nullable(),
2137
- public_urls: z13.array(CvmNetworkUrlsSchema),
2138
- gateway_domain: z13.string().nullable()
2139
- });
2140
-
2141
- // src/actions/get_cvm_info.ts
2142
2139
  var GetCvmInfoRequestSchema = z14.object({
2143
2140
  id: z14.string().optional(),
2144
2141
  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(),
@@ -2369,20 +2366,28 @@ export {
2369
2366
  CommitCvmProvisionRequestSchema,
2370
2367
  CommitCvmProvisionSchema,
2371
2368
  CurrentUserSchema,
2369
+ CvmInfoSchema,
2372
2370
  CvmLegacyDetailSchema,
2371
+ CvmNetworkUrlsSchema,
2372
+ CvmNodeSchema,
2373
2373
  DeployAppAuthRequestSchema,
2374
2374
  DeployAppAuthSchema,
2375
2375
  GetAppEnvEncryptPubKeySchema,
2376
2376
  GetCvmComposeFileResultSchema,
2377
2377
  GetCvmListSchema,
2378
2378
  GetKmsListSchema,
2379
+ KMSInfoSchema,
2380
+ KmsInfoSchema,
2381
+ ManagedUserSchema,
2379
2382
  NetworkError,
2380
2383
  ProvisionCvmComposeFileUpdateRequestSchema,
2381
2384
  ProvisionCvmComposeFileUpdateResultSchema,
2382
2385
  ProvisionCvmRequestSchema,
2383
2386
  ProvisionCvmSchema,
2384
2387
  RequestError,
2388
+ SUPPORTED_CHAINS,
2385
2389
  TransactionError,
2390
+ VmInfoSchema,
2386
2391
  WalletError,
2387
2392
  addComposeHash,
2388
2393
  addNetwork,