@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.
- package/dist/cjs/inscribe/inscriber.d.ts +1 -1
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/inscription-cost.d.ts +12 -0
- package/dist/cjs/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/cjs/inscribe/types.d.ts +5 -1
- package/dist/cjs/inscribe/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/inscribe/inscriber.d.ts +1 -1
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/inscription-cost.d.ts +12 -0
- package/dist/es/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/es/inscribe/types.d.ts +5 -1
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es109.js +1 -1
- package/dist/es/standards-sdk.es116.js +5 -5
- package/dist/es/standards-sdk.es126.js +1 -1
- package/dist/es/standards-sdk.es127.js +1 -1
- package/dist/es/standards-sdk.es128.js +5 -5
- package/dist/es/standards-sdk.es130.js +32 -44
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +1 -1
- package/dist/es/standards-sdk.es137.js +12 -12
- package/dist/es/standards-sdk.es148.js +240 -78
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +237 -51
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +160 -72
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +318 -13
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +336 -232
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +410 -129
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +209 -200
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +64 -334
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +13 -449
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +65 -323
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +49 -69
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +65 -153
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es160.js +152 -202
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +206 -223
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +227 -107
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +98 -105
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +105 -140
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +140 -164
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +165 -119
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +111 -303
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +297 -225
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +253 -110
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +119 -0
- package/dist/es/standards-sdk.es170.js.map +1 -0
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es58.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/package.json +2 -2
|
@@ -1,245 +1,349 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
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
|