@hashgraphonline/standards-sdk 0.1.166 → 0.1.167
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/es/standards-sdk.es116.js +1 -1
- package/dist/es/standards-sdk.es123.js +5 -5
- package/dist/es/standards-sdk.es133.js +1 -1
- package/dist/es/standards-sdk.es134.js +1 -1
- package/dist/es/standards-sdk.es135.js +5 -5
- package/dist/es/standards-sdk.es137.js +1 -1
- package/dist/es/standards-sdk.es144.js +1 -1
- package/dist/es/standards-sdk.es161.js +545 -68
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +160 -538
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +289 -139
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +298 -274
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +369 -262
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +194 -316
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +64 -319
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +63 -66
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,553 +1,175 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
async function listSkills(client, params = {}) {
|
|
13
|
-
const query = new URLSearchParams();
|
|
14
|
-
if (params.name) {
|
|
15
|
-
query.set("name", params.name);
|
|
16
|
-
}
|
|
17
|
-
if (params.version) {
|
|
18
|
-
query.set("version", params.version);
|
|
19
|
-
}
|
|
20
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
21
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
22
|
-
}
|
|
23
|
-
if (params.cursor) {
|
|
24
|
-
query.set("cursor", params.cursor);
|
|
25
|
-
}
|
|
26
|
-
if (typeof params.includeFiles === "boolean") {
|
|
27
|
-
query.set("includeFiles", params.includeFiles ? "true" : "false");
|
|
28
|
-
}
|
|
29
|
-
if (params.accountId) {
|
|
30
|
-
query.set("accountId", params.accountId);
|
|
31
|
-
}
|
|
32
|
-
if (params.q) {
|
|
33
|
-
query.set("q", params.q);
|
|
34
|
-
}
|
|
35
|
-
if (params.tag) {
|
|
36
|
-
query.set("tag", params.tag);
|
|
37
|
-
}
|
|
38
|
-
if (params.category) {
|
|
39
|
-
query.set("category", params.category);
|
|
40
|
-
}
|
|
41
|
-
if (typeof params.featured === "boolean") {
|
|
42
|
-
query.set("featured", params.featured ? "true" : "false");
|
|
43
|
-
}
|
|
44
|
-
if (typeof params.verified === "boolean") {
|
|
45
|
-
query.set("verified", params.verified ? "true" : "false");
|
|
46
|
-
}
|
|
47
|
-
if (params.view) {
|
|
48
|
-
query.set("view", params.view);
|
|
49
|
-
}
|
|
50
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
51
|
-
const raw = await client.requestJson(`/skills${suffix}`, {
|
|
52
|
-
method: "GET"
|
|
53
|
-
});
|
|
54
|
-
return client.parseWithSchema(
|
|
55
|
-
raw,
|
|
56
|
-
skillRegistryListResponseSchema,
|
|
57
|
-
"skill registry list response"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
async function getSkillSecurityBreakdown(client, params) {
|
|
61
|
-
const normalizedJobId = params.jobId.trim();
|
|
62
|
-
if (!normalizedJobId) {
|
|
63
|
-
throw new Error("jobId is required");
|
|
64
|
-
}
|
|
65
|
-
const raw = await client.requestJson(
|
|
66
|
-
`/skills/${encodeURIComponent(normalizedJobId)}/security-breakdown`,
|
|
67
|
-
{ method: "GET" }
|
|
68
|
-
);
|
|
69
|
-
return client.parseWithSchema(
|
|
70
|
-
raw,
|
|
71
|
-
skillSecurityBreakdownResponseSchema,
|
|
72
|
-
"skill security breakdown response"
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
async function getSkillsCatalog(client, params = {}) {
|
|
76
|
-
const query = new URLSearchParams();
|
|
77
|
-
if (params.q) {
|
|
78
|
-
query.set("q", params.q);
|
|
79
|
-
}
|
|
80
|
-
if (params.category) {
|
|
81
|
-
query.set("category", params.category);
|
|
82
|
-
}
|
|
83
|
-
params.tags?.forEach((tag) => {
|
|
84
|
-
if (tag.trim()) {
|
|
85
|
-
query.append("tag", tag.trim());
|
|
1
|
+
import { Long, AccountId } from "@hashgraph/sdk";
|
|
2
|
+
import { parseKey } from "./standards-sdk.es167.js";
|
|
3
|
+
import { Buffer } from "buffer";
|
|
4
|
+
class HCSParser {
|
|
5
|
+
static parseConsensusCreateTopic(body) {
|
|
6
|
+
if (!body) return void 0;
|
|
7
|
+
const data = {};
|
|
8
|
+
if (body.memo) {
|
|
9
|
+
data.memo = body.memo;
|
|
86
10
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
if (params.channel) {
|
|
95
|
-
query.set("channel", params.channel);
|
|
96
|
-
}
|
|
97
|
-
if (params.sortBy) {
|
|
98
|
-
query.set("sortBy", params.sortBy);
|
|
99
|
-
}
|
|
100
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
101
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
102
|
-
}
|
|
103
|
-
if (params.cursor) {
|
|
104
|
-
query.set("cursor", params.cursor);
|
|
105
|
-
}
|
|
106
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
107
|
-
const raw = await client.requestJson(`/skills/catalog${suffix}`, {
|
|
108
|
-
method: "GET"
|
|
109
|
-
});
|
|
110
|
-
return client.parseWithSchema(
|
|
111
|
-
raw,
|
|
112
|
-
skillCatalogResponseSchema,
|
|
113
|
-
"skill catalog response"
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
async function listSkillVersions(client, params) {
|
|
117
|
-
const normalizedName = params.name.trim();
|
|
118
|
-
if (!normalizedName) {
|
|
119
|
-
throw new Error("name is required");
|
|
120
|
-
}
|
|
121
|
-
const query = new URLSearchParams();
|
|
122
|
-
query.set("name", normalizedName);
|
|
123
|
-
const raw = await client.requestJson(
|
|
124
|
-
`/skills/versions?${query.toString()}`,
|
|
125
|
-
{ method: "GET" }
|
|
126
|
-
);
|
|
127
|
-
return client.parseWithSchema(
|
|
128
|
-
raw,
|
|
129
|
-
skillRegistryVersionsResponseSchema,
|
|
130
|
-
"skill registry versions response"
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
async function listMySkills(client, params = {}) {
|
|
134
|
-
const query = new URLSearchParams();
|
|
135
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
136
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
137
|
-
}
|
|
138
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
139
|
-
const raw = await client.requestJson(`/skills/mine${suffix}`, {
|
|
140
|
-
method: "GET"
|
|
141
|
-
});
|
|
142
|
-
return client.parseWithSchema(
|
|
143
|
-
raw,
|
|
144
|
-
skillRegistryMineResponseSchema,
|
|
145
|
-
"skill registry mine response"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
async function getMySkillsList(client, params = {}) {
|
|
149
|
-
const query = new URLSearchParams();
|
|
150
|
-
if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
|
|
151
|
-
query.set("limit", String(Math.trunc(params.limit)));
|
|
152
|
-
}
|
|
153
|
-
if (params.cursor) {
|
|
154
|
-
query.set("cursor", params.cursor);
|
|
155
|
-
}
|
|
156
|
-
if (params.accountId) {
|
|
157
|
-
query.set("accountId", params.accountId);
|
|
158
|
-
}
|
|
159
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
160
|
-
const raw = await client.requestJson(`/skills/my-list${suffix}`, {
|
|
161
|
-
method: "GET"
|
|
162
|
-
});
|
|
163
|
-
return client.parseWithSchema(
|
|
164
|
-
raw,
|
|
165
|
-
skillRegistryMyListResponseSchema,
|
|
166
|
-
"skill registry my list response"
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
async function quoteSkillPublish(client, payload) {
|
|
170
|
-
const raw = await client.requestJson("/skills/quote", {
|
|
171
|
-
method: "POST",
|
|
172
|
-
body: payload,
|
|
173
|
-
headers: { "content-type": "application/json" }
|
|
174
|
-
});
|
|
175
|
-
return client.parseWithSchema(
|
|
176
|
-
raw,
|
|
177
|
-
skillRegistryQuoteResponseSchema,
|
|
178
|
-
"skill registry quote response"
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
async function publishSkill(client, payload) {
|
|
182
|
-
const raw = await client.requestJson("/skills/publish", {
|
|
183
|
-
method: "POST",
|
|
184
|
-
body: payload,
|
|
185
|
-
headers: { "content-type": "application/json" }
|
|
186
|
-
});
|
|
187
|
-
return client.parseWithSchema(
|
|
188
|
-
raw,
|
|
189
|
-
skillRegistryPublishResponseSchema,
|
|
190
|
-
"skill registry publish response"
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
async function getSkillPublishJob(client, jobId, params = {}) {
|
|
194
|
-
const normalized = jobId.trim();
|
|
195
|
-
if (!normalized) {
|
|
196
|
-
throw new Error("jobId is required");
|
|
197
|
-
}
|
|
198
|
-
const query = new URLSearchParams();
|
|
199
|
-
if (params.accountId) {
|
|
200
|
-
query.set("accountId", params.accountId);
|
|
201
|
-
}
|
|
202
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
203
|
-
const raw = await client.requestJson(
|
|
204
|
-
`/skills/jobs/${encodeURIComponent(normalized)}${suffix}`,
|
|
205
|
-
{ method: "GET" }
|
|
206
|
-
);
|
|
207
|
-
return client.parseWithSchema(
|
|
208
|
-
raw,
|
|
209
|
-
skillRegistryJobStatusResponseSchema,
|
|
210
|
-
"skill registry job status response"
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
async function getSkillOwnership(client, params) {
|
|
214
|
-
const normalizedName = params.name.trim();
|
|
215
|
-
if (!normalizedName) {
|
|
216
|
-
throw new Error("name is required");
|
|
217
|
-
}
|
|
218
|
-
const query = new URLSearchParams();
|
|
219
|
-
query.set("name", normalizedName);
|
|
220
|
-
if (params.accountId) {
|
|
221
|
-
query.set("accountId", params.accountId);
|
|
222
|
-
}
|
|
223
|
-
const raw = await client.requestJson(
|
|
224
|
-
`/skills/ownership?${query.toString()}`,
|
|
225
|
-
{
|
|
226
|
-
method: "GET"
|
|
11
|
+
data.adminKey = parseKey(body.adminKey);
|
|
12
|
+
data.submitKey = parseKey(body.submitKey);
|
|
13
|
+
if (body.autoRenewPeriod?.seconds) {
|
|
14
|
+
data.autoRenewPeriod = Long.fromValue(
|
|
15
|
+
body.autoRenewPeriod.seconds
|
|
16
|
+
).toString();
|
|
227
17
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const normalizedName = params.name.trim();
|
|
237
|
-
if (!normalizedName) {
|
|
238
|
-
throw new Error("name is required");
|
|
239
|
-
}
|
|
240
|
-
const query = new URLSearchParams();
|
|
241
|
-
query.set("name", normalizedName);
|
|
242
|
-
const raw = await client.requestJson(
|
|
243
|
-
`/skills/recommended?${query.toString()}`,
|
|
244
|
-
{ method: "GET" }
|
|
245
|
-
);
|
|
246
|
-
return client.parseWithSchema(
|
|
247
|
-
raw,
|
|
248
|
-
skillRecommendedVersionResponseSchema,
|
|
249
|
-
"skill recommended version response"
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
async function setRecommendedSkillVersion(client, payload) {
|
|
253
|
-
const normalizedName = payload.name.trim();
|
|
254
|
-
const normalizedVersion = payload.version.trim();
|
|
255
|
-
if (!normalizedName) {
|
|
256
|
-
throw new Error("name is required");
|
|
257
|
-
}
|
|
258
|
-
if (!normalizedVersion) {
|
|
259
|
-
throw new Error("version is required");
|
|
260
|
-
}
|
|
261
|
-
const raw = await client.requestJson("/skills/recommended", {
|
|
262
|
-
method: "POST",
|
|
263
|
-
body: {
|
|
264
|
-
name: normalizedName,
|
|
265
|
-
version: normalizedVersion
|
|
266
|
-
},
|
|
267
|
-
headers: { "content-type": "application/json" }
|
|
268
|
-
});
|
|
269
|
-
return client.parseWithSchema(
|
|
270
|
-
raw,
|
|
271
|
-
skillRecommendedVersionResponseSchema,
|
|
272
|
-
"skill recommended version response"
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
async function getSkillDeprecations(client, params) {
|
|
276
|
-
const normalizedName = params.name.trim();
|
|
277
|
-
if (!normalizedName) {
|
|
278
|
-
throw new Error("name is required");
|
|
279
|
-
}
|
|
280
|
-
const query = new URLSearchParams();
|
|
281
|
-
query.set("name", normalizedName);
|
|
282
|
-
const raw = await client.requestJson(
|
|
283
|
-
`/skills/deprecations?${query.toString()}`,
|
|
284
|
-
{ method: "GET" }
|
|
285
|
-
);
|
|
286
|
-
return client.parseWithSchema(
|
|
287
|
-
raw,
|
|
288
|
-
skillDeprecationsResponseSchema,
|
|
289
|
-
"skill deprecations response"
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
async function setSkillDeprecation(client, payload) {
|
|
293
|
-
const normalizedName = payload.name.trim();
|
|
294
|
-
if (!normalizedName) {
|
|
295
|
-
throw new Error("name is required");
|
|
296
|
-
}
|
|
297
|
-
const version = payload.version?.trim();
|
|
298
|
-
const reason = payload.reason.trim();
|
|
299
|
-
if (!reason) {
|
|
300
|
-
throw new Error("reason is required");
|
|
301
|
-
}
|
|
302
|
-
const replacementRef = payload.replacementRef?.trim();
|
|
303
|
-
const raw = await client.requestJson("/skills/deprecate", {
|
|
304
|
-
method: "POST",
|
|
305
|
-
body: {
|
|
306
|
-
name: normalizedName,
|
|
307
|
-
version,
|
|
308
|
-
reason,
|
|
309
|
-
replacementRef
|
|
310
|
-
},
|
|
311
|
-
headers: { "content-type": "application/json" }
|
|
312
|
-
});
|
|
313
|
-
return client.parseWithSchema(
|
|
314
|
-
raw,
|
|
315
|
-
skillDeprecationRecordSchema,
|
|
316
|
-
"skill deprecation response"
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
async function getSkillBadge(client, params) {
|
|
320
|
-
const normalizedName = params.name.trim();
|
|
321
|
-
if (!normalizedName) {
|
|
322
|
-
throw new Error("name is required");
|
|
323
|
-
}
|
|
324
|
-
const query = new URLSearchParams();
|
|
325
|
-
query.set("name", normalizedName);
|
|
326
|
-
if (params.metric) {
|
|
327
|
-
query.set("metric", params.metric);
|
|
328
|
-
}
|
|
329
|
-
if (params.label?.trim()) {
|
|
330
|
-
query.set("label", params.label.trim());
|
|
331
|
-
}
|
|
332
|
-
if (params.style) {
|
|
333
|
-
query.set("style", params.style);
|
|
334
|
-
}
|
|
335
|
-
const raw = await client.requestJson(
|
|
336
|
-
`/skills/badge?${query.toString()}`,
|
|
337
|
-
{ method: "GET" }
|
|
338
|
-
);
|
|
339
|
-
return client.parseWithSchema(
|
|
340
|
-
raw,
|
|
341
|
-
skillBadgeResponseSchema,
|
|
342
|
-
"skill badge response"
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
async function listSkillTags(client) {
|
|
346
|
-
const raw = await client.requestJson("/skills/tags", {
|
|
347
|
-
method: "GET"
|
|
348
|
-
});
|
|
349
|
-
return client.parseWithSchema(
|
|
350
|
-
raw,
|
|
351
|
-
skillRegistryTagsResponseSchema,
|
|
352
|
-
"skill tags response"
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
async function listSkillCategories(client) {
|
|
356
|
-
const raw = await client.requestJson("/skills/categories", {
|
|
357
|
-
method: "GET"
|
|
358
|
-
});
|
|
359
|
-
return client.parseWithSchema(
|
|
360
|
-
raw,
|
|
361
|
-
skillRegistryCategoriesResponseSchema,
|
|
362
|
-
"skill categories response"
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
async function resolveSkillMarkdown(client, skillRef) {
|
|
366
|
-
const normalizedSkillRef = skillRef.trim();
|
|
367
|
-
if (!normalizedSkillRef) {
|
|
368
|
-
throw new Error("skillRef is required");
|
|
18
|
+
if (body.autoRenewAccount) {
|
|
19
|
+
data.autoRenewAccountId = new AccountId(
|
|
20
|
+
body.autoRenewAccount.shardNum ?? 0,
|
|
21
|
+
body.autoRenewAccount.realmNum ?? 0,
|
|
22
|
+
body.autoRenewAccount.accountNum ?? 0
|
|
23
|
+
).toString();
|
|
24
|
+
}
|
|
25
|
+
return data;
|
|
369
26
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
{
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
27
|
+
static parseConsensusSubmitMessage(body) {
|
|
28
|
+
if (!body) return void 0;
|
|
29
|
+
const data = {};
|
|
30
|
+
if (body.topicID) {
|
|
31
|
+
data.topicId = `${body.topicID.shardNum ?? 0}.${body.topicID.realmNum ?? 0}.${body.topicID.topicNum ?? 0}`;
|
|
32
|
+
}
|
|
33
|
+
if (body.message?.length > 0) {
|
|
34
|
+
const messageBuffer = Buffer.from(body.message);
|
|
35
|
+
const utf8String = messageBuffer.toString("utf8");
|
|
36
|
+
if (/[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(utf8String) || utf8String.includes("�")) {
|
|
37
|
+
data.message = messageBuffer.toString("base64");
|
|
38
|
+
data.messageEncoding = "base64";
|
|
39
|
+
} else {
|
|
40
|
+
data.message = utf8String;
|
|
41
|
+
data.messageEncoding = "utf8";
|
|
376
42
|
}
|
|
377
43
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
44
|
+
if (body.chunkInfo) {
|
|
45
|
+
if (body.chunkInfo.initialTransactionID) {
|
|
46
|
+
const txId = body.chunkInfo.initialTransactionID.accountID;
|
|
47
|
+
const taValidStart = body.chunkInfo.initialTransactionID.transactionValidStart;
|
|
48
|
+
if (txId && taValidStart) {
|
|
49
|
+
data.chunkInfoInitialTransactionID = `${txId.shardNum ?? 0}.${txId.realmNum ?? 0}.${txId.accountNum ?? 0}@${taValidStart.seconds ?? 0}.${taValidStart.nanos ?? 0}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (body.chunkInfo.number !== void 0 && body.chunkInfo.number !== null) {
|
|
53
|
+
data.chunkInfoNumber = body.chunkInfo.number;
|
|
54
|
+
}
|
|
55
|
+
if (body.chunkInfo.total !== void 0 && body.chunkInfo.total !== null) {
|
|
56
|
+
data.chunkInfoTotal = body.chunkInfo.total;
|
|
57
|
+
}
|
|
390
58
|
}
|
|
391
|
-
|
|
392
|
-
return client.parseWithSchema(
|
|
393
|
-
raw,
|
|
394
|
-
skillResolverManifestResponseSchema,
|
|
395
|
-
"skill resolver manifest response"
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
async function getSkillVoteStatus(client, params) {
|
|
399
|
-
const normalizedName = params.name.trim();
|
|
400
|
-
if (!normalizedName) {
|
|
401
|
-
throw new Error("name is required");
|
|
59
|
+
return data;
|
|
402
60
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
);
|
|
409
|
-
return client.parseWithSchema(
|
|
410
|
-
raw,
|
|
411
|
-
skillRegistryVoteStatusResponseSchema,
|
|
412
|
-
"skill registry vote status response"
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
async function setSkillVote(client, payload) {
|
|
416
|
-
const normalizedName = payload.name.trim();
|
|
417
|
-
if (!normalizedName) {
|
|
418
|
-
throw new Error("name is required");
|
|
419
|
-
}
|
|
420
|
-
const raw = await client.requestJson("/skills/vote", {
|
|
421
|
-
method: "POST",
|
|
422
|
-
body: { name: normalizedName, upvoted: payload.upvoted },
|
|
423
|
-
headers: { "content-type": "application/json" }
|
|
424
|
-
});
|
|
425
|
-
return client.parseWithSchema(
|
|
426
|
-
raw,
|
|
427
|
-
skillRegistryVoteStatusResponseSchema,
|
|
428
|
-
"skill registry vote status response"
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
async function requestSkillVerification(client, payload) {
|
|
432
|
-
const normalizedName = payload.name.trim();
|
|
433
|
-
if (!normalizedName) {
|
|
434
|
-
throw new Error("name is required");
|
|
435
|
-
}
|
|
436
|
-
const raw = await client.requestJson(
|
|
437
|
-
"/skills/verification/request",
|
|
438
|
-
{
|
|
439
|
-
method: "POST",
|
|
440
|
-
body: {
|
|
441
|
-
name: normalizedName,
|
|
442
|
-
version: payload.version,
|
|
443
|
-
tier: payload.tier
|
|
444
|
-
},
|
|
445
|
-
headers: { "content-type": "application/json" }
|
|
61
|
+
static parseConsensusUpdateTopic(body) {
|
|
62
|
+
if (!body) return void 0;
|
|
63
|
+
const data = {};
|
|
64
|
+
if (body.topicID) {
|
|
65
|
+
data.topicId = `${body.topicID.shardNum}.${body.topicID.realmNum}.${body.topicID.topicNum}`;
|
|
446
66
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
raw,
|
|
450
|
-
skillVerificationRequestCreateResponseSchema,
|
|
451
|
-
"skill verification request create response"
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
async function getSkillVerificationStatus(client, params) {
|
|
455
|
-
const normalizedName = params.name.trim();
|
|
456
|
-
if (!normalizedName) {
|
|
457
|
-
throw new Error("name is required");
|
|
458
|
-
}
|
|
459
|
-
const query = new URLSearchParams();
|
|
460
|
-
query.set("name", normalizedName);
|
|
461
|
-
if (params.version) {
|
|
462
|
-
query.set("version", params.version);
|
|
463
|
-
}
|
|
464
|
-
const raw = await client.requestJson(
|
|
465
|
-
`/skills/verification/status?${query.toString()}`,
|
|
466
|
-
{ method: "GET" }
|
|
467
|
-
);
|
|
468
|
-
return client.parseWithSchema(
|
|
469
|
-
raw,
|
|
470
|
-
skillVerificationStatusResponseSchema,
|
|
471
|
-
"skill verification status response"
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
async function createSkillDomainProofChallenge(client, payload) {
|
|
475
|
-
const normalizedName = payload.name.trim();
|
|
476
|
-
if (!normalizedName) {
|
|
477
|
-
throw new Error("name is required");
|
|
478
|
-
}
|
|
479
|
-
const raw = await client.requestJson(
|
|
480
|
-
"/skills/verification/domain/challenge",
|
|
481
|
-
{
|
|
482
|
-
method: "POST",
|
|
483
|
-
body: {
|
|
484
|
-
name: normalizedName,
|
|
485
|
-
version: payload.version,
|
|
486
|
-
domain: payload.domain
|
|
487
|
-
},
|
|
488
|
-
headers: { "content-type": "application/json" }
|
|
67
|
+
if (body.memo?.value !== void 0) {
|
|
68
|
+
data.memo = body.memo.value;
|
|
489
69
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
70
|
+
if (body.adminKey === null) {
|
|
71
|
+
data.clearAdminKey = true;
|
|
72
|
+
data.adminKey = void 0;
|
|
73
|
+
} else if (body.adminKey) {
|
|
74
|
+
data.adminKey = parseKey(body.adminKey);
|
|
75
|
+
} else {
|
|
76
|
+
data.adminKey = void 0;
|
|
77
|
+
}
|
|
78
|
+
if (body.submitKey === null) {
|
|
79
|
+
data.clearSubmitKey = true;
|
|
80
|
+
data.submitKey = void 0;
|
|
81
|
+
} else if (body.submitKey) {
|
|
82
|
+
data.submitKey = parseKey(body.submitKey);
|
|
83
|
+
} else {
|
|
84
|
+
data.submitKey = void 0;
|
|
85
|
+
}
|
|
86
|
+
if (body.autoRenewPeriod?.seconds) {
|
|
87
|
+
data.autoRenewPeriod = Long.fromValue(
|
|
88
|
+
body.autoRenewPeriod.seconds
|
|
89
|
+
).toString();
|
|
90
|
+
}
|
|
91
|
+
if (body.autoRenewAccount) {
|
|
92
|
+
data.autoRenewAccountId = new AccountId(
|
|
93
|
+
body.autoRenewAccount.shardNum ?? 0,
|
|
94
|
+
body.autoRenewAccount.realmNum ?? 0,
|
|
95
|
+
body.autoRenewAccount.accountNum ?? 0
|
|
96
|
+
).toString();
|
|
97
|
+
}
|
|
98
|
+
return data;
|
|
505
99
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
{
|
|
509
|
-
|
|
510
|
-
body
|
|
511
|
-
name: normalizedName,
|
|
512
|
-
version: payload.version,
|
|
513
|
-
domain: payload.domain,
|
|
514
|
-
challengeToken
|
|
515
|
-
},
|
|
516
|
-
headers: { "content-type": "application/json" }
|
|
100
|
+
static parseConsensusDeleteTopic(body) {
|
|
101
|
+
if (!body) return void 0;
|
|
102
|
+
const data = {};
|
|
103
|
+
if (body.topicID) {
|
|
104
|
+
data.topicId = `${body.topicID.shardNum}.${body.topicID.realmNum ?? 0}.${body.topicID.topicNum ?? 0}`;
|
|
517
105
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Parse HCS transaction from Transaction object with comprehensive extraction
|
|
110
|
+
* This is the unified entry point that handles both protobuf and internal field extraction
|
|
111
|
+
*/
|
|
112
|
+
static parseFromTransactionObject(transaction) {
|
|
113
|
+
try {
|
|
114
|
+
const transactionBody = transaction._transactionBody;
|
|
115
|
+
if (!transactionBody) {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
if (transactionBody.consensusCreateTopic) {
|
|
119
|
+
const consensusCreateTopic = this.parseConsensusCreateTopic(
|
|
120
|
+
transactionBody.consensusCreateTopic
|
|
121
|
+
);
|
|
122
|
+
if (consensusCreateTopic) {
|
|
123
|
+
return {
|
|
124
|
+
type: "TOPICCREATE",
|
|
125
|
+
humanReadableType: "Topic Create",
|
|
126
|
+
consensusCreateTopic
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (transactionBody.consensusSubmitMessage) {
|
|
131
|
+
const consensusSubmitMessage = this.parseConsensusSubmitMessage(
|
|
132
|
+
transactionBody.consensusSubmitMessage
|
|
133
|
+
);
|
|
134
|
+
if (consensusSubmitMessage) {
|
|
135
|
+
return {
|
|
136
|
+
type: "CONSENSUSSUBMITMESSAGE",
|
|
137
|
+
humanReadableType: "Submit Message",
|
|
138
|
+
consensusSubmitMessage
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (transactionBody.consensusUpdateTopic) {
|
|
143
|
+
const consensusUpdateTopic = this.parseConsensusUpdateTopic(
|
|
144
|
+
transactionBody.consensusUpdateTopic
|
|
145
|
+
);
|
|
146
|
+
if (consensusUpdateTopic) {
|
|
147
|
+
return {
|
|
148
|
+
type: "TOPICUPDATE",
|
|
149
|
+
humanReadableType: "Topic Update",
|
|
150
|
+
consensusUpdateTopic
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (transactionBody.consensusDeleteTopic) {
|
|
155
|
+
const consensusDeleteTopic = this.parseConsensusDeleteTopic(
|
|
156
|
+
transactionBody.consensusDeleteTopic
|
|
157
|
+
);
|
|
158
|
+
if (consensusDeleteTopic) {
|
|
159
|
+
return {
|
|
160
|
+
type: "TOPICDELETE",
|
|
161
|
+
humanReadableType: "Topic Delete",
|
|
162
|
+
consensusDeleteTopic
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return {};
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
524
171
|
}
|
|
525
172
|
export {
|
|
526
|
-
|
|
527
|
-
getMySkillsList,
|
|
528
|
-
getRecommendedSkillVersion,
|
|
529
|
-
getSkillBadge,
|
|
530
|
-
getSkillDeprecations,
|
|
531
|
-
getSkillOwnership,
|
|
532
|
-
getSkillPublishJob,
|
|
533
|
-
getSkillSecurityBreakdown,
|
|
534
|
-
getSkillVerificationStatus,
|
|
535
|
-
getSkillVoteStatus,
|
|
536
|
-
getSkillsCatalog,
|
|
537
|
-
listMySkills,
|
|
538
|
-
listSkillCategories,
|
|
539
|
-
listSkillTags,
|
|
540
|
-
listSkillVersions,
|
|
541
|
-
listSkills,
|
|
542
|
-
publishSkill,
|
|
543
|
-
quoteSkillPublish,
|
|
544
|
-
requestSkillVerification,
|
|
545
|
-
resolveSkillManifest,
|
|
546
|
-
resolveSkillMarkdown,
|
|
547
|
-
setRecommendedSkillVersion,
|
|
548
|
-
setSkillDeprecation,
|
|
549
|
-
setSkillVote,
|
|
550
|
-
skillsConfig,
|
|
551
|
-
verifySkillDomainProof
|
|
173
|
+
HCSParser
|
|
552
174
|
};
|
|
553
175
|
//# sourceMappingURL=standards-sdk.es162.js.map
|