@hashgraphonline/standards-sdk 0.1.158 → 0.1.159

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.
Files changed (76) hide show
  1. package/dist/cjs/inscribe/inscriber.d.ts +1 -1
  2. package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
  3. package/dist/cjs/inscribe/inscription-cost.d.ts +12 -0
  4. package/dist/cjs/inscribe/inscription-cost.d.ts.map +1 -0
  5. package/dist/cjs/inscribe/types.d.ts +5 -1
  6. package/dist/cjs/inscribe/types.d.ts.map +1 -1
  7. package/dist/cjs/standards-sdk.cjs +2 -2
  8. package/dist/cjs/standards-sdk.cjs.map +1 -1
  9. package/dist/es/inscribe/inscriber.d.ts +1 -1
  10. package/dist/es/inscribe/inscriber.d.ts.map +1 -1
  11. package/dist/es/inscribe/inscription-cost.d.ts +12 -0
  12. package/dist/es/inscribe/inscription-cost.d.ts.map +1 -0
  13. package/dist/es/inscribe/types.d.ts +5 -1
  14. package/dist/es/inscribe/types.d.ts.map +1 -1
  15. package/dist/es/standards-sdk.es109.js +1 -1
  16. package/dist/es/standards-sdk.es116.js +5 -5
  17. package/dist/es/standards-sdk.es126.js +1 -1
  18. package/dist/es/standards-sdk.es127.js +1 -1
  19. package/dist/es/standards-sdk.es128.js +5 -5
  20. package/dist/es/standards-sdk.es130.js +32 -44
  21. package/dist/es/standards-sdk.es130.js.map +1 -1
  22. package/dist/es/standards-sdk.es136.js +1 -1
  23. package/dist/es/standards-sdk.es137.js +12 -12
  24. package/dist/es/standards-sdk.es148.js +240 -78
  25. package/dist/es/standards-sdk.es148.js.map +1 -1
  26. package/dist/es/standards-sdk.es149.js +237 -51
  27. package/dist/es/standards-sdk.es149.js.map +1 -1
  28. package/dist/es/standards-sdk.es150.js +160 -72
  29. package/dist/es/standards-sdk.es150.js.map +1 -1
  30. package/dist/es/standards-sdk.es151.js +318 -13
  31. package/dist/es/standards-sdk.es151.js.map +1 -1
  32. package/dist/es/standards-sdk.es152.js +336 -232
  33. package/dist/es/standards-sdk.es152.js.map +1 -1
  34. package/dist/es/standards-sdk.es153.js +410 -129
  35. package/dist/es/standards-sdk.es153.js.map +1 -1
  36. package/dist/es/standards-sdk.es154.js +209 -200
  37. package/dist/es/standards-sdk.es154.js.map +1 -1
  38. package/dist/es/standards-sdk.es155.js +64 -334
  39. package/dist/es/standards-sdk.es155.js.map +1 -1
  40. package/dist/es/standards-sdk.es156.js +13 -449
  41. package/dist/es/standards-sdk.es156.js.map +1 -1
  42. package/dist/es/standards-sdk.es157.js +65 -323
  43. package/dist/es/standards-sdk.es157.js.map +1 -1
  44. package/dist/es/standards-sdk.es158.js +49 -69
  45. package/dist/es/standards-sdk.es158.js.map +1 -1
  46. package/dist/es/standards-sdk.es159.js +65 -153
  47. package/dist/es/standards-sdk.es159.js.map +1 -1
  48. package/dist/es/standards-sdk.es160.js +152 -202
  49. package/dist/es/standards-sdk.es160.js.map +1 -1
  50. package/dist/es/standards-sdk.es161.js +206 -223
  51. package/dist/es/standards-sdk.es161.js.map +1 -1
  52. package/dist/es/standards-sdk.es162.js +227 -107
  53. package/dist/es/standards-sdk.es162.js.map +1 -1
  54. package/dist/es/standards-sdk.es163.js +98 -105
  55. package/dist/es/standards-sdk.es163.js.map +1 -1
  56. package/dist/es/standards-sdk.es164.js +105 -140
  57. package/dist/es/standards-sdk.es164.js.map +1 -1
  58. package/dist/es/standards-sdk.es165.js +140 -164
  59. package/dist/es/standards-sdk.es165.js.map +1 -1
  60. package/dist/es/standards-sdk.es166.js +165 -119
  61. package/dist/es/standards-sdk.es166.js.map +1 -1
  62. package/dist/es/standards-sdk.es167.js +111 -303
  63. package/dist/es/standards-sdk.es167.js.map +1 -1
  64. package/dist/es/standards-sdk.es168.js +297 -225
  65. package/dist/es/standards-sdk.es168.js.map +1 -1
  66. package/dist/es/standards-sdk.es169.js +253 -110
  67. package/dist/es/standards-sdk.es169.js.map +1 -1
  68. package/dist/es/standards-sdk.es170.js +119 -0
  69. package/dist/es/standards-sdk.es170.js.map +1 -0
  70. package/dist/es/standards-sdk.es56.js +1 -1
  71. package/dist/es/standards-sdk.es58.js +1 -1
  72. package/dist/es/standards-sdk.es59.js +1 -1
  73. package/dist/es/standards-sdk.es62.js +1 -1
  74. package/dist/es/standards-sdk.es64.js +1 -1
  75. package/dist/es/standards-sdk.es65.js +1 -1
  76. package/package.json +2 -2
