@phala/cloud 0.0.5 → 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,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,44 @@ 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
1027
1118
  }).passthrough();
1028
- var ProvisionCvmRequestSchema = z5.object({
1029
- node_id: z5.number().optional(),
1119
+ var ProvisionCvmRequestSchema = z6.object({
1120
+ node_id: z6.number().optional(),
1030
1121
  // recommended
1031
- teepod_id: z5.number().optional(),
1122
+ teepod_id: z6.number().optional(),
1032
1123
  // 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(),
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(),
1047
1138
  // recommended
1048
- tproxy_enabled: z5.boolean().optional()
1139
+ tproxy_enabled: z6.boolean().optional()
1049
1140
  // deprecated, for compatibility
1050
1141
  }),
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()
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()
1055
1146
  }).passthrough();
1056
1147
  function autofillComposeFileName(appCompose) {
1057
1148
  if (appCompose.compose_file && !appCompose.compose_file.name) {
@@ -1143,43 +1234,43 @@ async function safeProvisionCvm(client, appCompose, parameters) {
1143
1234
  }
1144
1235
 
1145
1236
  // 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()
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()
1155
1246
  }).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()
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()
1174
1265
  }).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()
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()
1183
1274
  }).passthrough();
1184
1275
  async function commitCvmProvision(client, payload, parameters) {
1185
1276
  validateActionParameters(parameters);
@@ -1208,7 +1299,7 @@ async function safeCommitCvmProvision(client, payload, parameters) {
1208
1299
  }
1209
1300
 
1210
1301
  // src/actions/deploy_app_auth.ts
1211
- import { z as z7 } from "zod";
1302
+ import { z as z8 } from "zod";
1212
1303
  import {
1213
1304
  createPublicClient as createPublicClient2,
1214
1305
  createWalletClient as createWalletClient2,
@@ -1247,25 +1338,25 @@ var kmsAuthAbi = [
1247
1338
  anonymous: false
1248
1339
  }
1249
1340
  ];
1250
- var DeployAppAuthRequestBaseSchema = z7.object({
1341
+ var DeployAppAuthRequestBaseSchema = z8.object({
1251
1342
  // Chain configuration (conditionally required)
1252
- chain: z7.unknown().optional(),
1253
- rpcUrl: z7.string().optional(),
1343
+ chain: z8.unknown().optional(),
1344
+ rpcUrl: z8.string().optional(),
1254
1345
  // Contract configuration (required)
1255
- kmsContractAddress: z7.string(),
1346
+ kmsContractAddress: z8.string(),
1256
1347
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1257
- privateKey: z7.string().optional(),
1258
- walletClient: z7.unknown().optional(),
1348
+ privateKey: z8.string().optional(),
1349
+ walletClient: z8.unknown().optional(),
1259
1350
  // Public client (optional, will create default if not provided)
1260
- publicClient: z7.unknown().optional(),
1351
+ publicClient: z8.unknown().optional(),
1261
1352
  // 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),
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),
1266
1357
  // Validation configuration (optional)
1267
- skipPrerequisiteChecks: z7.boolean().optional().default(false),
1268
- minBalance: z7.string().optional()
1358
+ skipPrerequisiteChecks: z8.boolean().optional().default(false),
1359
+ minBalance: z8.string().optional()
1269
1360
  // ETH amount as string, e.g., "0.01"
1270
1361
  }).passthrough();
1271
1362
  var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
@@ -1293,13 +1384,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
1293
1384
  path: ["chain"]
1294
1385
  }
1295
1386
  );
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()
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()
1303
1394
  }).passthrough();
1304
1395
  function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
