@hashgraphonline/standards-sdk 0.1.141-canary.7 → 0.1.141-canary.9
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/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +22 -22
- package/dist/cjs/services/registry-broker/schemas.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/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +22 -22
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/standards-sdk.es101.js +1 -1
- package/dist/es/standards-sdk.es103.js +1 -1
- package/dist/es/standards-sdk.es109.js +2 -2
- package/dist/es/standards-sdk.es110.js +5 -5
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +1 -1
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +5 -5
- package/dist/es/standards-sdk.es124.js +1 -1
- package/dist/es/standards-sdk.es125.js +1 -1
- package/dist/es/standards-sdk.es127.js +13 -3
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +1 -2
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es135.js +134 -13
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +37 -133
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +50 -36
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +64 -760
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +746 -12254
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es140.js +12271 -53
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +161 -53
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +289 -139
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +298 -274
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +369 -262
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +194 -316
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +64 -319
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +15 -74
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +2 -2
- package/dist/es/standards-sdk.es19.js +5 -5
- package/dist/es/standards-sdk.es20.js +3 -3
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es28.js +4 -4
- package/dist/es/standards-sdk.es31.js +1 -1
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es36.js +3 -3
- package/dist/es/standards-sdk.es37.js +3 -3
- package/dist/es/standards-sdk.es38.js +1 -1
- package/dist/es/standards-sdk.es5.js +1 -1
- package/dist/es/standards-sdk.es54.js +1 -1
- package/dist/es/standards-sdk.es57.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es61.js +3 -3
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +2 -2
- package/dist/es/standards-sdk.es69.js +2 -2
- package/dist/es/standards-sdk.es70.js +1 -1
- package/dist/es/standards-sdk.es72.js +1 -1
- package/dist/es/standards-sdk.es77.js +1 -1
- package/dist/es/standards-sdk.es78.js +2 -2
- package/dist/es/standards-sdk.es79.js +1 -1
- package/dist/es/standards-sdk.es8.js +1 -1
- package/dist/es/standards-sdk.es82.js +1 -1
- package/dist/es/standards-sdk.es84.js +1 -1
- package/dist/es/standards-sdk.es87.js +1 -1
- package/dist/es/standards-sdk.es91.js +1 -1
- package/dist/es/standards-sdk.es92.js +1 -1
- package/dist/es/standards-sdk.es97.js +1 -1
- package/dist/es/standards-sdk.es99.js +1 -1
- package/package.json +63 -61
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { proto } from "@hashgraph/proto";
|
|
2
|
-
import { Long,
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
class SCSParser {
|
|
2
|
+
import { Long, FileId, ContractId } from "@hashgraph/sdk";
|
|
3
|
+
import { hasTransactionType } from "./standards-sdk.es146.js";
|
|
4
|
+
class UtilParser {
|
|
6
5
|
/**
|
|
7
|
-
* Parse
|
|
6
|
+
* Parse Utility/System Service transaction using unified dual-branch approach
|
|
8
7
|
* This handles both regular transactions and signed transaction variants
|
|
9
8
|
*/
|
|
10
|
-
static
|
|
9
|
+
static parseUtilTransaction(transaction, originalBytes) {
|
|
11
10
|
try {
|
|
12
11
|
if (originalBytes || transaction.toBytes) {
|
|
13
12
|
try {
|
|
@@ -40,179 +39,157 @@ class SCSParser {
|
|
|
40
39
|
} catch (error) {
|
|
41
40
|
return {
|
|
42
41
|
type: "UNKNOWN",
|
|
43
|
-
humanReadableType: "Unknown
|
|
42
|
+
humanReadableType: "Unknown Utility Transaction"
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
|
-
* Parse
|
|
49
|
-
* Handles all
|
|
47
|
+
* Parse utility transaction from protobuf TransactionBody
|
|
48
|
+
* Handles all utility operations from decoded protobuf data
|
|
50
49
|
*/
|
|
51
50
|
static parseFromProtobufTxBody(txBody) {
|
|
52
|
-
if (txBody.
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
51
|
+
if (txBody.utilPrng) {
|
|
52
|
+
const utilPrng = this.parseUtilPrng(txBody.utilPrng);
|
|
53
|
+
if (utilPrng) {
|
|
55
54
|
return {
|
|
56
|
-
type: "
|
|
57
|
-
humanReadableType: "
|
|
58
|
-
|
|
55
|
+
type: "PRNG",
|
|
56
|
+
humanReadableType: "Pseudo Random Number",
|
|
57
|
+
utilPrng
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
if (txBody.
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
if (contractCreate) {
|
|
61
|
+
if (txBody.freeze) {
|
|
62
|
+
const networkFreeze = this.parseNetworkFreezeFromProto(txBody.freeze);
|
|
63
|
+
if (networkFreeze) {
|
|
67
64
|
return {
|
|
68
|
-
type: "
|
|
69
|
-
humanReadableType: "
|
|
70
|
-
|
|
65
|
+
type: "FREEZE",
|
|
66
|
+
humanReadableType: "Network Freeze",
|
|
67
|
+
freeze: networkFreeze
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
|
-
if (txBody.
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
-
if (contractUpdate) {
|
|
71
|
+
if (txBody.systemDelete) {
|
|
72
|
+
const systemDelete = this.parseSystemDeleteFromProto(txBody.systemDelete);
|
|
73
|
+
if (systemDelete) {
|
|
79
74
|
return {
|
|
80
|
-
type: "
|
|
81
|
-
humanReadableType: "
|
|
82
|
-
|
|
75
|
+
type: "SYSTEMDELETE",
|
|
76
|
+
humanReadableType: "System Delete",
|
|
77
|
+
systemDelete
|
|
83
78
|
};
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
|
-
if (txBody.
|
|
87
|
-
const
|
|
88
|
-
txBody.
|
|
81
|
+
if (txBody.systemUndelete) {
|
|
82
|
+
const systemUndelete = this.parseSystemUndeleteFromProto(
|
|
83
|
+
txBody.systemUndelete
|
|
89
84
|
);
|
|
90
|
-
if (
|
|
85
|
+
if (systemUndelete) {
|
|
91
86
|
return {
|
|
92
|
-
type: "
|
|
93
|
-
humanReadableType: "
|
|
94
|
-
|
|
87
|
+
type: "SYSTEMUNDELETE",
|
|
88
|
+
humanReadableType: "System Undelete",
|
|
89
|
+
systemUndelete
|
|
95
90
|
};
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
|
-
if (txBody.
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
if (txBody.nodeCreate) {
|
|
94
|
+
const nodeCreate = this.parseNodeCreateFromProto(txBody.nodeCreate);
|
|
95
|
+
if (nodeCreate) {
|
|
96
|
+
return {
|
|
97
|
+
type: "NODECREATE",
|
|
98
|
+
humanReadableType: "Node Create",
|
|
99
|
+
nodeCreate
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (txBody.nodeUpdate) {
|
|
104
|
+
const nodeUpdate = this.parseNodeUpdateFromProto(txBody.nodeUpdate);
|
|
105
|
+
if (nodeUpdate) {
|
|
103
106
|
return {
|
|
104
|
-
type: "
|
|
105
|
-
humanReadableType: "
|
|
106
|
-
|
|
107
|
+
type: "NODEUPDATE",
|
|
108
|
+
humanReadableType: "Node Update",
|
|
109
|
+
nodeUpdate
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (txBody.nodeDelete) {
|
|
114
|
+
const nodeDelete = this.parseNodeDeleteFromProto(txBody.nodeDelete);
|
|
115
|
+
if (nodeDelete) {
|
|
116
|
+
return {
|
|
117
|
+
type: "NODEDELETE",
|
|
118
|
+
humanReadableType: "Node Delete",
|
|
119
|
+
nodeDelete
|
|
107
120
|
};
|
|
108
121
|
}
|
|
109
122
|
}
|
|
110
123
|
return {};
|
|
111
124
|
}
|
|
112
125
|
/**
|
|
113
|
-
* Extract
|
|
126
|
+
* Extract utility data from Transaction internal fields
|
|
114
127
|
* This handles cases where data is stored in Transaction object internals
|
|
115
128
|
*/
|
|
116
129
|
static parseFromTransactionInternals(transaction) {
|
|
117
130
|
try {
|
|
118
131
|
const tx = transaction;
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
amount: tx._amount ? parseFloat(tx._amount.toString()) : 0
|
|
124
|
-
};
|
|
125
|
-
if (tx._functionParameters) {
|
|
126
|
-
const funcParams = Buffer.from(tx._functionParameters).toString(
|
|
127
|
-
"hex"
|
|
128
|
-
);
|
|
129
|
-
contractCall.functionParameters = funcParams;
|
|
130
|
-
contractCall.functionName = this.extractFunctionName(funcParams);
|
|
132
|
+
if (hasTransactionType(transaction, "utilPrng")) {
|
|
133
|
+
const utilPrng = {};
|
|
134
|
+
if (tx._range && tx._range !== 0) {
|
|
135
|
+
utilPrng.range = tx._range;
|
|
131
136
|
}
|
|
132
137
|
return {
|
|
133
|
-
type: "
|
|
134
|
-
humanReadableType: "
|
|
135
|
-
|
|
138
|
+
type: "PRNG",
|
|
139
|
+
humanReadableType: "Pseudo Random Number",
|
|
140
|
+
utilPrng
|
|
136
141
|
};
|
|
137
142
|
}
|
|
138
|
-
if (hasTransactionType(transaction, "
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
if (tx.
|
|
144
|
-
|
|
145
|
-
contractCreate.initcode = tx._fileId.toString();
|
|
146
|
-
} else if (tx._bytecode) {
|
|
147
|
-
contractCreate.initcodeSource = "bytes";
|
|
148
|
-
contractCreate.initcode = Buffer.from(tx._bytecode).toString("hex");
|
|
143
|
+
if (hasTransactionType(transaction, "freeze")) {
|
|
144
|
+
const networkFreeze = {};
|
|
145
|
+
if (tx._startTime) {
|
|
146
|
+
networkFreeze.startTime = tx._startTime.toString();
|
|
147
|
+
}
|
|
148
|
+
if (tx._endTime) {
|
|
149
|
+
networkFreeze.endTime = tx._endTime.toString();
|
|
149
150
|
}
|
|
150
|
-
if (tx.
|
|
151
|
-
|
|
152
|
-
tx._constructorParameters
|
|
153
|
-
).toString("hex");
|
|
151
|
+
if (tx._updateFile) {
|
|
152
|
+
networkFreeze.updateFile = tx._updateFile.toString();
|
|
154
153
|
}
|
|
155
|
-
if (tx.
|
|
156
|
-
|
|
157
|
-
if (tx._maxAutomaticTokenAssociations !== void 0) {
|
|
158
|
-
contractCreate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
|
|
154
|
+
if (tx._fileHash) {
|
|
155
|
+
networkFreeze.fileHash = Buffer.from(tx._fileHash).toString("hex");
|
|
159
156
|
}
|
|
160
|
-
if (tx.
|
|
161
|
-
|
|
162
|
-
} else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
|
|
163
|
-
contractCreate.stakedNodeId = Long.fromValue(
|
|
164
|
-
tx._stakedNodeId
|
|
165
|
-
).toString();
|
|
157
|
+
if (tx._freezeType) {
|
|
158
|
+
networkFreeze.freezeType = tx._freezeType;
|
|
166
159
|
}
|
|
167
|
-
if (tx._declineReward !== void 0)
|
|
168
|
-
contractCreate.declineReward = tx._declineReward;
|
|
169
|
-
if (tx._autoRenewPeriod)
|
|
170
|
-
contractCreate.autoRenewPeriod = tx._autoRenewPeriod.toString();
|
|
171
160
|
return {
|
|
172
|
-
type: "
|
|
173
|
-
humanReadableType: "
|
|
174
|
-
|
|
161
|
+
type: "FREEZE",
|
|
162
|
+
humanReadableType: "Network Freeze",
|
|
163
|
+
freeze: networkFreeze
|
|
175
164
|
};
|
|
176
165
|
}
|
|
177
|
-
if (hasTransactionType(transaction, "
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (tx.
|
|
182
|
-
|
|
183
|
-
if (tx._maxAutomaticTokenAssociations !== void 0) {
|
|
184
|
-
contractUpdate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
|
|
166
|
+
if (hasTransactionType(transaction, "systemDelete")) {
|
|
167
|
+
const systemDelete = {};
|
|
168
|
+
if (tx._fileId) {
|
|
169
|
+
systemDelete.fileId = tx._fileId.toString();
|
|
170
|
+
} else if (tx._contractId) {
|
|
171
|
+
systemDelete.contractId = tx._contractId.toString();
|
|
185
172
|
}
|
|
186
|
-
if (tx.
|
|
187
|
-
|
|
188
|
-
} else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
|
|
189
|
-
contractUpdate.stakedNodeId = Long.fromValue(
|
|
190
|
-
tx._stakedNodeId
|
|
191
|
-
).toString();
|
|
173
|
+
if (tx._expirationTime) {
|
|
174
|
+
systemDelete.expirationTime = tx._expirationTime.toString();
|
|
192
175
|
}
|
|
193
|
-
if (tx._declineReward !== void 0)
|
|
194
|
-
contractUpdate.declineReward = tx._declineReward;
|
|
195
|
-
if (tx._autoRenewPeriod)
|
|
196
|
-
contractUpdate.autoRenewPeriod = tx._autoRenewPeriod.toString();
|
|
197
176
|
return {
|
|
198
|
-
type: "
|
|
199
|
-
humanReadableType: "
|
|
200
|
-
|
|
177
|
+
type: "SYSTEMDELETE",
|
|
178
|
+
humanReadableType: "System Delete",
|
|
179
|
+
systemDelete
|
|
201
180
|
};
|
|
202
181
|
}
|
|
203
|
-
if (hasTransactionType(transaction, "
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if (tx.
|
|
208
|
-
|
|
209
|
-
} else if (tx._transferContractId) {
|
|
210
|
-
contractDelete.transferContractId = tx._transferContractId.toString();
|
|
182
|
+
if (hasTransactionType(transaction, "systemUndelete")) {
|
|
183
|
+
const systemUndelete = {};
|
|
184
|
+
if (tx._fileId) {
|
|
185
|
+
systemUndelete.fileId = tx._fileId.toString();
|
|
186
|
+
} else if (tx._contractId) {
|
|
187
|
+
systemUndelete.contractId = tx._contractId.toString();
|
|
211
188
|
}
|
|
212
189
|
return {
|
|
213
|
-
type: "
|
|
214
|
-
humanReadableType: "
|
|
215
|
-
|
|
190
|
+
type: "SYSTEMUNDELETE",
|
|
191
|
+
humanReadableType: "System Undelete",
|
|
192
|
+
systemUndelete
|
|
216
193
|
};
|
|
217
194
|
}
|
|
218
195
|
return {};
|
|
@@ -221,236 +198,137 @@ class SCSParser {
|
|
|
221
198
|
}
|
|
222
199
|
}
|
|
223
200
|
/**
|
|
224
|
-
*
|
|
225
|
-
* Attempts to decode function selector and map to known function names
|
|
201
|
+
* Parse Network Freeze from protobuf data
|
|
226
202
|
*/
|
|
227
|
-
static
|
|
228
|
-
if (functionParameters.length < 8) return "unknown";
|
|
229
|
-
const selector = functionParameters.substring(0, 8);
|
|
230
|
-
const commonSelectors = {
|
|
231
|
-
a9059cbb: "transfer",
|
|
232
|
-
"095ea7b3": "approve",
|
|
233
|
-
"23b872dd": "transferFrom",
|
|
234
|
-
"70a08231": "balanceOf",
|
|
235
|
-
dd62ed3e: "allowance",
|
|
236
|
-
"18160ddd": "totalSupply",
|
|
237
|
-
"06fdde03": "name",
|
|
238
|
-
"95d89b41": "symbol",
|
|
239
|
-
"313ce567": "decimals",
|
|
240
|
-
"42842e0e": "safeTransferFrom",
|
|
241
|
-
b88d4fde: "safeTransferFrom",
|
|
242
|
-
e985e9c5: "isApprovedForAll",
|
|
243
|
-
a22cb465: "setApprovalForAll",
|
|
244
|
-
"6352211e": "ownerOf",
|
|
245
|
-
c87b56dd: "tokenURI",
|
|
246
|
-
"01ffc9a7": "supportsInterface",
|
|
247
|
-
"40c10f19": "mint",
|
|
248
|
-
"42966c68": "burn",
|
|
249
|
-
f2fde38b: "transferOwnership",
|
|
250
|
-
"715018a6": "renounceOwnership",
|
|
251
|
-
"8da5cb5b": "owner"
|
|
252
|
-
};
|
|
253
|
-
return commonSelectors[selector] || selector;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Parse Ethereum Transaction (was completely missing from original parser)
|
|
257
|
-
*/
|
|
258
|
-
static parseEthereumTransaction(body) {
|
|
259
|
-
if (!body) return void 0;
|
|
260
|
-
const data = {
|
|
261
|
-
contractId: "EVM",
|
|
262
|
-
gas: body.maxGasAllowance ? Long.fromValue(body.maxGasAllowance).toNumber() : 0,
|
|
263
|
-
amount: 0
|
|
264
|
-
};
|
|
265
|
-
if (body.ethereumData && body.ethereumData.length > 0) {
|
|
266
|
-
const ethData = Buffer.from(body.ethereumData).toString("hex");
|
|
267
|
-
data.functionParameters = ethData;
|
|
268
|
-
if (ethData.length >= 8) {
|
|
269
|
-
data.functionName = this.extractFunctionName(ethData);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return data;
|
|
273
|
-
}
|
|
274
|
-
static parseContractCall(body) {
|
|
275
|
-
if (!body) return void 0;
|
|
276
|
-
const hbarAmount = Hbar.fromTinybars(Long.fromValue(body.amount ?? 0));
|
|
277
|
-
const data = {
|
|
278
|
-
contractId: new ContractId(
|
|
279
|
-
body.contractID.shardNum ?? 0,
|
|
280
|
-
body.contractID.realmNum ?? 0,
|
|
281
|
-
body.contractID.contractNum ?? 0
|
|
282
|
-
).toString(),
|
|
283
|
-
gas: Long.fromValue(body.gas ?? 0).toNumber(),
|
|
284
|
-
amount: parseFloat(hbarAmount.toString(HbarUnit.Hbar))
|
|
285
|
-
};
|
|
286
|
-
if (body.functionParameters) {
|
|
287
|
-
data.functionParameters = Buffer.from(body.functionParameters).toString(
|
|
288
|
-
"hex"
|
|
289
|
-
);
|
|
290
|
-
if (data.functionParameters.length >= 8) {
|
|
291
|
-
data.functionName = this.extractFunctionName(data.functionParameters);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return data;
|
|
295
|
-
}
|
|
296
|
-
static parseContractCreate(body) {
|
|
203
|
+
static parseNetworkFreezeFromProto(body) {
|
|
297
204
|
if (!body) return void 0;
|
|
298
205
|
const data = {};
|
|
299
|
-
if (body.
|
|
300
|
-
data.
|
|
301
|
-
|
|
302
|
-
).toString(
|
|
303
|
-
}
|
|
304
|
-
if (body.gas) {
|
|
305
|
-
data.gas = Long.fromValue(body.gas).toString();
|
|
306
|
-
}
|
|
307
|
-
if (body.adminKey) {
|
|
308
|
-
data.adminKey = parseKey(body.adminKey);
|
|
206
|
+
if (body.startTime?.seconds) {
|
|
207
|
+
data.startTime = `${Long.fromValue(
|
|
208
|
+
body.startTime.seconds
|
|
209
|
+
).toString()}.${body.startTime.nanos ?? 0}`;
|
|
309
210
|
}
|
|
310
|
-
if (body.
|
|
311
|
-
data.
|
|
312
|
-
body.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (body.memo) {
|
|
316
|
-
data.memo = body.memo;
|
|
317
|
-
}
|
|
318
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
319
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
320
|
-
body.autoRenewPeriod.seconds
|
|
321
|
-
).toString();
|
|
322
|
-
}
|
|
323
|
-
if (body.stakedAccountId) {
|
|
324
|
-
data.stakedAccountId = new AccountId(
|
|
325
|
-
body.stakedAccountId.shardNum ?? 0,
|
|
326
|
-
body.stakedAccountId.realmNum ?? 0,
|
|
327
|
-
body.stakedAccountId.accountNum ?? 0
|
|
211
|
+
if (body.updateFile) {
|
|
212
|
+
data.updateFile = new FileId(
|
|
213
|
+
body.updateFile.shardNum ?? 0,
|
|
214
|
+
body.updateFile.realmNum ?? 0,
|
|
215
|
+
body.updateFile.fileNum ?? 0
|
|
328
216
|
).toString();
|
|
329
|
-
} else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
|
|
330
|
-
data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
|
|
331
217
|
}
|
|
332
|
-
if (body.
|
|
333
|
-
data.
|
|
218
|
+
if (body.fileHash && body.fileHash.length > 0) {
|
|
219
|
+
data.fileHash = Buffer.from(body.fileHash).toString("hex");
|
|
334
220
|
}
|
|
335
|
-
if (body.
|
|
336
|
-
|
|
221
|
+
if (body.freezeType !== void 0) {
|
|
222
|
+
const freezeTypes = [
|
|
223
|
+
"FREEZE_ONLY",
|
|
224
|
+
"PREPARE_UPGRADE",
|
|
225
|
+
"FREEZE_UPGRADE",
|
|
226
|
+
"FREEZE_ABORT"
|
|
227
|
+
];
|
|
228
|
+
data.freezeType = freezeTypes[body.freezeType] || "FREEZE_ONLY";
|
|
337
229
|
}
|
|
230
|
+
return data;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Parse System Delete from protobuf data
|
|
234
|
+
*/
|
|
235
|
+
static parseSystemDeleteFromProto(body) {
|
|
236
|
+
if (!body) return void 0;
|
|
237
|
+
const data = {};
|
|
338
238
|
if (body.fileID) {
|
|
339
|
-
data.
|
|
340
|
-
data.initcode = new FileId(
|
|
239
|
+
data.fileId = new FileId(
|
|
341
240
|
body.fileID.shardNum ?? 0,
|
|
342
241
|
body.fileID.realmNum ?? 0,
|
|
343
242
|
body.fileID.fileNum ?? 0
|
|
344
243
|
).toString();
|
|
345
|
-
} else if (body.
|
|
346
|
-
data.
|
|
347
|
-
data.initcode = Buffer.from(body.initcode).toString("hex");
|
|
348
|
-
}
|
|
349
|
-
return data;
|
|
350
|
-
}
|
|
351
|
-
static parseContractUpdate(body) {
|
|
352
|
-
if (!body) return void 0;
|
|
353
|
-
const data = {};
|
|
354
|
-
if (body.contractID) {
|
|
355
|
-
data.contractIdToUpdate = new ContractId(
|
|
244
|
+
} else if (body.contractID) {
|
|
245
|
+
data.contractId = new ContractId(
|
|
356
246
|
body.contractID.shardNum ?? 0,
|
|
357
247
|
body.contractID.realmNum ?? 0,
|
|
358
248
|
body.contractID.contractNum ?? 0
|
|
359
249
|
).toString();
|
|
360
250
|
}
|
|
361
|
-
if (body.adminKey) {
|
|
362
|
-
data.adminKey = parseKey(body.adminKey);
|
|
363
|
-
}
|
|
364
251
|
if (body.expirationTime?.seconds) {
|
|
365
|
-
data.expirationTime =
|
|
252
|
+
data.expirationTime = Long.fromValue(
|
|
366
253
|
body.expirationTime.seconds
|
|
367
|
-
).toString()}.${body.expirationTime.nanos}`;
|
|
368
|
-
}
|
|
369
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
370
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
371
|
-
body.autoRenewPeriod.seconds
|
|
372
|
-
).toString();
|
|
373
|
-
}
|
|
374
|
-
if (body.memo) {
|
|
375
|
-
const memoUnion = body.memo;
|
|
376
|
-
if (memoUnion && typeof memoUnion === "object" && Object.prototype.hasOwnProperty.call(memoUnion, "value")) {
|
|
377
|
-
const value = memoUnion.value;
|
|
378
|
-
if (value === null || value === void 0) {
|
|
379
|
-
data.memo = void 0;
|
|
380
|
-
} else {
|
|
381
|
-
data.memo = String(value);
|
|
382
|
-
}
|
|
383
|
-
} else if (typeof memoUnion === "string") {
|
|
384
|
-
data.memo = memoUnion;
|
|
385
|
-
} else {
|
|
386
|
-
data.memo = void 0;
|
|
387
|
-
}
|
|
388
|
-
} else {
|
|
389
|
-
data.memo = void 0;
|
|
390
|
-
}
|
|
391
|
-
if (body.stakedAccountId) {
|
|
392
|
-
data.stakedAccountId = new AccountId(
|
|
393
|
-
body.stakedAccountId.shardNum ?? 0,
|
|
394
|
-
body.stakedAccountId.realmNum ?? 0,
|
|
395
|
-
body.stakedAccountId.accountNum ?? 0
|
|
396
|
-
).toString();
|
|
397
|
-
data.stakedNodeId = void 0;
|
|
398
|
-
} else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0 && Long.fromValue(body.stakedNodeId).notEquals(-1)) {
|
|
399
|
-
data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
|
|
400
|
-
data.stakedAccountId = void 0;
|
|
401
|
-
} else {
|
|
402
|
-
data.stakedNodeId = void 0;
|
|
403
|
-
data.stakedAccountId = void 0;
|
|
404
|
-
}
|
|
405
|
-
if (body.declineReward?.value !== void 0) {
|
|
406
|
-
data.declineReward = body.declineReward.value;
|
|
407
|
-
}
|
|
408
|
-
if (body.maxAutomaticTokenAssociations?.value !== void 0) {
|
|
409
|
-
data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations.value;
|
|
410
|
-
}
|
|
411
|
-
if (body.autoRenewAccountId) {
|
|
412
|
-
data.autoRenewAccountId = new AccountId(
|
|
413
|
-
body.autoRenewAccountId.shardNum ?? 0,
|
|
414
|
-
body.autoRenewAccountId.realmNum ?? 0,
|
|
415
|
-
body.autoRenewAccountId.accountNum ?? 0
|
|
416
254
|
).toString();
|
|
417
255
|
}
|
|
418
256
|
return data;
|
|
419
257
|
}
|
|
420
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Parse System Undelete from protobuf data
|
|
260
|
+
*/
|
|
261
|
+
static parseSystemUndeleteFromProto(body) {
|
|
421
262
|
if (!body) return void 0;
|
|
422
263
|
const data = {};
|
|
423
|
-
if (body.
|
|
424
|
-
data.
|
|
264
|
+
if (body.fileID) {
|
|
265
|
+
data.fileId = new FileId(
|
|
266
|
+
body.fileID.shardNum ?? 0,
|
|
267
|
+
body.fileID.realmNum ?? 0,
|
|
268
|
+
body.fileID.fileNum ?? 0
|
|
269
|
+
).toString();
|
|
270
|
+
} else if (body.contractID) {
|
|
271
|
+
data.contractId = new ContractId(
|
|
425
272
|
body.contractID.shardNum ?? 0,
|
|
426
273
|
body.contractID.realmNum ?? 0,
|
|
427
274
|
body.contractID.contractNum ?? 0
|
|
428
275
|
).toString();
|
|
429
276
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
277
|
+
return data;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Parse Node Create from protobuf data
|
|
281
|
+
*/
|
|
282
|
+
static parseNodeCreateFromProto(body) {
|
|
283
|
+
if (!body) return void 0;
|
|
284
|
+
const data = {};
|
|
285
|
+
if (body.nodeId !== void 0) {
|
|
286
|
+
data.nodeId = Long.fromValue(body.nodeId).toNumber();
|
|
287
|
+
}
|
|
288
|
+
return data;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Parse Node Update from protobuf data
|
|
292
|
+
*/
|
|
293
|
+
static parseNodeUpdateFromProto(body) {
|
|
294
|
+
if (!body) return void 0;
|
|
295
|
+
const data = {};
|
|
296
|
+
if (body.nodeId !== void 0) {
|
|
297
|
+
data.nodeId = Long.fromValue(body.nodeId).toNumber();
|
|
298
|
+
}
|
|
299
|
+
return data;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Parse Node Delete from protobuf data
|
|
303
|
+
*/
|
|
304
|
+
static parseNodeDeleteFromProto(body) {
|
|
305
|
+
if (!body) return void 0;
|
|
306
|
+
const data = {};
|
|
307
|
+
if (body.nodeId !== void 0) {
|
|
308
|
+
data.nodeId = Long.fromValue(body.nodeId).toNumber();
|
|
442
309
|
}
|
|
443
310
|
return data;
|
|
444
311
|
}
|
|
312
|
+
static parseUtilPrng(body) {
|
|
313
|
+
if (!body) return void 0;
|
|
314
|
+
const data = {};
|
|
315
|
+
if (body.range && body.range !== 0) {
|
|
316
|
+
data.range = body.range;
|
|
317
|
+
}
|
|
318
|
+
return data;
|
|
319
|
+
}
|
|
320
|
+
static parseFreeze(body) {
|
|
321
|
+
return this.parseNetworkFreezeFromProto(body);
|
|
322
|
+
}
|
|
445
323
|
/**
|
|
446
|
-
* Parse
|
|
324
|
+
* Parse Utility/System Service transaction from Transaction object
|
|
447
325
|
* This is the unified entry point that delegates to the comprehensive parsing logic
|
|
448
326
|
*/
|
|
449
327
|
static parseFromTransactionObject(transaction) {
|
|
450
|
-
return this.
|
|
328
|
+
return this.parseUtilTransaction(transaction);
|
|
451
329
|
}
|
|
452
330
|
}
|
|
453
331
|
export {
|
|
454
|
-
|
|
332
|
+
UtilParser
|
|
455
333
|
};
|
|
456
334
|
//# sourceMappingURL=standards-sdk.es145.js.map
|