@phala/cloud 0.0.12 → 0.1.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/{add_compose_hash.d.ts → blockchains/add_compose_hash.d.ts} +6 -7
- package/dist/actions/{deploy_app_auth.d.ts → blockchains/deploy_app_auth.d.ts} +6 -7
- package/dist/actions/{commit_cvm_compose_file_update.d.ts → cvms/commit_cvm_compose_file_update.d.ts} +25 -13
- package/dist/actions/{commit_cvm_provision.d.ts → cvms/commit_cvm_provision.d.ts} +139 -13
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +225 -0
- package/dist/actions/{get_cvm_info.d.ts → cvms/get_cvm_info.d.ts} +21 -12
- package/dist/actions/{get_cvm_list.d.ts → cvms/get_cvm_list.d.ts} +187 -39
- package/dist/actions/{provision_cvm.d.ts → cvms/provision_cvm.d.ts} +75 -20
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +768 -0
- package/dist/actions/get_available_nodes.d.ts +319 -7
- package/dist/actions/get_current_user.d.ts +35 -7
- package/dist/actions/index.d.ts +17 -18
- package/dist/actions/kms/get_app_env_encrypt_pubkey.d.ts +66 -0
- package/dist/actions/kms/get_kms_info.d.ts +55 -0
- package/dist/actions/{get_kms_list.d.ts → kms/get_kms_list.d.ts} +44 -8
- package/dist/actions/list-instance-types.d.ts +69 -10
- package/dist/actions/workspaces/get_workspace.d.ts +33 -8
- package/dist/actions/workspaces/list_workspaces.d.ts +92 -7
- package/dist/chunk-O5QBIXBA.mjs +1128 -0
- package/dist/client.d.ts +16 -1
- package/dist/create-client.d.ts +311 -0
- package/dist/create-client.js +1143 -0
- package/dist/create-client.mjs +74 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +504 -722
- package/dist/index.mjs +135 -1351
- package/dist/parse_dotenv.d.ts +0 -1
- package/dist/types/app_compose.d.ts +0 -1
- package/dist/types/client.d.ts +0 -1
- package/dist/types/common.d.ts +17 -4
- package/dist/types/cvm_info.d.ts +34 -35
- package/dist/types/index.d.ts +0 -1
- package/dist/types/kms_info.d.ts +0 -1
- package/dist/types/supported_chains.d.ts +0 -1
- package/dist/utils/as-hex.d.ts +0 -1
- package/dist/utils/client-factories.d.ts +0 -1
- package/dist/utils/define-action.d.ts +61 -0
- package/dist/utils/get_compose_hash.d.ts +0 -1
- package/dist/utils/get_error_message.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/network.d.ts +0 -1
- package/dist/utils/transaction.d.ts +0 -1
- package/dist/utils/validate-parameters.d.ts +5 -5
- package/package.json +70 -66
- package/dist/actions/add_compose_hash.d.ts.map +0 -1
- package/dist/actions/commit_cvm_compose_file_update.d.ts.map +0 -1
- package/dist/actions/commit_cvm_provision.d.ts.map +0 -1
- package/dist/actions/deploy_app_auth.d.ts.map +0 -1
- package/dist/actions/get_app_env_encrypt_pubkey.d.ts +0 -30
- package/dist/actions/get_app_env_encrypt_pubkey.d.ts.map +0 -1
- package/dist/actions/get_available_nodes.d.ts.map +0 -1
- package/dist/actions/get_current_user.d.ts.map +0 -1
- package/dist/actions/get_cvm_compose_file.d.ts +0 -122
- package/dist/actions/get_cvm_compose_file.d.ts.map +0 -1
- package/dist/actions/get_cvm_info.d.ts.map +0 -1
- package/dist/actions/get_cvm_list.d.ts.map +0 -1
- package/dist/actions/get_kms_info.d.ts +0 -34
- package/dist/actions/get_kms_info.d.ts.map +0 -1
- package/dist/actions/get_kms_list.d.ts.map +0 -1
- package/dist/actions/index.d.ts.map +0 -1
- package/dist/actions/list-instance-types.d.ts.map +0 -1
- package/dist/actions/provision_cvm.d.ts.map +0 -1
- package/dist/actions/provision_cvm_compose_file_update.d.ts +0 -413
- package/dist/actions/provision_cvm_compose_file_update.d.ts.map +0 -1
- package/dist/actions/workspaces/get_workspace.d.ts.map +0 -1
- package/dist/actions/workspaces/list_workspaces.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/parse_dotenv.d.ts.map +0 -1
- package/dist/types/app_compose.d.ts.map +0 -1
- package/dist/types/client.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/cvm_info.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/kms_info.d.ts.map +0 -1
- package/dist/types/supported_chains.d.ts.map +0 -1
- package/dist/utils/as-hex.d.ts.map +0 -1
- package/dist/utils/client-factories.d.ts.map +0 -1
- package/dist/utils/get_compose_hash.d.ts.map +0 -1
- package/dist/utils/get_error_message.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/transaction.d.ts.map +0 -1
- package/dist/utils/validate-parameters.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,420 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ApiErrorSchema,
|
|
3
|
+
AvailableNodesSchema,
|
|
4
|
+
CommitCvmComposeFileUpdateRequestSchema,
|
|
5
|
+
CommitCvmComposeFileUpdateSchema,
|
|
6
|
+
CommitCvmProvisionRequestSchema,
|
|
7
|
+
CommitCvmProvisionSchema,
|
|
8
|
+
CurrentUserSchema,
|
|
9
|
+
CvmInfoSchema,
|
|
10
|
+
CvmLegacyDetailSchema,
|
|
11
|
+
CvmNetworkUrlsSchema,
|
|
12
|
+
CvmNodeSchema,
|
|
13
|
+
GetAppEnvEncryptPubKeyRequestSchema,
|
|
14
|
+
GetAppEnvEncryptPubKeySchema,
|
|
15
|
+
GetCvmComposeFileRequestSchema,
|
|
16
|
+
GetCvmInfoRequestSchema,
|
|
17
|
+
GetCvmListRequestSchema,
|
|
18
|
+
GetCvmListSchema,
|
|
19
|
+
GetKmsInfoRequestSchema,
|
|
20
|
+
GetKmsListRequestSchema,
|
|
21
|
+
GetKmsListSchema,
|
|
22
|
+
InstanceTypeSchema,
|
|
23
|
+
KmsInfoSchema,
|
|
24
|
+
ListInstanceTypesRequestSchema,
|
|
25
|
+
ListWorkspacesSchema,
|
|
26
|
+
ManagedUserSchema,
|
|
27
|
+
PaginatedInstanceTypesSchema,
|
|
28
|
+
PaginationMetadataSchema,
|
|
29
|
+
ProvisionCvmComposeFileUpdateRequestSchema,
|
|
30
|
+
ProvisionCvmComposeFileUpdateResultSchema,
|
|
31
|
+
ProvisionCvmRequestSchema,
|
|
32
|
+
ProvisionCvmSchema,
|
|
33
|
+
RequestError,
|
|
34
|
+
SUPPORTED_CHAINS,
|
|
35
|
+
VmInfoSchema,
|
|
36
|
+
WorkspaceResponseSchema,
|
|
37
|
+
commitCvmComposeFileUpdate,
|
|
38
|
+
commitCvmProvision,
|
|
39
|
+
createClient,
|
|
40
|
+
defineAction,
|
|
41
|
+
defineSimpleAction,
|
|
42
|
+
getAppEnvEncryptPubKey,
|
|
43
|
+
getAvailableNodes,
|
|
44
|
+
getCurrentUser,
|
|
45
|
+
getCvmComposeFile,
|
|
46
|
+
getCvmInfo,
|
|
47
|
+
getCvmList,
|
|
48
|
+
getKmsInfo,
|
|
49
|
+
getKmsList,
|
|
50
|
+
getWorkspace,
|
|
51
|
+
listInstanceTypes,
|
|
52
|
+
listWorkspaces,
|
|
53
|
+
provisionCvm,
|
|
54
|
+
provisionCvmComposeFileUpdate,
|
|
55
|
+
safeCommitCvmComposeFileUpdate,
|
|
56
|
+
safeCommitCvmProvision,
|
|
57
|
+
safeGetAppEnvEncryptPubKey,
|
|
58
|
+
safeGetAvailableNodes,
|
|
59
|
+
safeGetCurrentUser,
|
|
60
|
+
safeGetCvmComposeFile,
|
|
61
|
+
safeGetCvmInfo,
|
|
62
|
+
safeGetCvmList,
|
|
63
|
+
safeGetKmsInfo,
|
|
64
|
+
safeGetKmsList,
|
|
65
|
+
safeGetWorkspace,
|
|
66
|
+
safeListInstanceTypes,
|
|
67
|
+
safeListWorkspaces,
|
|
68
|
+
safeProvisionCvm,
|
|
69
|
+
safeProvisionCvmComposeFileUpdate,
|
|
70
|
+
safeValidateActionParameters,
|
|
71
|
+
validateActionParameters
|
|
72
|
+
} from "./chunk-O5QBIXBA.mjs";
|
|
4
73
|
|
|
5
|
-
// src/
|
|
74
|
+
// src/actions/blockchains/deploy_app_auth.ts
|
|
6
75
|
import { z } from "zod";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
),
|
|
17
|
-
z.record(z.unknown())
|
|
18
|
-
]),
|
|
19
|
-
type: z.string().optional(),
|
|
20
|
-
code: z.string().optional()
|
|
21
|
-
});
|
|
22
|
-
var RequestError = class _RequestError extends Error {
|
|
23
|
-
constructor(message, options) {
|
|
24
|
-
super(message);
|
|
25
|
-
this.name = "RequestError";
|
|
26
|
-
this.isRequestError = true;
|
|
27
|
-
this.status = options?.status;
|
|
28
|
-
this.statusText = options?.statusText;
|
|
29
|
-
this.data = options?.data;
|
|
30
|
-
this.request = options?.request;
|
|
31
|
-
this.response = options?.response;
|
|
32
|
-
this.detail = options?.detail || message;
|
|
33
|
-
this.code = options?.code;
|
|
34
|
-
this.type = options?.type;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create RequestError from FetchError
|
|
38
|
-
*/
|
|
39
|
-
static fromFetchError(error) {
|
|
40
|
-
const parseResult = ApiErrorSchema.safeParse(error.data);
|
|
41
|
-
if (parseResult.success) {
|
|
42
|
-
return new _RequestError(error.message, {
|
|
43
|
-
status: error.status ?? void 0,
|
|
44
|
-
statusText: error.statusText ?? void 0,
|
|
45
|
-
data: error.data,
|
|
46
|
-
request: error.request ?? void 0,
|
|
47
|
-
response: error.response ?? void 0,
|
|
48
|
-
detail: parseResult.data.detail,
|
|
49
|
-
code: parseResult.data.code ?? void 0,
|
|
50
|
-
type: parseResult.data.type ?? void 0
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return new _RequestError(error.message, {
|
|
54
|
-
status: error.status ?? void 0,
|
|
55
|
-
statusText: error.statusText ?? void 0,
|
|
56
|
-
data: error.data,
|
|
57
|
-
request: error.request ?? void 0,
|
|
58
|
-
response: error.response ?? void 0,
|
|
59
|
-
detail: error.data?.detail || "Unknown API error",
|
|
60
|
-
code: error.status?.toString() ?? void 0
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Create RequestError from generic Error
|
|
65
|
-
*/
|
|
66
|
-
static fromError(error, request) {
|
|
67
|
-
return new _RequestError(error.message, {
|
|
68
|
-
request: request ?? void 0,
|
|
69
|
-
detail: error.message
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// src/client.ts
|
|
75
|
-
var SUPPORTED_API_VERSIONS = ["2025-05-31"];
|
|
76
|
-
var logger = debug("phala::api-client");
|
|
77
|
-
function formatHeaders(headers) {
|
|
78
|
-
return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
|
|
79
|
-
}
|
|
80
|
-
function formatBody(body) {
|
|
81
|
-
if (!body) return "";
|
|
82
|
-
const bodyStr = typeof body === "string" ? body : JSON.stringify(body, null, 2);
|
|
83
|
-
return ` -d '${bodyStr.replace(/'/g, "\\'")}'`;
|
|
84
|
-
}
|
|
85
|
-
function formatResponse(status, statusText, headers, body) {
|
|
86
|
-
const headerEntries = [];
|
|
87
|
-
headers.forEach((value, key) => {
|
|
88
|
-
headerEntries.push(`${key}: ${value}`);
|
|
89
|
-
});
|
|
90
|
-
const headerStr = headerEntries.join("\n");
|
|
91
|
-
const bodyStr = typeof body === "string" ? body : JSON.stringify(body, null, 2);
|
|
92
|
-
return [
|
|
93
|
-
`< HTTP/1.1 ${status} ${statusText}`,
|
|
94
|
-
headerStr ? `< ${headerStr.replace(/\n/g, "\n< ")}` : "",
|
|
95
|
-
"",
|
|
96
|
-
bodyStr
|
|
97
|
-
].filter(Boolean).join("\n");
|
|
98
|
-
}
|
|
99
|
-
var Client = class {
|
|
100
|
-
constructor(config = {}) {
|
|
101
|
-
const resolvedConfig = {
|
|
102
|
-
...config,
|
|
103
|
-
apiKey: config.apiKey || process?.env?.PHALA_CLOUD_API_KEY,
|
|
104
|
-
baseURL: config.baseURL || process?.env?.PHALA_CLOUD_API_PREFIX || "https://cloud-api.phala.network/api/v1"
|
|
105
|
-
};
|
|
106
|
-
const version = resolvedConfig.version && SUPPORTED_API_VERSIONS.includes(resolvedConfig.version) ? resolvedConfig.version : SUPPORTED_API_VERSIONS[0];
|
|
107
|
-
this.config = resolvedConfig;
|
|
108
|
-
if (!resolvedConfig.useCookieAuth && !resolvedConfig.apiKey) {
|
|
109
|
-
throw new Error(
|
|
110
|
-
"API key is required. Provide it via config.apiKey or set PHALA_CLOUD_API_KEY environment variable."
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
const { apiKey, baseURL, timeout, headers, useCookieAuth, onResponseError, ...fetchOptions } = resolvedConfig;
|
|
114
|
-
const requestHeaders = {
|
|
115
|
-
"X-Phala-Version": version,
|
|
116
|
-
"Content-Type": "application/json"
|
|
117
|
-
};
|
|
118
|
-
if (headers && typeof headers === "object") {
|
|
119
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
120
|
-
if (typeof value === "string") {
|
|
121
|
-
requestHeaders[key] = value;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
if (!useCookieAuth && apiKey) {
|
|
126
|
-
requestHeaders["X-API-Key"] = apiKey;
|
|
127
|
-
}
|
|
128
|
-
this.fetchInstance = ofetch.create({
|
|
129
|
-
baseURL,
|
|
130
|
-
timeout: timeout || 3e4,
|
|
131
|
-
headers: requestHeaders,
|
|
132
|
-
...useCookieAuth ? { credentials: "include" } : {},
|
|
133
|
-
...fetchOptions,
|
|
134
|
-
// Log request in cURL format
|
|
135
|
-
onRequest({ request, options }) {
|
|
136
|
-
if (logger.enabled) {
|
|
137
|
-
const method = options.method || "GET";
|
|
138
|
-
const url = typeof request === "string" ? request : request.url;
|
|
139
|
-
const fullUrl = url.startsWith("http") ? url : `${baseURL}${url}`;
|
|
140
|
-
const headerObj = {};
|
|
141
|
-
if (options.headers && typeof options.headers === "object") {
|
|
142
|
-
Object.entries(options.headers).forEach(([key, value]) => {
|
|
143
|
-
if (typeof value === "string") {
|
|
144
|
-
headerObj[key] = value;
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
const curlCommand = [
|
|
149
|
-
`> curl -X ${method} "${fullUrl}"`,
|
|
150
|
-
formatHeaders(headerObj),
|
|
151
|
-
options.body ? formatBody(options.body) : ""
|
|
152
|
-
].filter(Boolean).join("\n");
|
|
153
|
-
logger("\n=== REQUEST ===\n%s\n", curlCommand);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
// Log response in cURL format
|
|
157
|
-
onResponse({ request, response, options }) {
|
|
158
|
-
if (logger.enabled) {
|
|
159
|
-
const method = options.method || "GET";
|
|
160
|
-
const url = typeof request === "string" ? request : request.url;
|
|
161
|
-
logger(
|
|
162
|
-
"\n=== RESPONSE [%s %s] (%dms) ===\n%s\n",
|
|
163
|
-
method,
|
|
164
|
-
url,
|
|
165
|
-
response.headers.get("x-response-time") || "?",
|
|
166
|
-
formatResponse(response.status, response.statusText, response.headers, response._data)
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
// Generic handlers for response error (similar to request.ts)
|
|
171
|
-
onResponseError: ({ request, response, options }) => {
|
|
172
|
-
console.warn(`HTTP ${response.status}: ${response.url}`);
|
|
173
|
-
if (logger.enabled) {
|
|
174
|
-
const method = options.method || "GET";
|
|
175
|
-
const url = typeof request === "string" ? request : request.url;
|
|
176
|
-
logger(
|
|
177
|
-
"\n=== ERROR RESPONSE [%s %s] ===\n%s\n",
|
|
178
|
-
method,
|
|
179
|
-
url,
|
|
180
|
-
formatResponse(response.status, response.statusText, response.headers, response._data)
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
if (onResponseError) {
|
|
184
|
-
onResponseError({ request, response, options });
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get the underlying ofetch instance for advanced usage
|
|
191
|
-
*/
|
|
192
|
-
get raw() {
|
|
193
|
-
return this.fetchInstance;
|
|
194
|
-
}
|
|
195
|
-
// ===== Direct methods (throw on error) =====
|
|
196
|
-
/**
|
|
197
|
-
* Perform GET request (throws on error)
|
|
198
|
-
*/
|
|
199
|
-
async get(request, options) {
|
|
200
|
-
return this.fetchInstance(request, {
|
|
201
|
-
...options,
|
|
202
|
-
method: "GET"
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Perform POST request (throws on error)
|
|
207
|
-
*/
|
|
208
|
-
async post(request, body, options) {
|
|
209
|
-
return this.fetchInstance(request, {
|
|
210
|
-
...options,
|
|
211
|
-
method: "POST",
|
|
212
|
-
body
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Perform PUT request (throws on error)
|
|
217
|
-
*/
|
|
218
|
-
async put(request, body, options) {
|
|
219
|
-
return this.fetchInstance(request, {
|
|
220
|
-
...options,
|
|
221
|
-
method: "PUT",
|
|
222
|
-
body
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Perform PATCH request (throws on error)
|
|
227
|
-
*/
|
|
228
|
-
async patch(request, body, options) {
|
|
229
|
-
return this.fetchInstance(request, {
|
|
230
|
-
...options,
|
|
231
|
-
method: "PATCH",
|
|
232
|
-
body
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Perform DELETE request (throws on error)
|
|
237
|
-
*/
|
|
238
|
-
async delete(request, options) {
|
|
239
|
-
return this.fetchInstance(request, {
|
|
240
|
-
...options,
|
|
241
|
-
method: "DELETE"
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
// ===== Safe methods (return SafeResult) =====
|
|
245
|
-
/**
|
|
246
|
-
* Safe wrapper for any request method (zod-style result)
|
|
247
|
-
*/
|
|
248
|
-
async safeRequest(fn) {
|
|
249
|
-
try {
|
|
250
|
-
const data = await fn();
|
|
251
|
-
return { success: true, data };
|
|
252
|
-
} catch (error) {
|
|
253
|
-
if (error && typeof error === "object" && "data" in error) {
|
|
254
|
-
const requestError2 = RequestError.fromFetchError(error);
|
|
255
|
-
return { success: false, error: requestError2 };
|
|
256
|
-
}
|
|
257
|
-
if (error instanceof Error) {
|
|
258
|
-
const requestError2 = RequestError.fromError(error);
|
|
259
|
-
return { success: false, error: requestError2 };
|
|
260
|
-
}
|
|
261
|
-
const requestError = new RequestError("Unknown error occurred", {
|
|
262
|
-
detail: "Unknown error occurred"
|
|
263
|
-
});
|
|
264
|
-
return { success: false, error: requestError };
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Safe GET request (returns SafeResult)
|
|
269
|
-
*/
|
|
270
|
-
async safeGet(request, options) {
|
|
271
|
-
return this.safeRequest(() => this.get(request, options));
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Safe POST request (returns SafeResult)
|
|
275
|
-
*/
|
|
276
|
-
async safePost(request, body, options) {
|
|
277
|
-
return this.safeRequest(() => this.post(request, body, options));
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Safe PUT request (returns SafeResult)
|
|
281
|
-
*/
|
|
282
|
-
async safePut(request, body, options) {
|
|
283
|
-
return this.safeRequest(() => this.put(request, body, options));
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Safe PATCH request (returns SafeResult)
|
|
287
|
-
*/
|
|
288
|
-
async safePatch(request, body, options) {
|
|
289
|
-
return this.safeRequest(() => this.patch(request, body, options));
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Safe DELETE request (returns SafeResult)
|
|
293
|
-
*/
|
|
294
|
-
async safeDelete(request, options) {
|
|
295
|
-
return this.safeRequest(() => this.delete(request, options));
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
function createClient(config = {}) {
|
|
299
|
-
return new Client(config);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// src/types/kms_info.ts
|
|
303
|
-
import { z as z2 } from "zod";
|
|
304
|
-
|
|
305
|
-
// src/types/supported_chains.ts
|
|
306
|
-
import { anvil, base, mainnet } from "viem/chains";
|
|
307
|
-
var SUPPORTED_CHAINS = {
|
|
308
|
-
[mainnet.id]: mainnet,
|
|
309
|
-
[base.id]: base,
|
|
310
|
-
[anvil.id]: anvil
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// src/types/kms_info.ts
|
|
314
|
-
var KmsInfoBaseSchema = z2.object({
|
|
315
|
-
id: z2.string(),
|
|
316
|
-
slug: z2.string().nullable(),
|
|
317
|
-
url: z2.string(),
|
|
318
|
-
version: z2.string(),
|
|
319
|
-
chain_id: z2.number().nullable(),
|
|
320
|
-
kms_contract_address: z2.string().nullable().transform((val) => val),
|
|
321
|
-
gateway_app_id: z2.string().nullable().transform((val) => val)
|
|
322
|
-
}).passthrough();
|
|
323
|
-
var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
|
|
324
|
-
if (data.chain_id != null) {
|
|
325
|
-
const chain = SUPPORTED_CHAINS[data.chain_id];
|
|
326
|
-
if (chain) {
|
|
327
|
-
return { ...data, chain };
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
return data;
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
// src/types/cvm_info.ts
|
|
334
|
-
import { z as z3 } from "zod";
|
|
335
|
-
var VmInfoSchema = z3.object({
|
|
336
|
-
id: z3.string(),
|
|
337
|
-
name: z3.string(),
|
|
338
|
-
status: z3.string(),
|
|
339
|
-
uptime: z3.string(),
|
|
340
|
-
app_url: z3.string().nullable(),
|
|
341
|
-
app_id: z3.string(),
|
|
342
|
-
instance_id: z3.string().nullable(),
|
|
343
|
-
configuration: z3.any().optional(),
|
|
344
|
-
// TODO: add VmConfiguration schema if needed
|
|
345
|
-
exited_at: z3.string().nullable(),
|
|
346
|
-
boot_progress: z3.string().nullable(),
|
|
347
|
-
boot_error: z3.string().nullable(),
|
|
348
|
-
shutdown_progress: z3.string().nullable(),
|
|
349
|
-
image_version: z3.string().nullable()
|
|
350
|
-
});
|
|
351
|
-
var ManagedUserSchema = z3.object({
|
|
352
|
-
id: z3.number(),
|
|
353
|
-
username: z3.string()
|
|
354
|
-
});
|
|
355
|
-
var CvmNodeSchema = z3.object({
|
|
356
|
-
id: z3.number(),
|
|
357
|
-
name: z3.string(),
|
|
358
|
-
region_identifier: z3.string().optional()
|
|
359
|
-
});
|
|
360
|
-
var CvmNetworkUrlsSchema = z3.object({
|
|
361
|
-
app: z3.string(),
|
|
362
|
-
instance: z3.string()
|
|
363
|
-
});
|
|
364
|
-
var CvmInfoSchema = z3.object({
|
|
365
|
-
hosted: VmInfoSchema,
|
|
366
|
-
name: z3.string(),
|
|
367
|
-
managed_user: ManagedUserSchema.optional().nullable(),
|
|
368
|
-
node: CvmNodeSchema.optional().nullable(),
|
|
369
|
-
listed: z3.boolean().default(false),
|
|
370
|
-
status: z3.string(),
|
|
371
|
-
in_progress: z3.boolean().default(false),
|
|
372
|
-
dapp_dashboard_url: z3.string().nullable(),
|
|
373
|
-
syslog_endpoint: z3.string().nullable(),
|
|
374
|
-
allow_upgrade: z3.boolean().default(false),
|
|
375
|
-
project_id: z3.string().nullable(),
|
|
376
|
-
// HashedId is represented as string in JS
|
|
377
|
-
project_type: z3.string().nullable(),
|
|
378
|
-
billing_period: z3.string().nullable(),
|
|
379
|
-
kms_info: KmsInfoSchema.nullable(),
|
|
380
|
-
vcpu: z3.number().nullable(),
|
|
381
|
-
memory: z3.number().nullable(),
|
|
382
|
-
disk_size: z3.number().nullable(),
|
|
383
|
-
gateway_domain: z3.string().nullable(),
|
|
384
|
-
public_urls: z3.array(CvmNetworkUrlsSchema)
|
|
385
|
-
}).partial();
|
|
386
|
-
var CvmLegacyDetailSchema = z3.object({
|
|
387
|
-
id: z3.number(),
|
|
388
|
-
name: z3.string(),
|
|
389
|
-
status: z3.string(),
|
|
390
|
-
in_progress: z3.boolean(),
|
|
391
|
-
teepod_id: z3.number().nullable(),
|
|
392
|
-
teepod: CvmNodeSchema,
|
|
393
|
-
app_id: z3.string(),
|
|
394
|
-
vm_uuid: z3.string().nullable(),
|
|
395
|
-
instance_id: z3.string().nullable(),
|
|
396
|
-
vcpu: z3.number().nullable(),
|
|
397
|
-
memory: z3.number().nullable(),
|
|
398
|
-
disk_size: z3.number().nullable(),
|
|
399
|
-
base_image: z3.string(),
|
|
400
|
-
encrypted_env_pubkey: z3.string().nullable(),
|
|
401
|
-
listed: z3.boolean(),
|
|
402
|
-
project_id: z3.string().nullable(),
|
|
403
|
-
project_type: z3.string().nullable(),
|
|
404
|
-
public_sysinfo: z3.boolean(),
|
|
405
|
-
public_logs: z3.boolean(),
|
|
406
|
-
dapp_dashboard_url: z3.string().nullable(),
|
|
407
|
-
syslog_endpoint: z3.string().nullable(),
|
|
408
|
-
kms_info: KmsInfoSchema.nullable(),
|
|
409
|
-
contract_address: z3.string().nullable(),
|
|
410
|
-
deployer_address: z3.string().nullable(),
|
|
411
|
-
scheduled_delete_at: z3.string().nullable(),
|
|
412
|
-
public_urls: z3.array(CvmNetworkUrlsSchema),
|
|
413
|
-
gateway_domain: z3.string().nullable()
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
// src/actions/get_current_user.ts
|
|
417
|
-
import { z as z4 } from "zod";
|
|
76
|
+
import {
|
|
77
|
+
createPublicClient as createPublicClient2,
|
|
78
|
+
createWalletClient as createWalletClient2,
|
|
79
|
+
http as http2,
|
|
80
|
+
parseEventLogs,
|
|
81
|
+
parseEther
|
|
82
|
+
} from "viem";
|
|
83
|
+
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
418
84
|
|
|
419
85
|
// src/utils/index.ts
|
|
420
86
|
import { encryptEnvVars } from "@phala/dstack-sdk/encrypt-env-vars";
|
|
@@ -449,38 +115,6 @@ function asHex(value) {
|
|
|
449
115
|
throw new Error(`Invalid hex value: ${value}`);
|
|
450
116
|
}
|
|
451
117
|
|
|
452
|
-
// src/utils/validate-parameters.ts
|
|
453
|
-
function validateActionParameters(parameters) {
|
|
454
|
-
if (parameters?.schema !== void 0 && parameters?.schema !== false) {
|
|
455
|
-
if (typeof parameters.schema !== "object" || parameters.schema === null || !("parse" in parameters.schema) || typeof parameters.schema.parse !== "function") {
|
|
456
|
-
throw new Error("Invalid schema: must be a Zod schema object, false, or undefined");
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
function safeValidateActionParameters(parameters) {
|
|
461
|
-
if (parameters?.schema !== void 0 && parameters?.schema !== false) {
|
|
462
|
-
if (typeof parameters.schema !== "object" || parameters.schema === null || !("parse" in parameters.schema) || typeof parameters.schema.parse !== "function") {
|
|
463
|
-
return {
|
|
464
|
-
success: false,
|
|
465
|
-
error: {
|
|
466
|
-
name: "ZodError",
|
|
467
|
-
message: "Invalid schema: must be a Zod schema object, false, or undefined",
|
|
468
|
-
issues: [
|
|
469
|
-
{
|
|
470
|
-
code: "invalid_type",
|
|
471
|
-
expected: "object",
|
|
472
|
-
received: typeof parameters.schema,
|
|
473
|
-
path: ["schema"],
|
|
474
|
-
message: "Invalid schema: must be a Zod schema object, false, or undefined"
|
|
475
|
-
}
|
|
476
|
-
]
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return void 0;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
118
|
// src/utils/network.ts
|
|
485
119
|
var NetworkError = class extends Error {
|
|
486
120
|
constructor(message, code, details) {
|
|
@@ -1085,306 +719,7 @@ async function autoCreateClients(chain, options = {}) {
|
|
|
1085
719
|
);
|
|
1086
720
|
}
|
|
1087
721
|
|
|
1088
|
-
// src/actions/
|
|
1089
|
-
var CurrentUserSchema = z4.object({
|
|
1090
|
-
username: z4.string(),
|
|
1091
|
-
email: z4.string(),
|
|
1092
|
-
credits: z4.number(),
|
|
1093
|
-
granted_credits: z4.number(),
|
|
1094
|
-
avatar: z4.string(),
|
|
1095
|
-
team_name: z4.string(),
|
|
1096
|
-
team_tier: z4.string()
|
|
1097
|
-
}).passthrough();
|
|
1098
|
-
async function getCurrentUser(client, parameters) {
|
|
1099
|
-
validateActionParameters(parameters);
|
|
1100
|
-
const response = await client.get("/auth/me");
|
|
1101
|
-
if (parameters?.schema === false) {
|
|
1102
|
-
return response;
|
|
1103
|
-
}
|
|
1104
|
-
const schema = parameters?.schema || CurrentUserSchema;
|
|
1105
|
-
return schema.parse(response);
|
|
1106
|
-
}
|
|
1107
|
-
async function safeGetCurrentUser(client, parameters) {
|
|
1108
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
1109
|
-
if (parameterValidationError) {
|
|
1110
|
-
return parameterValidationError;
|
|
1111
|
-
}
|
|
1112
|
-
const httpResult = await client.safeGet("/auth/me");
|
|
1113
|
-
if (!httpResult.success) {
|
|
1114
|
-
return httpResult;
|
|
1115
|
-
}
|
|
1116
|
-
if (parameters?.schema === false) {
|
|
1117
|
-
return { success: true, data: httpResult.data };
|
|
1118
|
-
}
|
|
1119
|
-
const schema = parameters?.schema || CurrentUserSchema;
|
|
1120
|
-
return schema.safeParse(httpResult.data);
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
// src/actions/get_available_nodes.ts
|
|
1124
|
-
import { z as z5 } from "zod";
|
|
1125
|
-
var AvailableOSImageSchema = z5.object({
|
|
1126
|
-
name: z5.string(),
|
|
1127
|
-
is_dev: z5.boolean(),
|
|
1128
|
-
version: z5.union([
|
|
1129
|
-
z5.tuple([z5.number(), z5.number(), z5.number()]),
|
|
1130
|
-
z5.tuple([z5.number(), z5.number(), z5.number(), z5.number()])
|
|
1131
|
-
]),
|
|
1132
|
-
os_image_hash: z5.string().nullable().optional()
|
|
1133
|
-
}).passthrough();
|
|
1134
|
-
var TeepodCapacitySchema = z5.object({
|
|
1135
|
-
teepod_id: z5.number(),
|
|
1136
|
-
name: z5.string(),
|
|
1137
|
-
listed: z5.boolean(),
|
|
1138
|
-
resource_score: z5.number(),
|
|
1139
|
-
remaining_vcpu: z5.number(),
|
|
1140
|
-
remaining_memory: z5.number(),
|
|
1141
|
-
remaining_cvm_slots: z5.number(),
|
|
1142
|
-
images: z5.array(AvailableOSImageSchema),
|
|
1143
|
-
support_onchain_kms: z5.boolean().optional(),
|
|
1144
|
-
fmspc: z5.string().nullable().optional(),
|
|
1145
|
-
device_id: z5.string().nullable().optional(),
|
|
1146
|
-
region_identifier: z5.string().nullable().optional(),
|
|
1147
|
-
default_kms: z5.string().nullable().optional(),
|
|
1148
|
-
kms_list: z5.array(z5.string()).default([])
|
|
1149
|
-
}).passthrough();
|
|
1150
|
-
var ResourceThresholdSchema = z5.object({
|
|
1151
|
-
max_instances: z5.number().nullable().optional(),
|
|
1152
|
-
max_vcpu: z5.number().nullable().optional(),
|
|
1153
|
-
max_memory: z5.number().nullable().optional(),
|
|
1154
|
-
max_disk: z5.number().nullable().optional()
|
|
1155
|
-
}).passthrough();
|
|
1156
|
-
var AvailableNodesSchema = z5.object({
|
|
1157
|
-
tier: z5.string(),
|
|
1158
|
-
// TeamTier is string enum
|
|
1159
|
-
capacity: ResourceThresholdSchema,
|
|
1160
|
-
nodes: z5.array(TeepodCapacitySchema),
|
|
1161
|
-
kms_list: z5.array(KmsInfoSchema)
|
|
1162
|
-
}).passthrough();
|
|
1163
|
-
async function getAvailableNodes(client, parameters) {
|
|
1164
|
-
const response = await client.get("/teepods/available");
|
|
1165
|
-
if (parameters?.schema === false) {
|
|
1166
|
-
return response;
|
|
1167
|
-
}
|
|
1168
|
-
const schema = parameters?.schema || AvailableNodesSchema;
|
|
1169
|
-
return schema.parse(response);
|
|
1170
|
-
}
|
|
1171
|
-
async function safeGetAvailableNodes(client, parameters) {
|
|
1172
|
-
const httpResult = await client.safeGet("/teepods/available");
|
|
1173
|
-
if (!httpResult.success) {
|
|
1174
|
-
return httpResult;
|
|
1175
|
-
}
|
|
1176
|
-
if (parameters?.schema === false) {
|
|
1177
|
-
return { success: true, data: httpResult.data };
|
|
1178
|
-
}
|
|
1179
|
-
const schema = parameters?.schema || AvailableNodesSchema;
|
|
1180
|
-
return schema.safeParse(httpResult.data);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
// src/actions/provision_cvm.ts
|
|
1184
|
-
import { z as z6 } from "zod";
|
|
1185
|
-
var ProvisionCvmSchema = z6.object({
|
|
1186
|
-
app_id: z6.string().nullable().optional(),
|
|
1187
|
-
app_env_encrypt_pubkey: z6.string().nullable().optional(),
|
|
1188
|
-
compose_hash: z6.string(),
|
|
1189
|
-
fmspc: z6.string().nullable().optional(),
|
|
1190
|
-
device_id: z6.string().nullable().optional(),
|
|
1191
|
-
os_image_hash: z6.string().nullable().optional(),
|
|
1192
|
-
node_id: z6.number().nullable().optional(),
|
|
1193
|
-
// Transformed from teepod_id in response
|
|
1194
|
-
kms_id: z6.string().nullable().optional()
|
|
1195
|
-
}).passthrough();
|
|
1196
|
-
var ProvisionCvmRequestSchema = z6.object({
|
|
1197
|
-
node_id: z6.number().optional(),
|
|
1198
|
-
// recommended
|
|
1199
|
-
teepod_id: z6.number().optional(),
|
|
1200
|
-
// deprecated, for compatibility
|
|
1201
|
-
name: z6.string(),
|
|
1202
|
-
image: z6.string(),
|
|
1203
|
-
vcpu: z6.number(),
|
|
1204
|
-
memory: z6.number(),
|
|
1205
|
-
disk_size: z6.number(),
|
|
1206
|
-
compose_file: z6.object({
|
|
1207
|
-
allowed_envs: z6.array(z6.string()).optional(),
|
|
1208
|
-
pre_launch_script: z6.string().optional(),
|
|
1209
|
-
docker_compose_file: z6.string().optional(),
|
|
1210
|
-
name: z6.string().optional(),
|
|
1211
|
-
kms_enabled: z6.boolean().optional(),
|
|
1212
|
-
public_logs: z6.boolean().optional(),
|
|
1213
|
-
public_sysinfo: z6.boolean().optional(),
|
|
1214
|
-
gateway_enabled: z6.boolean().optional(),
|
|
1215
|
-
// recommended
|
|
1216
|
-
tproxy_enabled: z6.boolean().optional()
|
|
1217
|
-
// deprecated, for compatibility
|
|
1218
|
-
}),
|
|
1219
|
-
listed: z6.boolean().optional(),
|
|
1220
|
-
instance_type: z6.string().nullable().optional(),
|
|
1221
|
-
kms_id: z6.string().optional(),
|
|
1222
|
-
env_keys: z6.array(z6.string()).optional()
|
|
1223
|
-
}).passthrough();
|
|
1224
|
-
function autofillComposeFileName(appCompose) {
|
|
1225
|
-
if (appCompose.compose_file && !appCompose.compose_file.name) {
|
|
1226
|
-
return {
|
|
1227
|
-
...appCompose,
|
|
1228
|
-
compose_file: {
|
|
1229
|
-
...appCompose.compose_file,
|
|
1230
|
-
name: appCompose.name
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
}
|
|
1234
|
-
return appCompose;
|
|
1235
|
-
}
|
|
1236
|
-
function handleGatewayCompatibility(appCompose) {
|
|
1237
|
-
if (!appCompose.compose_file) {
|
|
1238
|
-
return appCompose;
|
|
1239
|
-
}
|
|
1240
|
-
const composeFile = { ...appCompose.compose_file };
|
|
1241
|
-
if (typeof composeFile.gateway_enabled === "boolean" && typeof composeFile.tproxy_enabled === "boolean") {
|
|
1242
|
-
delete composeFile.tproxy_enabled;
|
|
1243
|
-
} else if (typeof composeFile.tproxy_enabled === "boolean" && typeof composeFile.gateway_enabled === "undefined") {
|
|
1244
|
-
composeFile.gateway_enabled = composeFile.tproxy_enabled;
|
|
1245
|
-
delete composeFile.tproxy_enabled;
|
|
1246
|
-
if (typeof window !== "undefined" ? window.console : globalThis.console) {
|
|
1247
|
-
console.warn(
|
|
1248
|
-
"[phala/cloud] tproxy_enabled is deprecated, please use gateway_enabled instead. See docs for migration."
|
|
1249
|
-
);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
return {
|
|
1253
|
-
...appCompose,
|
|
1254
|
-
compose_file: composeFile
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
function transformResponse(data, isDefaultSchema) {
|
|
1258
|
-
if (!isDefaultSchema || !data || typeof data !== "object") {
|
|
1259
|
-
return data;
|
|
1260
|
-
}
|
|
1261
|
-
if (data && typeof data === "object" && "teepod_id" in data) {
|
|
1262
|
-
const { teepod_id, ...rest } = data;
|
|
1263
|
-
return { ...rest, node_id: teepod_id };
|
|
1264
|
-
}
|
|
1265
|
-
return data;
|
|
1266
|
-
}
|
|
1267
|
-
async function provisionCvm(client, appCompose, parameters) {
|
|
1268
|
-
validateActionParameters(parameters);
|
|
1269
|
-
const body = handleGatewayCompatibility(autofillComposeFileName(appCompose));
|
|
1270
|
-
let requestBody = { ...body };
|
|
1271
|
-
if (typeof body.node_id === "number") {
|
|
1272
|
-
requestBody = { ...body, teepod_id: body.node_id };
|
|
1273
|
-
delete requestBody.node_id;
|
|
1274
|
-
} else if (typeof body.teepod_id === "number") {
|
|
1275
|
-
console.warn("[phala/cloud] teepod_id is deprecated, please use node_id instead.");
|
|
1276
|
-
}
|
|
1277
|
-
const response = await client.post("/cvms/provision", requestBody);
|
|
1278
|
-
const isDefaultSchema = parameters?.schema === void 0;
|
|
1279
|
-
const transformedData = transformResponse(response, isDefaultSchema);
|
|
1280
|
-
if (parameters?.schema === false) {
|
|
1281
|
-
return transformedData;
|
|
1282
|
-
}
|
|
1283
|
-
const usedSchema = parameters?.schema || ProvisionCvmSchema;
|
|
1284
|
-
return usedSchema.parse(transformedData);
|
|
1285
|
-
}
|
|
1286
|
-
async function safeProvisionCvm(client, appCompose, parameters) {
|
|
1287
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
1288
|
-
if (parameterValidationError) {
|
|
1289
|
-
return parameterValidationError;
|
|
1290
|
-
}
|
|
1291
|
-
const schema = parameters?.schema;
|
|
1292
|
-
const body = handleGatewayCompatibility(autofillComposeFileName(appCompose));
|
|
1293
|
-
let requestBody = { ...body };
|
|
1294
|
-
if (typeof body.node_id === "number") {
|
|
1295
|
-
requestBody = { ...body, teepod_id: body.node_id };
|
|
1296
|
-
delete requestBody.node_id;
|
|
1297
|
-
} else if (typeof body.teepod_id === "number") {
|
|
1298
|
-
console.warn("[phala/cloud] teepod_id is deprecated, please use node_id instead.");
|
|
1299
|
-
}
|
|
1300
|
-
const httpResult = await client.safePost("/cvms/provision", requestBody);
|
|
1301
|
-
if (!httpResult.success) {
|
|
1302
|
-
return httpResult;
|
|
1303
|
-
}
|
|
1304
|
-
if (schema === false) {
|
|
1305
|
-
return { success: true, data: httpResult.data };
|
|
1306
|
-
}
|
|
1307
|
-
const isDefaultSchema = !schema;
|
|
1308
|
-
const usedSchema = schema || ProvisionCvmSchema;
|
|
1309
|
-
const transformResult = usedSchema.safeParse(transformResponse(httpResult.data, isDefaultSchema));
|
|
1310
|
-
return transformResult;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
// src/actions/commit_cvm_provision.ts
|
|
1314
|
-
import { z as z7 } from "zod";
|
|
1315
|
-
var CommitCvmProvisionSchema = z7.object({
|
|
1316
|
-
id: z7.number(),
|
|
1317
|
-
name: z7.string(),
|
|
1318
|
-
status: z7.string(),
|
|
1319
|
-
teepod_id: z7.number(),
|
|
1320
|
-
teepod: z7.object({
|
|
1321
|
-
id: z7.number(),
|
|
1322
|
-
name: z7.string()
|
|
1323
|
-
}).nullable(),
|
|
1324
|
-
user_id: z7.number().nullable(),
|
|
1325
|
-
app_id: z7.string().nullable(),
|
|
1326
|
-
vm_uuid: z7.string().nullable(),
|
|
1327
|
-
instance_id: z7.string().nullable(),
|
|
1328
|
-
app_url: z7.string().nullable(),
|
|
1329
|
-
base_image: z7.string().nullable(),
|
|
1330
|
-
vcpu: z7.number(),
|
|
1331
|
-
memory: z7.number(),
|
|
1332
|
-
disk_size: z7.number(),
|
|
1333
|
-
manifest_version: z7.number().nullable(),
|
|
1334
|
-
version: z7.string().nullable(),
|
|
1335
|
-
runner: z7.string().nullable(),
|
|
1336
|
-
docker_compose_file: z7.string().nullable(),
|
|
1337
|
-
features: z7.array(z7.string()).nullable(),
|
|
1338
|
-
created_at: z7.string(),
|
|
1339
|
-
encrypted_env_pubkey: z7.string().nullable().optional(),
|
|
1340
|
-
app_auth_contract_address: z7.string().nullable().optional(),
|
|
1341
|
-
deployer_address: z7.string().nullable().optional()
|
|
1342
|
-
}).passthrough();
|
|
1343
|
-
var CommitCvmProvisionRequestSchema = z7.object({
|
|
1344
|
-
encrypted_env: z7.string().optional().nullable(),
|
|
1345
|
-
app_id: z7.string(),
|
|
1346
|
-
compose_hash: z7.string().optional(),
|
|
1347
|
-
kms_id: z7.string().optional(),
|
|
1348
|
-
contract_address: z7.string().optional(),
|
|
1349
|
-
deployer_address: z7.string().optional(),
|
|
1350
|
-
env_keys: z7.array(z7.string()).optional().nullable()
|
|
1351
|
-
}).passthrough();
|
|
1352
|
-
async function commitCvmProvision(client, payload, parameters) {
|
|
1353
|
-
validateActionParameters(parameters);
|
|
1354
|
-
const response = await client.post("/cvms", payload);
|
|
1355
|
-
if (parameters?.schema === false) {
|
|
1356
|
-
return response;
|
|
1357
|
-
}
|
|
1358
|
-
const schema = parameters?.schema || CommitCvmProvisionSchema;
|
|
1359
|
-
return schema.parse(response);
|
|
1360
|
-
}
|
|
1361
|
-
async function safeCommitCvmProvision(client, payload, parameters) {
|
|
1362
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
1363
|
-
if (parameterValidationError) {
|
|
1364
|
-
return parameterValidationError;
|
|
1365
|
-
}
|
|
1366
|
-
const httpResult = await client.safePost("/cvms", payload);
|
|
1367
|
-
if (!httpResult.success) {
|
|
1368
|
-
return httpResult;
|
|
1369
|
-
}
|
|
1370
|
-
if (parameters?.schema === false) {
|
|
1371
|
-
return { success: true, data: httpResult.data };
|
|
1372
|
-
}
|
|
1373
|
-
const schema = parameters?.schema || CommitCvmProvisionSchema;
|
|
1374
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
1375
|
-
return validationResult;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
// src/actions/deploy_app_auth.ts
|
|
1379
|
-
import { z as z8 } from "zod";
|
|
1380
|
-
import {
|
|
1381
|
-
createPublicClient as createPublicClient2,
|
|
1382
|
-
createWalletClient as createWalletClient2,
|
|
1383
|
-
http as http2,
|
|
1384
|
-
parseEventLogs,
|
|
1385
|
-
parseEther
|
|
1386
|
-
} from "viem";
|
|
1387
|
-
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
722
|
+
// src/actions/blockchains/deploy_app_auth.ts
|
|
1388
723
|
var kmsAuthAbi = [
|
|
1389
724
|
{
|
|
1390
725
|
inputs: [
|
|
@@ -1415,25 +750,25 @@ var kmsAuthAbi = [
|
|
|
1415
750
|
anonymous: false
|
|
1416
751
|
}
|
|
1417
752
|
];
|
|
1418
|
-
var DeployAppAuthRequestBaseSchema =
|
|
753
|
+
var DeployAppAuthRequestBaseSchema = z.object({
|
|
1419
754
|
// Chain configuration (conditionally required)
|
|
1420
|
-
chain:
|
|
1421
|
-
rpcUrl:
|
|
755
|
+
chain: z.unknown().optional(),
|
|
756
|
+
rpcUrl: z.string().optional(),
|
|
1422
757
|
// Contract configuration (required)
|
|
1423
|
-
kmsContractAddress:
|
|
758
|
+
kmsContractAddress: z.string(),
|
|
1424
759
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
1425
|
-
privateKey:
|
|
1426
|
-
walletClient:
|
|
760
|
+
privateKey: z.string().optional(),
|
|
761
|
+
walletClient: z.unknown().optional(),
|
|
1427
762
|
// Public client (optional, will create default if not provided)
|
|
1428
|
-
publicClient:
|
|
763
|
+
publicClient: z.unknown().optional(),
|
|
1429
764
|
// App configuration (optional)
|
|
1430
|
-
allowAnyDevice:
|
|
1431
|
-
deviceId:
|
|
1432
|
-
composeHash:
|
|
1433
|
-
disableUpgrades:
|
|
765
|
+
allowAnyDevice: z.boolean().optional().default(false),
|
|
766
|
+
deviceId: z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
767
|
+
composeHash: z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
768
|
+
disableUpgrades: z.boolean().optional().default(false),
|
|
1434
769
|
// Validation configuration (optional)
|
|
1435
|
-
skipPrerequisiteChecks:
|
|
1436
|
-
minBalance:
|
|
770
|
+
skipPrerequisiteChecks: z.boolean().optional().default(false),
|
|
771
|
+
minBalance: z.string().optional()
|
|
1437
772
|
// ETH amount as string, e.g., "0.01"
|
|
1438
773
|
}).passthrough();
|
|
1439
774
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -1461,13 +796,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
1461
796
|
path: ["chain"]
|
|
1462
797
|
}
|
|
1463
798
|
);
|
|
1464
|
-
var DeployAppAuthSchema =
|
|
1465
|
-
appId:
|
|
1466
|
-
appAuthAddress:
|
|
1467
|
-
deployer:
|
|
1468
|
-
transactionHash:
|
|
1469
|
-
blockNumber:
|
|
1470
|
-
gasUsed:
|
|
799
|
+
var DeployAppAuthSchema = z.object({
|
|
800
|
+
appId: z.string(),
|
|
801
|
+
appAuthAddress: z.string(),
|
|
802
|
+
deployer: z.string(),
|
|
803
|
+
transactionHash: z.string(),
|
|
804
|
+
blockNumber: z.bigint().optional(),
|
|
805
|
+
gasUsed: z.bigint().optional()
|
|
1471
806
|
}).passthrough();
|
|
1472
807
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
1473
808
|
try {
|
|
@@ -1712,8 +1047,8 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
1712
1047
|
}
|
|
1713
1048
|
}
|
|
1714
1049
|
|
|
1715
|
-
// src/actions/add_compose_hash.ts
|
|
1716
|
-
import { z as
|
|
1050
|
+
// src/actions/blockchains/add_compose_hash.ts
|
|
1051
|
+
import { z as z2 } from "zod";
|
|
1717
1052
|
import {
|
|
1718
1053
|
createPublicClient as createPublicClient3,
|
|
1719
1054
|
createWalletClient as createWalletClient3,
|
|
@@ -1737,29 +1072,29 @@ var appAuthAbi = [
|
|
|
1737
1072
|
anonymous: false
|
|
1738
1073
|
}
|
|
1739
1074
|
];
|
|
1740
|
-
var AddComposeHashRequestSchema =
|
|
1075
|
+
var AddComposeHashRequestSchema = z2.object({
|
|
1741
1076
|
// Chain configuration (conditionally required)
|
|
1742
|
-
chain:
|
|
1743
|
-
rpcUrl:
|
|
1744
|
-
appId:
|
|
1745
|
-
composeHash:
|
|
1077
|
+
chain: z2.unknown().optional(),
|
|
1078
|
+
rpcUrl: z2.string().optional(),
|
|
1079
|
+
appId: z2.string(),
|
|
1080
|
+
composeHash: z2.string(),
|
|
1746
1081
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
1747
|
-
privateKey:
|
|
1748
|
-
walletClient:
|
|
1082
|
+
privateKey: z2.string().optional(),
|
|
1083
|
+
walletClient: z2.unknown().optional(),
|
|
1749
1084
|
// Public client (optional, will create default if not provided)
|
|
1750
|
-
publicClient:
|
|
1085
|
+
publicClient: z2.unknown().optional(),
|
|
1751
1086
|
// Validation configuration (optional)
|
|
1752
|
-
skipPrerequisiteChecks:
|
|
1753
|
-
minBalance:
|
|
1087
|
+
skipPrerequisiteChecks: z2.boolean().optional().default(false),
|
|
1088
|
+
minBalance: z2.string().optional(),
|
|
1754
1089
|
// ETH amount as string, e.g., "0.01"
|
|
1755
1090
|
// Transaction control options
|
|
1756
|
-
timeout:
|
|
1757
|
-
retryOptions:
|
|
1758
|
-
signal:
|
|
1091
|
+
timeout: z2.number().optional().default(12e4),
|
|
1092
|
+
retryOptions: z2.unknown().optional(),
|
|
1093
|
+
signal: z2.unknown().optional(),
|
|
1759
1094
|
// Progress callbacks
|
|
1760
|
-
onTransactionStateChange:
|
|
1761
|
-
onTransactionSubmitted:
|
|
1762
|
-
onTransactionConfirmed:
|
|
1095
|
+
onTransactionStateChange: z2.function().optional(),
|
|
1096
|
+
onTransactionSubmitted: z2.function().optional(),
|
|
1097
|
+
onTransactionConfirmed: z2.function().optional()
|
|
1763
1098
|
}).passthrough().refine(
|
|
1764
1099
|
(data) => {
|
|
1765
1100
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -1783,12 +1118,12 @@ var AddComposeHashRequestSchema = z9.object({
|
|
|
1783
1118
|
path: ["chain"]
|
|
1784
1119
|
}
|
|
1785
1120
|
);
|
|
1786
|
-
var AddComposeHashSchema =
|
|
1787
|
-
composeHash:
|
|
1788
|
-
appId:
|
|
1789
|
-
transactionHash:
|
|
1790
|
-
blockNumber:
|
|
1791
|
-
gasUsed:
|
|
1121
|
+
var AddComposeHashSchema = z2.object({
|
|
1122
|
+
composeHash: z2.string(),
|
|
1123
|
+
appId: z2.string(),
|
|
1124
|
+
transactionHash: z2.string(),
|
|
1125
|
+
blockNumber: z2.bigint().optional(),
|
|
1126
|
+
gasUsed: z2.bigint().optional()
|
|
1792
1127
|
}).passthrough();
|
|
1793
1128
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
1794
1129
|
console.log(receipt.logs);
|
|
@@ -1979,566 +1314,6 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
1979
1314
|
}
|
|
1980
1315
|
}
|
|
1981
1316
|
|
|
1982
|
-
// src/actions/get_cvm_compose_file.ts
|
|
1983
|
-
import { z as z11 } from "zod";
|
|
1984
|
-
|
|
1985
|
-
// src/types/app_compose.ts
|
|
1986
|
-
import { z as z10 } from "zod";
|
|
1987
|
-
var LooseAppComposeSchema = z10.object({
|
|
1988
|
-
allowed_envs: z10.array(z10.string()).optional(),
|
|
1989
|
-
docker_compose_file: z10.string(),
|
|
1990
|
-
features: z10.array(z10.string()).optional(),
|
|
1991
|
-
name: z10.string().optional(),
|
|
1992
|
-
manifest_version: z10.number().optional(),
|
|
1993
|
-
kms_enabled: z10.boolean().optional(),
|
|
1994
|
-
public_logs: z10.boolean().optional(),
|
|
1995
|
-
public_sysinfo: z10.boolean().optional(),
|
|
1996
|
-
tproxy_enabled: z10.boolean().optional(),
|
|
1997
|
-
pre_launch_script: z10.string().optional()
|
|
1998
|
-
}).passthrough();
|
|
1999
|
-
|
|
2000
|
-
// src/actions/get_cvm_compose_file.ts
|
|
2001
|
-
var GetCvmComposeFileRequestSchema = z11.object({
|
|
2002
|
-
id: z11.string().optional(),
|
|
2003
|
-
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(),
|
|
2004
|
-
app_id: z11.string().refine(
|
|
2005
|
-
(val) => !val.startsWith("app_") && val.length === 40,
|
|
2006
|
-
"app_id should be 40 characters without prefix"
|
|
2007
|
-
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
2008
|
-
instance_id: z11.string().refine(
|
|
2009
|
-
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
2010
|
-
"instance_id should be 40 characters without prefix"
|
|
2011
|
-
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional()
|
|
2012
|
-
}).refine(
|
|
2013
|
-
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
2014
|
-
"One of id, uuid, app_id, or instance_id must be provided"
|
|
2015
|
-
).transform((data) => ({
|
|
2016
|
-
cvmId: data.id || data.uuid || data.app_id || data.instance_id,
|
|
2017
|
-
_raw: data
|
|
2018
|
-
}));
|
|
2019
|
-
async function getCvmComposeFile(client, request, parameters) {
|
|
2020
|
-
const validatedRequest = GetCvmComposeFileRequestSchema.parse(request);
|
|
2021
|
-
const response = await client.get(`/cvms/${validatedRequest.cvmId}/compose_file`);
|
|
2022
|
-
if (parameters?.schema === false) {
|
|
2023
|
-
return response;
|
|
2024
|
-
}
|
|
2025
|
-
const schema = parameters?.schema || LooseAppComposeSchema;
|
|
2026
|
-
return schema.parse(response);
|
|
2027
|
-
}
|
|
2028
|
-
async function safeGetCvmComposeFile(client, request, parameters) {
|
|
2029
|
-
const requestValidation = GetCvmComposeFileRequestSchema.safeParse(request);
|
|
2030
|
-
if (!requestValidation.success) {
|
|
2031
|
-
return requestValidation;
|
|
2032
|
-
}
|
|
2033
|
-
const httpResult = await client.safeGet(`/cvms/${requestValidation.data.cvmId}/compose_file`);
|
|
2034
|
-
if (!httpResult.success) {
|
|
2035
|
-
return httpResult;
|
|
2036
|
-
}
|
|
2037
|
-
if (parameters?.schema === false) {
|
|
2038
|
-
return { success: true, data: httpResult.data };
|
|
2039
|
-
}
|
|
2040
|
-
const schema = parameters?.schema || LooseAppComposeSchema;
|
|
2041
|
-
return schema.safeParse(httpResult.data);
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
// src/actions/provision_cvm_compose_file_update.ts
|
|
2045
|
-
import { z as z12 } from "zod";
|
|
2046
|
-
var ProvisionCvmComposeFileUpdateRequestSchema = z12.object({
|
|
2047
|
-
id: z12.string().optional(),
|
|
2048
|
-
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(),
|
|
2049
|
-
app_id: z12.string().refine(
|
|
2050
|
-
(val) => !val.startsWith("app_") && val.length === 40,
|
|
2051
|
-
"app_id should be 40 characters without prefix"
|
|
2052
|
-
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
2053
|
-
instance_id: z12.string().refine(
|
|
2054
|
-
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
2055
|
-
"instance_id should be 40 characters without prefix"
|
|
2056
|
-
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
2057
|
-
app_compose: LooseAppComposeSchema,
|
|
2058
|
-
update_env_vars: z12.boolean().optional().nullable()
|
|
2059
|
-
}).refine(
|
|
2060
|
-
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
2061
|
-
"One of id, uuid, app_id, or instance_id must be provided"
|
|
2062
|
-
).transform((data) => ({
|
|
2063
|
-
cvmId: data.id || data.uuid || data.app_id || data.instance_id,
|
|
2064
|
-
request: data.app_compose,
|
|
2065
|
-
update_env_vars: data.update_env_vars,
|
|
2066
|
-
_raw: data
|
|
2067
|
-
}));
|
|
2068
|
-
var ProvisionCvmComposeFileUpdateResultSchema = z12.object({
|
|
2069
|
-
app_id: z12.string().nullable(),
|
|
2070
|
-
device_id: z12.string().nullable(),
|
|
2071
|
-
compose_hash: z12.string(),
|
|
2072
|
-
kms_info: KmsInfoSchema.nullable().optional()
|
|
2073
|
-
}).passthrough();
|
|
2074
|
-
async function provisionCvmComposeFileUpdate(client, request, parameters) {
|
|
2075
|
-
const validatedRequest = ProvisionCvmComposeFileUpdateRequestSchema.parse(request);
|
|
2076
|
-
const response = await client.post(
|
|
2077
|
-
`/cvms/${validatedRequest.cvmId}/compose_file/provision`,
|
|
2078
|
-
validatedRequest.request
|
|
2079
|
-
);
|
|
2080
|
-
if (parameters?.schema === false) {
|
|
2081
|
-
return response;
|
|
2082
|
-
}
|
|
2083
|
-
const schema = parameters?.schema || ProvisionCvmComposeFileUpdateResultSchema;
|
|
2084
|
-
return schema.parse(response);
|
|
2085
|
-
}
|
|
2086
|
-
async function safeProvisionCvmComposeFileUpdate(client, request, parameters) {
|
|
2087
|
-
const requestValidation = ProvisionCvmComposeFileUpdateRequestSchema.safeParse(request);
|
|
2088
|
-
if (!requestValidation.success) {
|
|
2089
|
-
return requestValidation;
|
|
2090
|
-
}
|
|
2091
|
-
const httpResult = await client.safePost(
|
|
2092
|
-
`/cvms/${requestValidation.data.cvmId}/compose_file/provision`,
|
|
2093
|
-
requestValidation.data.request
|
|
2094
|
-
);
|
|
2095
|
-
if (!httpResult.success) {
|
|
2096
|
-
return httpResult;
|
|
2097
|
-
}
|
|
2098
|
-
if (parameters?.schema === false) {
|
|
2099
|
-
return { success: true, data: httpResult.data };
|
|
2100
|
-
}
|
|
2101
|
-
const schema = parameters?.schema || ProvisionCvmComposeFileUpdateResultSchema;
|
|
2102
|
-
return schema.safeParse(httpResult.data);
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
// src/actions/commit_cvm_compose_file_update.ts
|
|
2106
|
-
import { z as z13 } from "zod";
|
|
2107
|
-
var CommitCvmComposeFileUpdateRequestSchema = z13.object({
|
|
2108
|
-
id: z13.string().optional(),
|
|
2109
|
-
uuid: z13.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(),
|
|
2110
|
-
app_id: z13.string().refine(
|
|
2111
|
-
(val) => !val.startsWith("app_") && val.length === 40,
|
|
2112
|
-
"app_id should be 40 characters without prefix"
|
|
2113
|
-
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
2114
|
-
instance_id: z13.string().refine(
|
|
2115
|
-
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
2116
|
-
"instance_id should be 40 characters without prefix"
|
|
2117
|
-
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
2118
|
-
compose_hash: z13.string().min(1, "Compose hash is required"),
|
|
2119
|
-
encrypted_env: z13.string().optional(),
|
|
2120
|
-
env_keys: z13.array(z13.string()).optional(),
|
|
2121
|
-
update_env_vars: z13.boolean().optional().nullable()
|
|
2122
|
-
}).refine(
|
|
2123
|
-
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
2124
|
-
"One of id, uuid, app_id, or instance_id must be provided"
|
|
2125
|
-
).transform((data) => ({
|
|
2126
|
-
cvmId: data.id || data.uuid || data.app_id || data.instance_id,
|
|
2127
|
-
compose_hash: data.compose_hash,
|
|
2128
|
-
encrypted_env: data.encrypted_env,
|
|
2129
|
-
env_keys: data.env_keys,
|
|
2130
|
-
update_env_vars: !!data.update_env_vars,
|
|
2131
|
-
_raw: data
|
|
2132
|
-
}));
|
|
2133
|
-
var CommitCvmComposeFileUpdateSchema = z13.any().transform(() => void 0);
|
|
2134
|
-
async function commitCvmComposeFileUpdate(client, request, parameters) {
|
|
2135
|
-
const validatedRequest = CommitCvmComposeFileUpdateRequestSchema.parse(request);
|
|
2136
|
-
const response = await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
|
|
2137
|
-
compose_hash: validatedRequest.compose_hash,
|
|
2138
|
-
encrypted_env: validatedRequest.encrypted_env,
|
|
2139
|
-
env_keys: validatedRequest.env_keys
|
|
2140
|
-
});
|
|
2141
|
-
if (parameters?.schema === false) {
|
|
2142
|
-
return response;
|
|
2143
|
-
}
|
|
2144
|
-
const schema = parameters?.schema || CommitCvmComposeFileUpdateSchema;
|
|
2145
|
-
return schema.parse(response);
|
|
2146
|
-
}
|
|
2147
|
-
async function safeCommitCvmComposeFileUpdate(client, request, parameters) {
|
|
2148
|
-
const requestValidation = CommitCvmComposeFileUpdateRequestSchema.safeParse(request);
|
|
2149
|
-
if (!requestValidation.success) {
|
|
2150
|
-
return requestValidation;
|
|
2151
|
-
}
|
|
2152
|
-
const httpResult = await client.safePatch(`/cvms/${requestValidation.data.cvmId}/compose_file`, {
|
|
2153
|
-
compose_hash: requestValidation.data.compose_hash,
|
|
2154
|
-
encrypted_env: requestValidation.data.encrypted_env,
|
|
2155
|
-
env_keys: requestValidation.data.env_keys
|
|
2156
|
-
});
|
|
2157
|
-
if (!httpResult.success) {
|
|
2158
|
-
return httpResult;
|
|
2159
|
-
}
|
|
2160
|
-
if (parameters?.schema === false) {
|
|
2161
|
-
return { success: true, data: httpResult.data };
|
|
2162
|
-
}
|
|
2163
|
-
const schema = parameters?.schema || CommitCvmComposeFileUpdateSchema;
|
|
2164
|
-
return schema.safeParse(httpResult.data);
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
// src/actions/get_app_env_encrypt_pubkey.ts
|
|
2168
|
-
import { z as z14 } from "zod";
|
|
2169
|
-
var GetAppEnvEncryptPubKeyRequestSchema = z14.object({
|
|
2170
|
-
kms: z14.string().min(1, "KMS ID or slug is required"),
|
|
2171
|
-
app_id: z14.string().refine(
|
|
2172
|
-
(val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
|
|
2173
|
-
"App ID must be exactly 40 characters or 42 characters with 0x prefix"
|
|
2174
|
-
)
|
|
2175
|
-
}).strict();
|
|
2176
|
-
var GetAppEnvEncryptPubKeySchema = z14.object({
|
|
2177
|
-
public_key: z14.string(),
|
|
2178
|
-
signature: z14.string()
|
|
2179
|
-
}).strict();
|
|
2180
|
-
var getAppEnvEncryptPubKey = async (client, payload, parameters) => {
|
|
2181
|
-
const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
|
|
2182
|
-
validateActionParameters(parameters);
|
|
2183
|
-
const response = await client.get(
|
|
2184
|
-
`/kms/${validatedRequest.kms}/pubkey/${validatedRequest.app_id}`
|
|
2185
|
-
);
|
|
2186
|
-
if (parameters?.schema === false) {
|
|
2187
|
-
return response;
|
|
2188
|
-
}
|
|
2189
|
-
const schema = parameters?.schema || GetAppEnvEncryptPubKeySchema;
|
|
2190
|
-
return schema.parse(response);
|
|
2191
|
-
};
|
|
2192
|
-
var safeGetAppEnvEncryptPubKey = async (client, payload, parameters) => {
|
|
2193
|
-
const requestValidation = GetAppEnvEncryptPubKeyRequestSchema.safeParse(payload);
|
|
2194
|
-
if (!requestValidation.success) {
|
|
2195
|
-
return requestValidation;
|
|
2196
|
-
}
|
|
2197
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2198
|
-
if (parameterValidationError) {
|
|
2199
|
-
return parameterValidationError;
|
|
2200
|
-
}
|
|
2201
|
-
const httpResult = await client.safeGet(
|
|
2202
|
-
`/kms/${requestValidation.data.kms}/pubkey/${requestValidation.data.app_id}`
|
|
2203
|
-
);
|
|
2204
|
-
if (!httpResult.success) {
|
|
2205
|
-
return httpResult;
|
|
2206
|
-
}
|
|
2207
|
-
if (parameters?.schema === false) {
|
|
2208
|
-
return { success: true, data: httpResult.data };
|
|
2209
|
-
}
|
|
2210
|
-
const schema = parameters?.schema || GetAppEnvEncryptPubKeySchema;
|
|
2211
|
-
return schema.safeParse(httpResult.data);
|
|
2212
|
-
};
|
|
2213
|
-
|
|
2214
|
-
// src/actions/get_cvm_info.ts
|
|
2215
|
-
import { z as z15 } from "zod";
|
|
2216
|
-
var GetCvmInfoRequestSchema = z15.object({
|
|
2217
|
-
id: z15.string().optional(),
|
|
2218
|
-
uuid: z15.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(),
|
|
2219
|
-
app_id: z15.string().refine(
|
|
2220
|
-
(val) => !val.startsWith("app_") && val.length === 40,
|
|
2221
|
-
"app_id should be 40 characters without prefix"
|
|
2222
|
-
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
2223
|
-
instance_id: z15.string().refine(
|
|
2224
|
-
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
2225
|
-
"instance_id should be 40 characters without prefix"
|
|
2226
|
-
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional()
|
|
2227
|
-
}).refine(
|
|
2228
|
-
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
2229
|
-
"One of id, uuid, app_id, or instance_id must be provided"
|
|
2230
|
-
).transform((data) => ({
|
|
2231
|
-
cvmId: data.id || data.uuid || data.app_id || data.instance_id,
|
|
2232
|
-
_raw: data
|
|
2233
|
-
}));
|
|
2234
|
-
async function getCvmInfo(client, request, parameters) {
|
|
2235
|
-
const validatedRequest = GetCvmInfoRequestSchema.parse(request);
|
|
2236
|
-
validateActionParameters(parameters);
|
|
2237
|
-
const response = await client.get(`/cvms/${validatedRequest.cvmId}`);
|
|
2238
|
-
if (parameters?.schema === false) {
|
|
2239
|
-
return response;
|
|
2240
|
-
}
|
|
2241
|
-
const schema = parameters?.schema || CvmLegacyDetailSchema;
|
|
2242
|
-
return schema.parse(response);
|
|
2243
|
-
}
|
|
2244
|
-
async function safeGetCvmInfo(client, request, parameters) {
|
|
2245
|
-
const requestValidation = GetCvmInfoRequestSchema.safeParse(request);
|
|
2246
|
-
if (!requestValidation.success) {
|
|
2247
|
-
return requestValidation;
|
|
2248
|
-
}
|
|
2249
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2250
|
-
if (parameterValidationError) {
|
|
2251
|
-
return parameterValidationError;
|
|
2252
|
-
}
|
|
2253
|
-
const httpResult = await client.safeGet(`/cvms/${requestValidation.data.cvmId}`);
|
|
2254
|
-
if (!httpResult.success) {
|
|
2255
|
-
return httpResult;
|
|
2256
|
-
}
|
|
2257
|
-
if (parameters?.schema === false) {
|
|
2258
|
-
return {
|
|
2259
|
-
success: true,
|
|
2260
|
-
data: httpResult.data
|
|
2261
|
-
};
|
|
2262
|
-
}
|
|
2263
|
-
const schema = parameters?.schema || CvmLegacyDetailSchema;
|
|
2264
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
2265
|
-
return validationResult;
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
// src/actions/get_cvm_list.ts
|
|
2269
|
-
import { z as z16 } from "zod";
|
|
2270
|
-
var GetCvmListRequestSchema = z16.object({
|
|
2271
|
-
page: z16.number().int().min(1).optional(),
|
|
2272
|
-
page_size: z16.number().int().min(1).optional(),
|
|
2273
|
-
node_id: z16.number().int().min(1).optional()
|
|
2274
|
-
}).strict();
|
|
2275
|
-
var GetCvmListSchema = z16.object({
|
|
2276
|
-
items: z16.array(CvmInfoSchema),
|
|
2277
|
-
total: z16.number(),
|
|
2278
|
-
page: z16.number(),
|
|
2279
|
-
page_size: z16.number(),
|
|
2280
|
-
pages: z16.number()
|
|
2281
|
-
}).strict();
|
|
2282
|
-
async function getCvmList(client, request, parameters) {
|
|
2283
|
-
const validatedRequest = GetCvmListRequestSchema.parse(request ?? {});
|
|
2284
|
-
validateActionParameters(parameters);
|
|
2285
|
-
const response = await client.get("/cvms/paginated", { params: validatedRequest });
|
|
2286
|
-
if (parameters?.schema === false) {
|
|
2287
|
-
return response;
|
|
2288
|
-
}
|
|
2289
|
-
const schema = parameters?.schema || GetCvmListSchema;
|
|
2290
|
-
return schema.parse(response);
|
|
2291
|
-
}
|
|
2292
|
-
async function safeGetCvmList(client, request, parameters) {
|
|
2293
|
-
const requestValidation = GetCvmListRequestSchema.safeParse(request ?? {});
|
|
2294
|
-
if (!requestValidation.success) {
|
|
2295
|
-
return requestValidation;
|
|
2296
|
-
}
|
|
2297
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2298
|
-
if (parameterValidationError) {
|
|
2299
|
-
return parameterValidationError;
|
|
2300
|
-
}
|
|
2301
|
-
const httpResult = await client.safeGet("/cvms/paginated", { params: requestValidation.data });
|
|
2302
|
-
if (!httpResult.success) {
|
|
2303
|
-
return httpResult;
|
|
2304
|
-
}
|
|
2305
|
-
if (parameters?.schema === false) {
|
|
2306
|
-
return {
|
|
2307
|
-
success: true,
|
|
2308
|
-
data: httpResult.data
|
|
2309
|
-
};
|
|
2310
|
-
}
|
|
2311
|
-
const schema = parameters?.schema || GetCvmListSchema;
|
|
2312
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
2313
|
-
return validationResult;
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
// src/actions/get_kms_info.ts
|
|
2317
|
-
import { z as z17 } from "zod";
|
|
2318
|
-
var GetKmsInfoRequestSchema = z17.object({
|
|
2319
|
-
kms_id: z17.string().min(1, "KMS ID is required")
|
|
2320
|
-
});
|
|
2321
|
-
async function getKmsInfo(client, request, parameters) {
|
|
2322
|
-
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
2323
|
-
validateActionParameters(parameters);
|
|
2324
|
-
const response = await client.get(`/kms/${validatedRequest.kms_id}`);
|
|
2325
|
-
if (parameters?.schema === false) {
|
|
2326
|
-
return response;
|
|
2327
|
-
}
|
|
2328
|
-
const schema = parameters?.schema || KmsInfoSchema;
|
|
2329
|
-
return schema.parse(response);
|
|
2330
|
-
}
|
|
2331
|
-
async function safeGetKmsInfo(client, request, parameters) {
|
|
2332
|
-
const requestValidation = GetKmsInfoRequestSchema.safeParse(request);
|
|
2333
|
-
if (!requestValidation.success) {
|
|
2334
|
-
return requestValidation;
|
|
2335
|
-
}
|
|
2336
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2337
|
-
if (parameterValidationError) {
|
|
2338
|
-
return parameterValidationError;
|
|
2339
|
-
}
|
|
2340
|
-
const httpResult = await client.safeGet(`/kms/${requestValidation.data.kms_id}`);
|
|
2341
|
-
if (!httpResult.success) {
|
|
2342
|
-
return httpResult;
|
|
2343
|
-
}
|
|
2344
|
-
if (parameters?.schema === false) {
|
|
2345
|
-
return { success: true, data: httpResult.data };
|
|
2346
|
-
}
|
|
2347
|
-
const schema = parameters?.schema || KmsInfoSchema;
|
|
2348
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
2349
|
-
return validationResult;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
// src/actions/get_kms_list.ts
|
|
2353
|
-
import { z as z18 } from "zod";
|
|
2354
|
-
var GetKmsListRequestSchema = z18.object({
|
|
2355
|
-
page: z18.number().int().min(1).optional(),
|
|
2356
|
-
page_size: z18.number().int().min(1).optional(),
|
|
2357
|
-
is_onchain: z18.boolean().optional()
|
|
2358
|
-
}).strict();
|
|
2359
|
-
var GetKmsListSchema = z18.object({
|
|
2360
|
-
items: z18.array(KmsInfoSchema),
|
|
2361
|
-
total: z18.number(),
|
|
2362
|
-
page: z18.number(),
|
|
2363
|
-
page_size: z18.number(),
|
|
2364
|
-
pages: z18.number()
|
|
2365
|
-
}).strict();
|
|
2366
|
-
async function getKmsList(client, request, parameters) {
|
|
2367
|
-
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
2368
|
-
validateActionParameters(parameters);
|
|
2369
|
-
const response = await client.get("/kms", { params: validatedRequest });
|
|
2370
|
-
if (parameters?.schema === false) {
|
|
2371
|
-
return response;
|
|
2372
|
-
}
|
|
2373
|
-
const schema = parameters?.schema || GetKmsListSchema;
|
|
2374
|
-
return schema.parse(response);
|
|
2375
|
-
}
|
|
2376
|
-
async function safeGetKmsList(client, request, parameters) {
|
|
2377
|
-
const requestValidation = GetKmsListRequestSchema.safeParse(request ?? {});
|
|
2378
|
-
if (!requestValidation.success) {
|
|
2379
|
-
return requestValidation;
|
|
2380
|
-
}
|
|
2381
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2382
|
-
if (parameterValidationError) {
|
|
2383
|
-
return parameterValidationError;
|
|
2384
|
-
}
|
|
2385
|
-
const httpResult = await client.safeGet("/kms", { params: requestValidation.data });
|
|
2386
|
-
if (!httpResult.success) {
|
|
2387
|
-
return httpResult;
|
|
2388
|
-
}
|
|
2389
|
-
if (parameters?.schema === false) {
|
|
2390
|
-
return {
|
|
2391
|
-
success: true,
|
|
2392
|
-
data: httpResult.data
|
|
2393
|
-
};
|
|
2394
|
-
}
|
|
2395
|
-
const schema = parameters?.schema || GetKmsListSchema;
|
|
2396
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
2397
|
-
return validationResult;
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
// src/actions/workspaces/list_workspaces.ts
|
|
2401
|
-
import { z as z19 } from "zod";
|
|
2402
|
-
var WorkspaceResponseSchema = z19.object({
|
|
2403
|
-
id: z19.string(),
|
|
2404
|
-
name: z19.string(),
|
|
2405
|
-
slug: z19.string().nullable(),
|
|
2406
|
-
tier: z19.string(),
|
|
2407
|
-
role: z19.string(),
|
|
2408
|
-
created_at: z19.string()
|
|
2409
|
-
}).passthrough();
|
|
2410
|
-
var PaginationMetadataSchema = z19.object({
|
|
2411
|
-
has_more: z19.boolean(),
|
|
2412
|
-
next_cursor: z19.string().nullable(),
|
|
2413
|
-
total: z19.number().nullable()
|
|
2414
|
-
}).passthrough();
|
|
2415
|
-
var ListWorkspacesSchema = z19.object({
|
|
2416
|
-
data: z19.array(WorkspaceResponseSchema),
|
|
2417
|
-
pagination: PaginationMetadataSchema
|
|
2418
|
-
}).passthrough();
|
|
2419
|
-
async function listWorkspaces(client, parameters) {
|
|
2420
|
-
validateActionParameters(parameters);
|
|
2421
|
-
const queryParams = new URLSearchParams();
|
|
2422
|
-
if (parameters?.cursor) queryParams.append("cursor", parameters.cursor);
|
|
2423
|
-
if (parameters?.limit) queryParams.append("limit", parameters.limit.toString());
|
|
2424
|
-
const url = queryParams.toString() ? `/workspaces?${queryParams.toString()}` : "/workspaces";
|
|
2425
|
-
const response = await client.get(url);
|
|
2426
|
-
if (parameters?.schema === false) {
|
|
2427
|
-
return response;
|
|
2428
|
-
}
|
|
2429
|
-
const schema = parameters?.schema || ListWorkspacesSchema;
|
|
2430
|
-
return schema.parse(response);
|
|
2431
|
-
}
|
|
2432
|
-
async function safeListWorkspaces(client, parameters) {
|
|
2433
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2434
|
-
if (parameterValidationError) {
|
|
2435
|
-
return parameterValidationError;
|
|
2436
|
-
}
|
|
2437
|
-
const queryParams = new URLSearchParams();
|
|
2438
|
-
if (parameters?.cursor) queryParams.append("cursor", parameters.cursor);
|
|
2439
|
-
if (parameters?.limit) queryParams.append("limit", parameters.limit.toString());
|
|
2440
|
-
const url = queryParams.toString() ? `/workspaces?${queryParams.toString()}` : "/workspaces";
|
|
2441
|
-
const httpResult = await client.safeGet(url);
|
|
2442
|
-
if (!httpResult.success) {
|
|
2443
|
-
return httpResult;
|
|
2444
|
-
}
|
|
2445
|
-
if (parameters?.schema === false) {
|
|
2446
|
-
return { success: true, data: httpResult.data };
|
|
2447
|
-
}
|
|
2448
|
-
const schema = parameters?.schema || ListWorkspacesSchema;
|
|
2449
|
-
return schema.safeParse(httpResult.data);
|
|
2450
|
-
}
|
|
2451
|
-
|
|
2452
|
-
// src/actions/workspaces/get_workspace.ts
|
|
2453
|
-
async function getWorkspace(client, teamSlug, parameters) {
|
|
2454
|
-
validateActionParameters(parameters);
|
|
2455
|
-
const response = await client.get(`/workspaces/${teamSlug}`);
|
|
2456
|
-
if (parameters?.schema === false) {
|
|
2457
|
-
return response;
|
|
2458
|
-
}
|
|
2459
|
-
const schema = parameters?.schema || WorkspaceResponseSchema;
|
|
2460
|
-
return schema.parse(response);
|
|
2461
|
-
}
|
|
2462
|
-
async function safeGetWorkspace(client, teamSlug, parameters) {
|
|
2463
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2464
|
-
if (parameterValidationError) {
|
|
2465
|
-
return parameterValidationError;
|
|
2466
|
-
}
|
|
2467
|
-
const httpResult = await client.safeGet(`/workspaces/${teamSlug}`);
|
|
2468
|
-
if (!httpResult.success) {
|
|
2469
|
-
return httpResult;
|
|
2470
|
-
}
|
|
2471
|
-
if (parameters?.schema === false) {
|
|
2472
|
-
return { success: true, data: httpResult.data };
|
|
2473
|
-
}
|
|
2474
|
-
const schema = parameters?.schema || WorkspaceResponseSchema;
|
|
2475
|
-
return schema.safeParse(httpResult.data);
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
|
-
// src/actions/list-instance-types.ts
|
|
2479
|
-
import { z as z20 } from "zod";
|
|
2480
|
-
var ListInstanceTypesRequestSchema = z20.object({
|
|
2481
|
-
page: z20.number().int().min(1).optional().default(1),
|
|
2482
|
-
page_size: z20.number().int().min(1).max(1e3).optional().default(100)
|
|
2483
|
-
}).strict();
|
|
2484
|
-
var InstanceTypeSchema = z20.object({
|
|
2485
|
-
id: z20.string(),
|
|
2486
|
-
name: z20.string(),
|
|
2487
|
-
description: z20.string(),
|
|
2488
|
-
vcpu: z20.number(),
|
|
2489
|
-
memory_mb: z20.number(),
|
|
2490
|
-
hourly_rate: z20.string(),
|
|
2491
|
-
requires_gpu: z20.boolean(),
|
|
2492
|
-
public: z20.boolean(),
|
|
2493
|
-
enabled: z20.boolean()
|
|
2494
|
-
}).passthrough();
|
|
2495
|
-
var PaginatedInstanceTypesSchema = z20.object({
|
|
2496
|
-
items: z20.array(InstanceTypeSchema),
|
|
2497
|
-
total: z20.number(),
|
|
2498
|
-
page: z20.number(),
|
|
2499
|
-
page_size: z20.number(),
|
|
2500
|
-
pages: z20.number()
|
|
2501
|
-
}).strict();
|
|
2502
|
-
async function listInstanceTypes(client, request, parameters) {
|
|
2503
|
-
const validatedRequest = ListInstanceTypesRequestSchema.parse(request ?? {});
|
|
2504
|
-
validateActionParameters(parameters);
|
|
2505
|
-
const queryParams = new URLSearchParams();
|
|
2506
|
-
queryParams.append("page", validatedRequest.page.toString());
|
|
2507
|
-
queryParams.append("page_size", validatedRequest.page_size.toString());
|
|
2508
|
-
const response = await client.get(`/api/instance-types?${queryParams.toString()}`);
|
|
2509
|
-
if (parameters?.schema === false) {
|
|
2510
|
-
return response;
|
|
2511
|
-
}
|
|
2512
|
-
const schema = parameters?.schema || PaginatedInstanceTypesSchema;
|
|
2513
|
-
return schema.parse(response);
|
|
2514
|
-
}
|
|
2515
|
-
async function safeListInstanceTypes(client, request, parameters) {
|
|
2516
|
-
const requestValidation = ListInstanceTypesRequestSchema.safeParse(request ?? {});
|
|
2517
|
-
if (!requestValidation.success) {
|
|
2518
|
-
return requestValidation;
|
|
2519
|
-
}
|
|
2520
|
-
const parameterValidationError = safeValidateActionParameters(parameters);
|
|
2521
|
-
if (parameterValidationError) {
|
|
2522
|
-
return parameterValidationError;
|
|
2523
|
-
}
|
|
2524
|
-
const queryParams = new URLSearchParams();
|
|
2525
|
-
queryParams.append("page", requestValidation.data.page.toString());
|
|
2526
|
-
queryParams.append("page_size", requestValidation.data.page_size.toString());
|
|
2527
|
-
const httpResult = await client.safeGet(`/api/instance-types?${queryParams.toString()}`);
|
|
2528
|
-
if (!httpResult.success) {
|
|
2529
|
-
return httpResult;
|
|
2530
|
-
}
|
|
2531
|
-
if (parameters?.schema === false) {
|
|
2532
|
-
return {
|
|
2533
|
-
success: true,
|
|
2534
|
-
data: httpResult.data
|
|
2535
|
-
};
|
|
2536
|
-
}
|
|
2537
|
-
const schema = parameters?.schema || PaginatedInstanceTypesSchema;
|
|
2538
|
-
const validationResult = schema.safeParse(httpResult.data);
|
|
2539
|
-
return validationResult;
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
1317
|
// src/parse_dotenv.ts
|
|
2543
1318
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
2544
1319
|
function parseEnv(input) {
|
|
@@ -2591,11 +1366,18 @@ export {
|
|
|
2591
1366
|
CvmNodeSchema,
|
|
2592
1367
|
DeployAppAuthRequestSchema,
|
|
2593
1368
|
DeployAppAuthSchema,
|
|
1369
|
+
GetAppEnvEncryptPubKeyRequestSchema,
|
|
2594
1370
|
GetAppEnvEncryptPubKeySchema,
|
|
1371
|
+
GetCvmComposeFileRequestSchema,
|
|
1372
|
+
GetCvmInfoRequestSchema,
|
|
1373
|
+
GetCvmListRequestSchema,
|
|
2595
1374
|
GetCvmListSchema,
|
|
1375
|
+
GetKmsInfoRequestSchema,
|
|
1376
|
+
GetKmsListRequestSchema,
|
|
2596
1377
|
GetKmsListSchema,
|
|
2597
1378
|
InstanceTypeSchema,
|
|
2598
1379
|
KmsInfoSchema,
|
|
1380
|
+
ListInstanceTypesRequestSchema,
|
|
2599
1381
|
ListWorkspacesSchema,
|
|
2600
1382
|
ManagedUserSchema,
|
|
2601
1383
|
NetworkError,
|
|
@@ -2624,6 +1406,8 @@ export {
|
|
|
2624
1406
|
createClientsFromPrivateKey,
|
|
2625
1407
|
createNetworkClients,
|
|
2626
1408
|
createTransactionTracker,
|
|
1409
|
+
defineAction,
|
|
1410
|
+
defineSimpleAction,
|
|
2627
1411
|
deployAppAuth,
|
|
2628
1412
|
encryptEnvVars2 as encryptEnvVars,
|
|
2629
1413
|
estimateTransactionGas,
|