@@ -1,245 +1,349 @@
1
- import { skillVerificationStatusResponseSchema, skillRegistryConfigResponseSchema, skillRegistryListResponseSchema, skillRegistryVersionsResponseSchema, skillRegistryMineResponseSchema, skillRegistryMyListResponseSchema, skillRegistryQuoteResponseSchema, skillRegistryPublishResponseSchema, skillRegistryJobStatusResponseSchema, skillRegistryOwnershipResponseSchema, skillRegistryVoteStatusResponseSchema, skillVerificationRequestCreateResponseSchema } from "./standards-sdk.es133.js";
2
- async function skillsConfig(client) {
3
- const raw = await client.requestJson("/skills/config", {
4
- method: "GET"
5
- });
6
- return client.parseWithSchema(
7
- raw,
8
- skillRegistryConfigResponseSchema,
9
- "skill registry config response"
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
- const suffix = query.size > 0 ? `?${query.toString()}` : "";
33
- const raw = await client.requestJson(`/skills${suffix}`, {
34
- method: "GET"
35
- });
36
- return client.parseWithSchema(
37
- raw,
38
- skillRegistryListResponseSchema,
39
- "skill registry list response"
40
- );
41
- }
42
- async function listSkillVersions(client, params) {
43
- const normalizedName = params.name.trim();
44
- if (!normalizedName) {
45
- throw new Error("name is required");
46
- }
47
- const query = new URLSearchParams();
48
- query.set("name", normalizedName);
49
- const raw = await client.requestJson(
50
- `/skills/versions?${query.toString()}`,
51
- { method: "GET" }
52
- );
53
- return client.parseWithSchema(
54
- raw,
55
- skillRegistryVersionsResponseSchema,
56
- "skill registry versions response"
57
- );
58
- }
59
- async function listMySkills(client, params = {}) {
60
- const query = new URLSearchParams();
61
- if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
62
- query.set("limit", String(Math.trunc(params.limit)));
63
- }
64
- const suffix = query.size > 0 ? `?${query.toString()}` : "";
65
- const raw = await client.requestJson(`/skills/mine${suffix}`, {
66
- method: "GET"
67
- });
68
- return client.parseWithSchema(
69
- raw,
70
- skillRegistryMineResponseSchema,
71
- "skill registry mine response"
72
- );
73
- }
74
- async function getMySkillsList(client, params = {}) {
75
- const query = new URLSearchParams();
76
- if (typeof params.limit === "number" && Number.isFinite(params.limit)) {
77
- query.set("limit", String(Math.trunc(params.limit)));
78
- }
79
- if (params.cursor) {
80
- query.set("cursor", params.cursor);
81
- }
82
- if (params.accountId) {
83
- query.set("accountId", params.accountId);
1
+ import { AccountId, Hbar, Long, HbarUnit, TokenId } from "@hashgraph/sdk";
2
+ import { parseKey } from "./standards-sdk.es155.js";
3
+ class CryptoParser {
4
+ static parseCryptoTransfers(cryptoTransfer, result) {
5
+ if (cryptoTransfer.transfers?.accountAmounts) {
6
+ result.transfers = cryptoTransfer.transfers.accountAmounts.map((aa) => {
7
+ const accountId = new AccountId(
8
+ aa.accountID.shardNum ?? 0,
9
+ aa.accountID.realmNum ?? 0,
10
+ aa.accountID.accountNum ?? 0
11
+ );
12
+ const hbarAmount = Hbar.fromTinybars(Long.fromValue(aa.amount));
13
+ return {
14
+ accountId: accountId.toString(),
15
+ amount: hbarAmount.toString(HbarUnit.Hbar),
16
+ isDecimal: true
17
+ };
18
+ });
19
+ }
20
+ if (cryptoTransfer.tokenTransfers) {
21
+ for (const tokenTransferList of cryptoTransfer.tokenTransfers) {
22
+ const tokenId = new TokenId(
23
+ tokenTransferList.token.shardNum ?? 0,
24
+ tokenTransferList.token.realmNum ?? 0,
25
+ tokenTransferList.token.tokenNum ?? 0
26
+ );
27
+ if (tokenTransferList.transfers) {
28
+ for (const transfer of tokenTransferList.transfers) {
29
+ const accountId = new AccountId(
30
+ transfer.accountID.shardNum ?? 0,
31
+ transfer.accountID.realmNum ?? 0,
32
+ transfer.accountID.accountNum ?? 0
33
+ );
34
+ const tokenAmount = Long.fromValue(transfer.amount).toNumber();
35
+ result.tokenTransfers.push({
36
+ tokenId: tokenId.toString(),
37
+ accountId: accountId.toString(),
38
+ amount: tokenAmount
39
+ });
40
+ }
41
+ }
42
+ }
43
+ }
84
44
  }
85
- const suffix = query.size > 0 ? `?${query.toString()}` : "";
86
- const raw = await client.requestJson(`/skills/my-list${suffix}`, {
87
- method: "GET"
88
- });
89
- return client.parseWithSchema(
90
- raw,
91
- skillRegistryMyListResponseSchema,
92
- "skill registry my list response"
93
- );
94
- }
95
- async function quoteSkillPublish(client, payload) {
96
- const raw = await client.requestJson("/skills/quote", {
97
- method: "POST",
98
- body: payload,
99
- headers: { "content-type": "application/json" }
100
- });
101
- return client.parseWithSchema(
102
- raw,
103
- skillRegistryQuoteResponseSchema,
104
- "skill registry quote response"
105
- );
106
- }
107
- async function publishSkill(client, payload) {
108
- const raw = await client.requestJson("/skills/publish", {
109
- method: "POST",
110
- body: payload,
111
- headers: { "content-type": "application/json" }
112
- });
113
- return client.parseWithSchema(
114
- raw,
115
- skillRegistryPublishResponseSchema,
116
- "skill registry publish response"
117
- );
118
- }
119
- async function getSkillPublishJob(client, jobId, params = {}) {
120
- const normalized = jobId.trim();
121
- if (!normalized) {
122
- throw new Error("jobId is required");
45
+ static parseCryptoDelete(body) {
46
+ if (!body) return void 0;
47
+ const data = {};
48
+ if (body.deleteAccountID) {
49
+ data.deleteAccountId = new AccountId(
50
+ body.deleteAccountID.shardNum ?? 0,
51
+ body.deleteAccountID.realmNum ?? 0,
52
+ body.deleteAccountID.accountNum ?? 0
53
+ ).toString();
54
+ }
55
+ if (body.transferAccountID) {
56
+ data.transferAccountId = new AccountId(
57
+ body.transferAccountID.shardNum ?? 0,
58
+ body.transferAccountID.realmNum ?? 0,
59
+ body.transferAccountID.accountNum ?? 0
60
+ ).toString();
61
+ }
62
+ return data;
123
63
  }
124
- const query = new URLSearchParams();
125
- if (params.accountId) {
126
- query.set("accountId", params.accountId);
64
+ static parseCryptoCreateAccount(body) {
65
+ if (!body) return void 0;
66
+ const data = {};
67
+ if (body.initialBalance) {
68
+ data.initialBalance = Hbar.fromTinybars(
69
+ Long.fromValue(body.initialBalance)
70
+ ).toString(HbarUnit.Hbar);
71
+ }
72
+ if (body.key) {
73
+ data.key = parseKey(body.key);
74
+ }
75
+ if (body.receiverSigRequired !== void 0) {
76
+ data.receiverSigRequired = body.receiverSigRequired;
77
+ }
78
+ if (body.autoRenewPeriod?.seconds) {
79
+ data.autoRenewPeriod = Long.fromValue(
80
+ body.autoRenewPeriod.seconds
81
+ ).toString();
82
+ }
83
+ if (body.memo) {
84
+ data.memo = body.memo;
85
+ }
86
+ if (body.maxAutomaticTokenAssociations !== void 0) {
87
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations;
88
+ }
89
+ if (body.stakedAccountId) {
90
+ data.stakedAccountId = new AccountId(
91
+ body.stakedAccountId.shardNum ?? 0,
92
+ body.stakedAccountId.realmNum ?? 0,
93
+ body.stakedAccountId.accountNum ?? 0
94
+ ).toString();
95
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
96
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
97
+ }
98
+ if (body.declineReward !== void 0) {
99
+ data.declineReward = body.declineReward;
100
+ }
101
+ if (body.alias && body.alias.length > 0) {
102
+ data.alias = Buffer.from(body.alias).toString("hex");
103
+ }
104
+ return data;
127
105
  }
128
- const suffix = query.size > 0 ? `?${query.toString()}` : "";
129
- const raw = await client.requestJson(
130
- `/skills/jobs/${encodeURIComponent(normalized)}${suffix}`,
131
- { method: "GET" }
132
- );
133
- return client.parseWithSchema(
134
- raw,
135
- skillRegistryJobStatusResponseSchema,
136
- "skill registry job status response"
137
- );
138
- }
139
- async function getSkillOwnership(client, params) {
140
- const normalizedName = params.name.trim();
141
- if (!normalizedName) {
142
- throw new Error("name is required");
106
+ static parseCryptoUpdateAccount(body) {
107
+ if (!body) return void 0;
108
+ const data = {};
109
+ if (body.accountIDToUpdate) {
110
+ data.accountIdToUpdate = new AccountId(
111
+ body.accountIDToUpdate.shardNum ?? 0,
112
+ body.accountIDToUpdate.realmNum ?? 0,
113
+ body.accountIDToUpdate.accountNum ?? 0
114
+ ).toString();
115
+ }
116
+ if (body.key) {
117
+ data.key = parseKey(body.key);
118
+ }
119
+ if (body.expirationTime?.seconds) {
120
+ data.expirationTime = `${Long.fromValue(
121
+ body.expirationTime.seconds
122
+ ).toString()}.${body.expirationTime.nanos}`;
123
+ }
124
+ if (body.receiverSigRequired !== null && body.receiverSigRequired !== void 0) {
125
+ data.receiverSigRequired = Boolean(body.receiverSigRequired);
126
+ }
127
+ if (body.autoRenewPeriod?.seconds) {
128
+ data.autoRenewPeriod = Long.fromValue(
129
+ body.autoRenewPeriod.seconds
130
+ ).toString();
131
+ }
132
+ if (body.memo?.value !== void 0) {
133
+ data.memo = body.memo.value;
134
+ }
135
+ if (body.maxAutomaticTokenAssociations?.value !== void 0) {
136
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations.value;
137
+ }
138
+ if (body.stakedAccountId) {
139
+ data.stakedAccountId = new AccountId(
140
+ body.stakedAccountId.shardNum ?? 0,
141
+ body.stakedAccountId.realmNum ?? 0,
142
+ body.stakedAccountId.accountNum ?? 0
143
+ ).toString();
144
+ data.stakedNodeId = void 0;
145
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
146
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
147
+ data.stakedAccountId = void 0;
148
+ } else {
149
+ data.stakedAccountId = void 0;
150
+ data.stakedNodeId = void 0;
151
+ }
152
+ if (body.declineReward !== null && body.declineReward !== void 0) {
153
+ data.declineReward = Boolean(body.declineReward);
154
+ }
155
+ return data;
143
156
  }
144
- const query = new URLSearchParams();
145
- query.set("name", normalizedName);
146
- if (params.accountId) {
147
- query.set("accountId", params.accountId);
157
+ static parseCryptoApproveAllowance(body) {
158
+ if (!body) return void 0;
159
+ const data = {};
160
+ if (body.cryptoAllowances && body.cryptoAllowances.length > 0) {
161
+ data.hbarAllowances = body.cryptoAllowances.map((a) => ({
162
+ ownerAccountId: new AccountId(
163
+ a.owner.shardNum ?? 0,
164
+ a.owner.realmNum ?? 0,
165
+ a.owner.accountNum ?? 0
166
+ ).toString(),
167
+ spenderAccountId: new AccountId(
168
+ a.spender.shardNum ?? 0,
169
+ a.spender.realmNum ?? 0,
170
+ a.spender.accountNum ?? 0
171
+ ).toString(),
172
+ amount: Hbar.fromTinybars(Long.fromValue(a.amount)).toString(
173
+ HbarUnit.Hbar
174
+ )
175
+ }));
176
+ }
177
+ if (body.tokenAllowances && body.tokenAllowances.length > 0) {
178
+ data.tokenAllowances = body.tokenAllowances.map((a) => ({
179
+ tokenId: new TokenId(
180
+ a.tokenId.shardNum ?? 0,
181
+ a.tokenId.realmNum ?? 0,
182
+ a.tokenId.tokenNum ?? 0
183
+ ).toString(),
184
+ ownerAccountId: new AccountId(
185
+ a.owner.shardNum ?? 0,
186
+ a.owner.realmNum ?? 0,
187
+ a.owner.accountNum ?? 0
188
+ ).toString(),
189
+ spenderAccountId: new AccountId(
190
+ a.spender.shardNum ?? 0,
191
+ a.spender.realmNum ?? 0,
192
+ a.spender.accountNum ?? 0
193
+ ).toString(),
194
+ amount: Long.fromValue(a.amount).toString()
195
+ }));
196
+ }
197
+ if (body.nftAllowances && body.nftAllowances.length > 0) {
198
+ data.nftAllowances = body.nftAllowances.map((a) => {
199
+ const allowance = {};
200
+ if (a.tokenId)
201
+ allowance.tokenId = new TokenId(
202
+ a.tokenId.shardNum ?? 0,
203
+ a.tokenId.realmNum ?? 0,
204
+ a.tokenId.tokenNum ?? 0
205
+ ).toString();
206
+ if (a.owner)
207
+ allowance.ownerAccountId = new AccountId(
208
+ a.owner.shardNum ?? 0,
209
+ a.owner.realmNum ?? 0,
210
+ a.owner.accountNum ?? 0
211
+ ).toString();
212
+ if (a.spender)
213
+ allowance.spenderAccountId = new AccountId(
214
+ a.spender.shardNum ?? 0,
215
+ a.spender.realmNum ?? 0,
216
+ a.spender.accountNum ?? 0
217
+ ).toString();
218
+ if (a.serialNumbers && a.serialNumbers.length > 0)
219
+ allowance.serialNumbers = a.serialNumbers.map(
220
+ (sn) => Long.fromValue(sn).toString()
221
+ );
222
+ if (a.approvedForAll?.value !== void 0)
223
+ allowance.approvedForAll = a.approvedForAll.value;
224
+ if (a.delegatingSpender)
225
+ allowance.delegatingSpender = new AccountId(
226
+ a.delegatingSpender.shardNum ?? 0,
227
+ a.delegatingSpender.realmNum ?? 0,
228
+ a.delegatingSpender.accountNum ?? 0
229
+ ).toString();
230
+ return allowance;
231
+ });
232
+ }
233
+ return data;
148
234
  }
149
- const raw = await client.requestJson(
150
- `/skills/ownership?${query.toString()}`,
151
- {
152
- method: "GET"
153
- }
154
- );
155
- return client.parseWithSchema(
156
- raw,
157
- skillRegistryOwnershipResponseSchema,
158
- "skill registry ownership response"
159
- );
160
- }
161
- async function getSkillVoteStatus(client, params) {
162
- const normalizedName = params.name.trim();
163
- if (!normalizedName) {
164
- throw new Error("name is required");
235
+ static parseCryptoDeleteAllowance(body) {
236
+ if (!body) return void 0;
237
+ const data = {};
238
+ if (body.nftAllowances && body.nftAllowances.length > 0) {
239
+ data.nftAllowancesToRemove = body.nftAllowances.map((a) => ({
240
+ ownerAccountId: new AccountId(
241
+ a.owner.shardNum ?? 0,
242
+ a.owner.realmNum ?? 0,
243
+ a.owner.accountNum ?? 0
244
+ ).toString(),
245
+ tokenId: new TokenId(
246
+ a.tokenId.shardNum ?? 0,
247
+ a.tokenId.realmNum ?? 0,
248
+ a.tokenId.tokenNum ?? 0
249
+ ).toString(),
250
+ serialNumbers: a.serialNumbers ? a.serialNumbers.map((sn) => Long.fromValue(sn).toString()) : []
251
+ }));
252
+ }
253
+ return data;
165
254
  }
166
- const query = new URLSearchParams();
167
- query.set("name", normalizedName);
168
- const raw = await client.requestJson(
169
- `/skills/vote?${query.toString()}`,
170
- { method: "GET" }
171
- );
172
- return client.parseWithSchema(
173
- raw,
174
- skillRegistryVoteStatusResponseSchema,
175
- "skill registry vote status response"
176
- );
177
- }
178
- async function setSkillVote(client, payload) {
179
- const normalizedName = payload.name.trim();
180
- if (!normalizedName) {
181
- throw new Error("name is required");
255
+ /**
256
+ * Extract HBAR transfers from Transaction object
257
+ */
258
+ static extractHbarTransfersFromTransaction(transaction) {
259
+ const transfers = [];
260
+ try {
261
+ const hbarTransfers = transaction._hbarTransfers;
262
+ if (Array.isArray(hbarTransfers)) {
263
+ hbarTransfers.forEach((transfer) => {
264
+ if (transfer.accountId && transfer.amount) {
265
+ const amountInTinybars = transfer.amount.toTinybars();
266
+ const amountInHbar = Number(amountInTinybars) / 1e8;
267
+ transfers.push({
268
+ accountId: transfer.accountId.toString(),
269
+ amount: amountInHbar
270
+ });
271
+ }
272
+ });
273
+ }
274
+ } catch (error) {
275
+ }
276
+ return transfers;
182
277
  }
183
- const raw = await client.requestJson("/skills/vote", {
184
- method: "POST",
185
- body: { name: normalizedName, upvoted: payload.upvoted },
186
- headers: { "content-type": "application/json" }
187
- });
188
- return client.parseWithSchema(
189
- raw,
190
- skillRegistryVoteStatusResponseSchema,
191
- "skill registry vote status response"
192
- );
193
- }
194
- async function requestSkillVerification(client, payload) {
195
- const normalizedName = payload.name.trim();
196
- if (!normalizedName) {
197
- throw new Error("name is required");
278
+ /**
279
+ * Extract token transfers from Transaction object
280
+ */
281
+ static extractTokenTransfersFromTransaction(transaction) {
282
+ const tokenTransfers = [];
283
+ try {
284
+ const tokenTransfersList = transaction._tokenTransfers;
285
+ if (Array.isArray(tokenTransfersList)) {
286
+ tokenTransfersList.forEach((tokenTransfer) => {
287
+ if (tokenTransfer.tokenId && Array.isArray(tokenTransfer.transfers)) {
288
+ const transfers = tokenTransfer.transfers.map((transfer) => ({
289
+ accountId: transfer.accountId?.toString() || "Unknown",
290
+ amount: Number(transfer.amount || 0)
291
+ }));
292
+ tokenTransfers.push({
293
+ tokenId: tokenTransfer.tokenId.toString(),
294
+ transfers
295
+ });
296
+ }
297
+ });
298
+ }
299
+ } catch (error) {
300
+ }
301
+ return tokenTransfers;
198
302
  }
199
- const raw = await client.requestJson(
200
- "/skills/verification/request",
201
- {
202
- method: "POST",
203
- body: { name: normalizedName, tier: payload.tier },
204
- headers: { "content-type": "application/json" }
205
- }
206
- );
207
- return client.parseWithSchema(
208
- raw,
209
- skillVerificationRequestCreateResponseSchema,
210
- "skill verification request create response"
211
- );
212
- }
213
- async function getSkillVerificationStatus(client, params) {
214
- const normalizedName = params.name.trim();
215
- if (!normalizedName) {
216
- throw new Error("name is required");
303
+ /**
304
+ * Parse crypto transaction from Transaction object with comprehensive extraction
305
+ * This is the unified entry point that handles both protobuf and internal field extraction
306
+ */
307
+ static parseFromTransactionObject(transaction) {
308
+ try {
309
+ const hbarTransfers = this.extractHbarTransfersFromTransaction(transaction);
310
+ const tokenTransfers = this.extractTokenTransfersFromTransaction(transaction);
311
+ if (hbarTransfers.length > 0 || tokenTransfers.length > 0) {
312
+ const convertedTransfers = hbarTransfers.map((transfer) => ({
313
+ accountId: transfer.accountId,
314
+ amount: transfer.amount.toString() + " ",
315
+ isDecimal: true
316
+ }));
317
+ const convertedTokenTransfers = tokenTransfers.flatMap(
318
+ (tokenGroup) => tokenGroup.transfers.map((transfer) => ({
319
+ tokenId: tokenGroup.tokenId,
320
+ accountId: transfer.accountId,
321
+ amount: transfer.amount
322
+ }))
323
+ );
324
+ if (hbarTransfers.length > 0) {
325
+ return {
326
+ type: "CRYPTOTRANSFER",
327
+ humanReadableType: "Crypto Transfer",
328
+ transfers: convertedTransfers,
329
+ tokenTransfers: convertedTokenTransfers
330
+ };
331
+ } else if (tokenTransfers.length > 0) {
332
+ return {
333
+ type: "TOKENTRANSFER",
334
+ humanReadableType: "Token Transfer",
335
+ transfers: convertedTransfers,
336
+ tokenTransfers: convertedTokenTransfers
337
+ };
338
+ }
339
+ }
340
+ return {};
341
+ } catch (error) {
342
+ return {};
343
+ }
217
344
  }
218
- const query = new URLSearchParams();
219
- query.set("name", normalizedName);
220
- const raw = await client.requestJson(
221
- `/skills/verification/status?${query.toString()}`,
222
- { method: "GET" }
223
- );
224
- return client.parseWithSchema(
225
- raw,
226
- skillVerificationStatusResponseSchema,
227
- "skill verification status response"
228
- );
229
345
  }
230
346
  export {
231
- getMySkillsList,
232
- getSkillOwnership,
233
- getSkillPublishJob,
234
- getSkillVerificationStatus,
235
- getSkillVoteStatus,
236
- listMySkills,
237
- listSkillVersions,
238
- listSkills,
239
- publishSkill,
240
- quoteSkillPublish,
241
- requestSkillVerification,
242
- setSkillVote,
243
- skillsConfig
347
+ CryptoParser
244
348
  };
245
349
  //# sourceMappingURL=standards-sdk.es152.js.map