1305
1396
  try {
@@ -1545,7 +1636,7 @@ async function safeDeployAppAuth(request, parameters) {
1545
1636
  }
1546
1637
 
1547
1638
  // src/actions/add_compose_hash.ts
1548
- import { z as z8 } from "zod";
1639
+ import { z as z9 } from "zod";
1549
1640
  import {
1550
1641
  createPublicClient as createPublicClient3,
1551
1642
  createWalletClient as createWalletClient3,
@@ -1569,29 +1660,29 @@ var appAuthAbi = [
1569
1660
  anonymous: false
1570
1661
  }
1571
1662
  ];
1572
- var AddComposeHashRequestSchema = z8.object({
1663
+ var AddComposeHashRequestSchema = z9.object({
1573
1664
  // Chain configuration (conditionally required)
1574
- chain: z8.unknown().optional(),
1575
- rpcUrl: z8.string().optional(),
1576
- appId: z8.string(),
1577
- composeHash: z8.string(),
1665
+ chain: z9.unknown().optional(),
1666
+ rpcUrl: z9.string().optional(),
1667
+ appId: z9.string(),
1668
+ composeHash: z9.string(),
1578
1669
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1579
- privateKey: z8.string().optional(),
1580
- walletClient: z8.unknown().optional(),
1670
+ privateKey: z9.string().optional(),
1671
+ walletClient: z9.unknown().optional(),
1581
1672
  // Public client (optional, will create default if not provided)
1582
- publicClient: z8.unknown().optional(),
1673
+ publicClient: z9.unknown().optional(),
1583
1674
  // Validation configuration (optional)
1584
- skipPrerequisiteChecks: z8.boolean().optional().default(false),
1585
- minBalance: z8.string().optional(),
1675
+ skipPrerequisiteChecks: z9.boolean().optional().default(false),
1676
+ minBalance: z9.string().optional(),
1586
1677
  // ETH amount as string, e.g., "0.01"
1587
1678
  // Transaction control options
1588
- timeout: z8.number().optional().default(12e4),
1589
- retryOptions: z8.unknown().optional(),
1590
- signal: z8.unknown().optional(),
1679
+ timeout: z9.number().optional().default(12e4),
1680
+ retryOptions: z9.unknown().optional(),
1681
+ signal: z9.unknown().optional(),
1591
1682
  // Progress callbacks
1592
- onTransactionStateChange: z8.function().optional(),
1593
- onTransactionSubmitted: z8.function().optional(),
1594
- onTransactionConfirmed: z8.function().optional()
1683
+ onTransactionStateChange: z9.function().optional(),
1684
+ onTransactionSubmitted: z9.function().optional(),
1685
+ onTransactionConfirmed: z9.function().optional()
1595
1686
  }).passthrough().refine(
1596
1687
  (data) => {
1597
1688
  const hasPrivateKey = !!data.privateKey;
@@ -1615,12 +1706,12 @@ var AddComposeHashRequestSchema = z8.object({
1615
1706
  path: ["chain"]
1616
1707
  }
1617
1708
  );
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()
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()
1624
1715
  }).passthrough();
1625
1716
  function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
1626
1717
  console.log(receipt.logs);
@@ -1812,27 +1903,27 @@ async function safeAddComposeHash(request, parameters) {
1812
1903
  }
1813
1904
 
1814
1905
  // 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()
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()
1827
1918
  }).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(
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(
1832
1923
  (val) => !val.startsWith("app_") && val.length === 40,
1833
1924
  "app_id should be 40 characters without prefix"
1834
1925
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1835
- instance_id: z9.string().refine(
1926
+ instance_id: z10.string().refine(
1836
1927
  (val) => !val.startsWith("instance_") && val.length === 40,
1837
1928
  "instance_id should be 40 characters without prefix"
1838
1929
  ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional()
@@ -1869,26 +1960,26 @@ async function safeGetCvmComposeFile(client, request, parameters) {
1869
1960
  }
1870
1961
 
1871
1962
  // 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(
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(
1877
1968
  (val) => !val.startsWith("app_") && val.length === 40,
1878
1969
  "app_id should be 40 characters without prefix"
1879
1970
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1880
- instance_id: z10.string().refine(
1971
+ instance_id: z11.string().refine(
1881
1972
  (val) => !val.startsWith("instance_") && val.length === 40,
1882
1973
  "instance_id should be 40 characters without prefix"
1883
1974
  ).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()
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()
1892
1983
  })
1893
1984
  }).refine(
1894
1985
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
@@ -1898,10 +1989,10 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z10.object({
1898
1989
  request: data.app_compose,
1899
1990
  _raw: data
1900
1991
  }));
1901
- var ProvisionCvmComposeFileUpdateResultSchema = z10.object({
1902
- app_id: z10.string().nullable(),
1903
- device_id: z10.string().nullable(),
1904
- 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(),
1905
1996
  kms_info: KmsInfoSchema.nullable().optional()
1906
1997
  }).passthrough();
1907
1998
  async function provisionCvmComposeFileUpdate(client, request, parameters) {
@@ -1936,21 +2027,21 @@ async function safeProvisionCvmComposeFileUpdate(client, request, parameters) {
1936
2027
  }
1937
2028
 
1938
2029
  // 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(
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(
1944
2035
  (val) => !val.startsWith("app_") && val.length === 40,
1945
2036
  "app_id should be 40 characters without prefix"
1946
2037
  ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1947
- instance_id: z11.string().refine(
2038
+ instance_id: z12.string().refine(
1948
2039
  (val) => !val.startsWith("instance_") && val.length === 40,
1949
2040
  "instance_id should be 40 characters without prefix"
1950
2041
  ).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()
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()
1954
2045
  }).refine(
1955
2046
  (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
1956
2047
  "One of id, uuid, app_id, or instance_id must be provided"
@@ -1961,7 +2052,7 @@ var CommitCvmComposeFileUpdateRequestSchema = z11.object({
1961
2052
  env_keys: data.env_keys,
1962
2053
  _raw: data
1963
2054
  }));
1964
- var CommitCvmComposeFileUpdateSchema = z11.any().transform(() => void 0);
2055
+ var CommitCvmComposeFileUpdateSchema = z12.any().transform(() => void 0);
1965
2056
  async function commitCvmComposeFileUpdate(client, request, parameters) {
1966
2057
  const validatedRequest = CommitCvmComposeFileUpdateRequestSchema.parse(request);
1967
2058
  const response = await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
@@ -1996,17 +2087,17 @@ async function safeCommitCvmComposeFileUpdate(client, request, parameters) {
1996
2087
  }
1997
2088
 
1998
2089
  // 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(
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(
2003
2094
  (val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
2004
2095
  "App ID must be exactly 40 characters or 42 characters with 0x prefix"
2005
2096
  )
2006
2097
  }).strict();
2007
- var GetAppEnvEncryptPubKeySchema = z12.object({
2008
- public_key: z12.string(),
2009
- signature: z12.string()
2098
+ var GetAppEnvEncryptPubKeySchema = z13.object({
2099
+ public_key: z13.string(),
2100
+ signature: z13.string()
2010
2101
  }).strict();
2011
2102
  var getAppEnvEncryptPubKey = async (client, payload, parameters) => {
2012
2103
  const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
@@ -2044,101 +2135,6 @@ var safeGetAppEnvEncryptPubKey = async (client, payload, parameters) => {
2044
2135
 
2045
2136
  // src/actions/get_cvm_info.ts
2046
2137
  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
2138
  var GetCvmInfoRequestSchema = z14.object({
2143
2139
  id: z14.string().optional(),
2144
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(),
@@ -2369,20 +2365,28 @@ export {
2369
2365
  CommitCvmProvisionRequestSchema,
2370
2366
  CommitCvmProvisionSchema,
2371
2367
  CurrentUserSchema,
2368
+ CvmInfoSchema,
2372
2369
  CvmLegacyDetailSchema,
2370
+ CvmNetworkUrlsSchema,
2371
+ CvmNodeSchema,
2373
2372
  DeployAppAuthRequestSchema,
2374
2373
  DeployAppAuthSchema,
2375
2374
  GetAppEnvEncryptPubKeySchema,
2376
2375
  GetCvmComposeFileResultSchema,
2377
2376
  GetCvmListSchema,
2378
2377
  GetKmsListSchema,
2378
+ KMSInfoSchema,
2379
+ KmsInfoSchema,
2380
+ ManagedUserSchema,
2379
2381
  NetworkError,
2380
2382
  ProvisionCvmComposeFileUpdateRequestSchema,
2381
2383
  ProvisionCvmComposeFileUpdateResultSchema,
2382
2384
  ProvisionCvmRequestSchema,
2383
2385
  ProvisionCvmSchema,
2384
2386
  RequestError,
2387
+ SUPPORTED_CHAINS,
2385
2388
  TransactionError,
2389
+ VmInfoSchema,
2386
2390
  WalletError,
2387
2391
  addComposeHash,
2388
2392
  addNetwork,